-------7.."/
V.3 "....,,------SIGNED DISTANCE FROM POINT TO PLANE Prfamos Georgiades CrystalGraphics, Inc. Santa Clara, California
The standard way of obtaining the shortest (Euclidean) distance from a point P to a plane J is finding the orthogonal projection Q of Ponto J, so that the distance is the length of the vector P - Q. This involves computing a square root (Glassner, 1990). Furthermore, if the application requires ordering a set of points with respect to their distance from J, it is necessary to know on which side of the plane the points lie. This would require another dot product operation. This gem yields the signed distance from P to J with a single dot product and an addition. It assumes that the plane equation is represented by its unit normal, J N' and a scalar J d such that for any point R on the plane, I N • R + J d = O. In most applications, it will become necessary to normalize the plane normal at one instance or another, so it is expected that all plane normals are thus maintained. It is a one-time square-root and division operation that will eliminate the need to evaluate a square root each time a distance from this plane is sought. The intuition behind this is that since the line connecting P to its projection Q on the plane is collinear to J N' its length can be measured as a scalar multiple of I N • Assuming that the length of I N is known to be 1, that scalar value is the wanted distance from the plane. The derivation has as follows: Let d = IP - Q I, and express P using the parametric equation of the line through Q normal to J. Let N = J N.
Copyright © 1992 by Academic Press, Inc. All rights of reproduction in any form reserved. ISBN 0-12-409670-0 (IBM) ISBN 0-12-409671-9 (Mac)
223
- - - - - - 3-D GEOMETRY AND ALGORITHMS - - - - - -
Then P
=
dN + Q, or
Multiply each equation by the respective coordinate of N and add.
NzPz = dNz2 + NzQz N·P=dN·N+N·Q
But N· N = 1 by assumption, and N· Q = - J d from the plane equation. Hence d = N· P + J d , or in Gems' notation
Note that, if d is positive, then P lies on the same side of J as its normal, if it's negative it lies on the back side, and if zero (or within some epsilon-small value) it lies on the plane. Moreover, the projection Q of P onto J can now be obtained from the parametric equation of the line with the computed d. See also G1, 297.
224