From GianLuigi Piacentini@21:1/5 to All on Wed Feb 24 11:55:23 2016
Found the solution proposed by D. Eberly, found also 2 or 3 other versions
on the Internet.
All seem to revert to some form of constrained minimization.
Asking two things:
1) why not set up the problem and fire a constrained minimization routine;
2) would not be possible to solve the problem for the lines supporting the segments, then check whether or not the closest points fall within segment boundaries, if not, compute distance between the segment vertices and select the closest points ?