main/src/georegression/metric/ClosestPoint3D_F64.java
public static Point3D_F64 closestPoint( PlaneGeneral3D_F64 plane , Point3D_F64 point , Point3D_F64 found ) {
		if( found == null )
			found = new Point3D_F64();

		double top = plane.A*point.x + plane.B*point.y + plane.C*point.z - plane.D;

		double n2 = plane.A*plane.A + plane.B*plane.B + plane.C*plane.C;

		found.x = point.x - plane.A*top/n2;
		found.y = point.y - plane.B*top/n2;
		found.z = point.z - plane.C*top/n2;

		return found;
	}
public static Point3D_F64 closestPoint( PlaneGeneral3D_F64 plane , Point3D_F64 point , Point3D_F64 found ) {
		if( found == null )
			found = new Point3D_F64();

		double top = plane.A*point.x + plane.B*point.y + plane.C*point.z - plane.D;

		double n2 = plane.A*plane.A + plane.B*plane.B + plane.C*plane.C;

		found.x = point.x - plane.A*top/n2;
		found.y = point.y - plane.B*top/n2;
		found.z = point.z - plane.C*top/n2;

		return found;
	}
public static Point3D_F64 closestPoint ( PlaneGeneral3D_F64 plane , Point3D_F64 point , Point3D_F64 found ) { if ( found == null ) found = new Point3D_F64 ( ) ; double top = plane . A * point . x + plane . B * point . y + plane . C * point . z - plane . D ; double n2 = plane . A * plane . A + plane . B * plane . B + plane . C * plane . C ; found . x = point . x - plane . A * top / n2 ; found . y = point . y - plane . B * top / n2 ; found . z = point . z - plane . C * top / n2 ; return found ; }
Finds the closest point on the plane to the specified point.

@param plane The plane
@param point The point
@param found (Optional) Storage for the closest point.  Can be same as instance as 'pt'. If null a new point is declared internally.
@return The closest point
Finds the closest point on the plane to the specified point .