SquareOfPointToLineDistance
From Solid Graphics Wiki

The SquareOfPointToLineDistance function returns square of shortest distance from line to point.
float SquareOfPointToLineDistance ( const float rkPoint[ 3 ], const float P0[ 3 ], const float P1[ 3 ] );
double SquareOfPointToLineDistance ( const double rkPoint[ 3 ], const double P0[ 3 ], const double P1[ 3 ] );
Parameters
rkPoint  x,y,z coordinates of the point 
P0  x,y,z coordinates of first point defining the line 
P1  x,y,z coordinates of second point defining the line 
Return Value
The square of shortest distance from the line to the point.
See Also