Home > vbmeg > external > iso2mesh > getplanefrom3pt.m

getplanefrom3pt

PURPOSE ^

SYNOPSIS ^

function [a,b,c,d]=getplanefrom3pt(plane)

DESCRIPTION ^

 [a,b,c,d]=getplanefrom3pt(plane)
 
 define a plane equation ax+by+cz+d=0 from three 3D points

 author: Qianqian Fang, <q.fang at neu.edu>

 input: 
    plane: a 3x3 matrix with each row specifying a 3D point (x,y,z)

 output:
    a,b,c,d: the coefficient for plane equation ax+by+cz+d=0

 -- this function is part of iso2mesh toolbox (http://iso2mesh.sf.net)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [a,b,c,d]=getplanefrom3pt(plane)
0002 %
0003 % [a,b,c,d]=getplanefrom3pt(plane)
0004 %
0005 % define a plane equation ax+by+cz+d=0 from three 3D points
0006 %
0007 % author: Qianqian Fang, <q.fang at neu.edu>
0008 %
0009 % input:
0010 %    plane: a 3x3 matrix with each row specifying a 3D point (x,y,z)
0011 %
0012 % output:
0013 %    a,b,c,d: the coefficient for plane equation ax+by+cz+d=0
0014 %
0015 % -- this function is part of iso2mesh toolbox (http://iso2mesh.sf.net)
0016 %
0017 
0018 x=plane(:,1);
0019 y=plane(:,2);
0020 z=plane(:,3);
0021 
0022 % compute the plane equation a*x + b*y +c*z +d=0
0023 
0024 a=y(1)*(z(2)-z(3))+y(2)*(z(3)-z(1))+y(3)*(z(1)-z(2));
0025 b=z(1)*(x(2)-x(3))+z(2)*(x(3)-x(1))+z(3)*(x(1)-x(2));
0026 c=x(1)*(y(2)-y(3))+x(2)*(y(3)-y(1))+x(3)*(y(1)-y(2));
0027 d=-det(plane);

Generated on Mon 22-May-2023 06:53:56 by m2html © 2005