[
https://issues.apache.org/jira/browse/MATH-641?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13087791#comment-13087791
]
Curtis Jensen commented on MATH-641:
------------------------------------
I am looking for the shortest distance to a segment including the end points.
I think it can be done by finding the the point on the line perpendicular the
the specified distance point. If the perpendicular point is on the line
segment, then return the distance between the perpendicular point and the
specified point, otherwise return the min distance to the end points:
See:
http://www.codeguru.com/forum/printthread.php?s=37e72c81efe767865815ecdb4a943d87&t=194400&pp=15
Also, some smarty pants figured out a simpler way to to it here:
http://www.codeguru.com/forum/printthread.php?s=cc8cf0596231f9a7dba4da6e77c29db3&t=194400&pp=15&page=2
If the line segment distance function is not added to the API (or even if it
is), it would be very useful to have a line method that calculates the point
one a line that is perpendicular to another point.
The getOffset method is still useful to me for other calculations. Though it
is inconsistent with the interface of the 3D line. The 3D line class has a
distance method while the 2D line has the getOffset method. It may be more
intuitive if the 3D and 2D line classes used the same nomenclature. getOffset
provides more information as it is signed, but distance is a more intuitive
name.
Thanks for all the help and consideration.
> Implement distance methods on 2D and 3D Lines as well as Line Segments.
> -----------------------------------------------------------------------
>
> Key: MATH-641
> URL: https://issues.apache.org/jira/browse/MATH-641
> Project: Commons Math
> Issue Type: New Feature
> Reporter: Curtis Jensen
> Priority: Minor
> Fix For: 3.1
>
> Original Estimate: 4h
> Remaining Estimate: 4h
>
> Implement a method that calculates the distance from a point to 3D and 2D
> lines and line segements (similar to what already exists in the 3D Line
> class).
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira