main/src/georegression/metric/ClosestPoint3D_F64.java
public static double closestPoint(LineParametric3D_F64 line, Point3D_F64 pt )
	{
		double dx = pt.x - line.p.x;
		double dy = pt.y - line.p.y;
		double dz = pt.z - line.p.z;

		return (line.slope.x*dx + line.slope.y*dy + line.slope.z*dz) / line.slope.normSq();
	}
public static double closestPoint(LineParametric3D_F64 line, Point3D_F64 pt )
	{
		double dx = pt.x - line.p.x;
		double dy = pt.y - line.p.y;
		double dz = pt.z - line.p.z;

		return (line.slope.x*dx + line.slope.y*dy + line.slope.z*dz) / line.slope.normSq();
	}
public static double closestPoint ( LineParametric3D_F64 line , Point3D_F64 pt ) { double dx = pt . x - line . p . x ; double dy = pt . y - line . p . y ; double dz = pt . z - line . p . z ; return ( line . slope . x * dx + line . slope . y * dy + line . slope . z * dz ) / line . slope . normSq ( ) ; }
Finds the closest point on a line to the specified point as a function of distance along the line.  The 3D
coordinate of the point at 'd', the returned value, is P = (x,y,z) + (slope.x,slope.y,slope.z)*d.

@param line Line on which the closest point is being found.  Not modified.
@param pt   The point whose closest point is being looked for.  Not modified.
@return The location 'd' along the line of the closeset point
Finds the closest point on a line to the specified point as a function of distance along the line . The 3D coordinate of the point at d the returned value is P = ( x y z ) + ( slope . x slope . y slope . z ) * d .