[
https://issues.apache.org/jira/browse/MATH-641?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13087204#comment-13087204
]
Luc Maisonobe commented on MATH-641:
------------------------------------
2D lines are hyperplanes, hence they do implement the getOffset method, which
is basically a signed distance.
So if you have point p and line l, the distance between p and l is
FastMath.abs(l.getOffset(p)). The sign is in fact chosen to have negative
offsets on the left half place and positive offsets on the right half-plane.
Considering segments, I'm not sure what you want. If we don't consider the
endpoints but only the support line, we can retrieve this support line by
subLine.getHyperplane() (because sub-lines implement SubHyperplane). If we
consider the endpoints, the computation is much more complex, as it is
basically the distance to the support line if the closest line point is in the
segment, or it is min(d(P, Ei)) where Ei are all the endpoints of the segment.
Are the current methods sufficient for your needs and if not what are exactly
your needs ?
> 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