plane=surfplane(node,face) plane equation coefficients for each face in a surface author: Qianqian Fang, <q.fang at neu.edu> input: node: a list of node coordinates (nn x 3) face: a surface mesh triangle list (ne x 3) output: plane: a (ne x 4) array, in each row, it has [a b c d] to denote the plane equation as "a*x+b*y+c*z+d=0" -- this function is part of iso2mesh toolbox (http://iso2mesh.sf.net)
0001 function plane=surfplane(node,face) 0002 % 0003 % plane=surfplane(node,face) 0004 % 0005 % plane equation coefficients for each face in a surface 0006 % 0007 % author: Qianqian Fang, <q.fang at neu.edu> 0008 % 0009 % input: 0010 % node: a list of node coordinates (nn x 3) 0011 % face: a surface mesh triangle list (ne x 3) 0012 % 0013 % output: 0014 % plane: a (ne x 4) array, in each row, it has [a b c d] 0015 % to denote the plane equation as "a*x+b*y+c*z+d=0" 0016 % 0017 % -- this function is part of iso2mesh toolbox (http://iso2mesh.sf.net) 0018 % 0019 0020 AB=node(face(:,2),1:3)-node(face(:,1),1:3); 0021 AC=node(face(:,3),1:3)-node(face(:,1),1:3); 0022 0023 N=cross(AB',AC')'; 0024 d=-dot(N',node(face(:,1),1:3)')'; 0025 plane=[N,d];