good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
I think that what you really want is the distance of a point to a segment, and not the distance to a line. Because a line is infinite, and the shortest distance of a point to a line might fall outside your segment. In the case below, the distance of the point C to the line AB is CP. But P is outside of your segment, and what you really want is CA and not CP.
So, you must find the coordinate of P (the distance to the line) then check if P is outside of your segment. If it's outside, then you compute CA and CB and take the shortest. In reply to Re: Algorithm: point with N distance of a line between two other points
by choocroot
|
|