PLANENORMAL Compute the normal to a plane. N = planeNormal(PLANE) compute the normal of the given plane PLANE : [x0 y0 z0 dx1 dy1 dz1 dx2 dy2 dz2] N : [dx dy dz] See also geom3d, planes3d, createPlane
0001 function n = planeNormal(plane) 0002 %PLANENORMAL Compute the normal to a plane. 0003 % 0004 % N = planeNormal(PLANE) 0005 % compute the normal of the given plane 0006 % PLANE : [x0 y0 z0 dx1 dy1 dz1 dx2 dy2 dz2] 0007 % N : [dx dy dz] 0008 % 0009 % See also 0010 % geom3d, planes3d, createPlane 0011 % 0012 0013 % --------- 0014 % author : David Legland 0015 % INRA - TPV URPOI - BIA IMASTE 0016 % created the 17/02/2005. 0017 % 0018 0019 % HISTORY 0020 % 15/04/2013 Extended to N-dim planes by Sven Holcombe 0021 0022 % plane normal 0023 outSz = size(plane); 0024 outSz(2) = 3; 0025 n = zeros(outSz); 0026 n(:) = crossProduct3d(plane(:,4:6,:), plane(:, 7:9,:));