Home > matGeom > geom3d > distancePointPlane.m

distancePointPlane

PURPOSE ^

DISTANCEPOINTPLANE Signed distance betwen 3D point and plane.

SYNOPSIS ^

function d = distancePointPlane(point, plane)

DESCRIPTION ^

DISTANCEPOINTPLANE Signed distance betwen 3D point and plane.

   D = distancePointPlane(POINT, PLANE)
   Returns the euclidean distance between point POINT and the plane PLANE,
   given by: 
   POINT : [x0 y0 z0]
   PLANE : [x0 y0 z0 dx1 dy1 dz1 dx2 dy2 dz2]
   D     : scalar  
   
   See also:
   planes3d, points3d, intersectLinePlane

   ---------
   author : David Legland
   INRA - TPV URPOI - BIA IMASTE
   created the 18/02/2005.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function d = distancePointPlane(point, plane)
0002 %DISTANCEPOINTPLANE Signed distance betwen 3D point and plane.
0003 %
0004 %   D = distancePointPlane(POINT, PLANE)
0005 %   Returns the euclidean distance between point POINT and the plane PLANE,
0006 %   given by:
0007 %   POINT : [x0 y0 z0]
0008 %   PLANE : [x0 y0 z0 dx1 dy1 dz1 dx2 dy2 dz2]
0009 %   D     : scalar
0010 %
0011 %   See also:
0012 %   planes3d, points3d, intersectLinePlane
0013 %
0014 %   ---------
0015 %   author : David Legland
0016 %   INRA - TPV URPOI - BIA IMASTE
0017 %   created the 18/02/2005.
0018 %
0019 
0020 %   HISTORY
0021 
0022 
0023 % normalized plane normal
0024 n = normalizeVector3d(cross(plane(:,4:6), plane(:, 7:9), 2));
0025 
0026 
0027 % Uses Hessian form, ie : N.p = d
0028 % I this case, d can be found as : -N.p0, when N is normalized
0029 d = -sum(bsxfun(@times, n, bsxfun(@minus, plane(:,1:3), point)), 2);

Generated on Wed 16-Feb-2022 15:10:47 by m2html © 2003-2019