{---------------------------------------------------------------------
Two routines are made available, the first takes into account a segment
and will produce point on the given segment that is of least distance
to an external point.

The second routine is similar to the first other than the fact that it
will extended the given segment into a ray and hence also produce a point
on the ray which will produce a segment of least distance between that
point and an external point, the segment produced between the point on
the ray and the external point is guaranteed to be perpendicular to the
ray in all cases except for the instance where the external point is
collinear to ray.