1.1 面的表示方法
由上图可以知道
n(p-p0) = 0;
设d = -np0 由此可以知道,d的几何意义
所以有:np+d = 0;为平面方程,其中p为平面上的任意一点,n为平面的单位法向量,
如果空间中一点Px,如果nPx + d = 0,那么Px在(np+d=0)表示的平面上,如果大于0,该点在平面的上面(法线所指的方向),如果小于0,该点在平面的下面。
1.2 几何推理
1.3 函数实现:
/** This is a pseudodistance. The sign of the return value is
positive if the point is on the positive side of the plane,
negative if the point is on the negative side, and zero if the
point is on the plane.
@par--
The absolute value of the return value is the true distance only
when the plane normal is a unit length vector.
*/
Real Plane::getDistance (const Vector3& rkPoint) const
{
return normal.dotProduct(rkPoint) + d;//为平面方程中的d
}
1.4 点到平面的距离公式