[
https://issues.apache.org/jira/browse/GEOMETRY-92?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17075988#comment-17075988
]
Matt Juntunen commented on GEOMETRY-92:
---------------------------------------
I've been working on this here:
[https://github.com/darkma773r/commons-geometry/tree/geometry-92-working.]
I currently have the following class names for 2D, based on our discussions,
further thought, and some small amount of use:
* {{Line.Span}} - no start or end points; this was previously called
{{FullLine}}, but it thought it would be a good fit as a static inner class
since (as you pointed out) it is so closely related to {{Line}}. Also, the
method in {{Line}} that returns an instance of this class is called {{span()}}.
* {{Segment}} - has start and end points; matches exactly the standard
definition of "line segment" found in textbooks
* {{Ray}} - start point only; matches exactly the standard definition of "ray"
found in textbooks
* {{TerminatedLine}} - end point only; previously called {{IncomingRay}} but I
switched it because I always had to stop a moment to think about which point
was present when working with the class. This name lets me know immediately
that the end point is the one present.
> Segment is not mathematically correct
> -------------------------------------
>
> Key: GEOMETRY-92
> URL: https://issues.apache.org/jira/browse/GEOMETRY-92
> Project: Apache Commons Geometry
> Issue Type: Improvement
> Reporter: Matt Juntunen
> Priority: Major
>
> The {{Segment}} class is not mathematically correct because line segments are
> defined as having distinct start and end points, whereas the start and end
> points in {{Segment}} are optional. In other words, an instance of
> {{Segment}} can represent an entire line, a ray, or a segment. I propose
> renaming the existing {{Segment}} class to {{ConvexSubLine}} and creating
> subclasses to represent the distinct types of sublines.
> * {{ConvexSubLine}} - Abstract convex subline class. The factory methods
> (such as fromPoints()), would examine the inputs and return one of the
> specific subclasses below. Each subclass would also contain its own factory
> methods that apply input validation (eg, no null points when creating a
> {{Segment}}). This would also allow each subclass to optimize some
> computations based on the known characteristics of the represented entity.
> ** {{FullLine}} - no start or end points
> ** {{Segment}} - contains non-null start point and end point
> ** {{Ray}} - contains non-null start point and null end point
> ** {{ReverseRay}} - contains non-null end point and null start point (not
> sure if there is a more mathematical term for this)
> These changes would also apply to the 3D classes:
> * {{ConvexSubLine3D}}
> ** {{FullLine3D}}
> ** {{Segment3D}}
> ** {{Ray3D}}
> ** {{ReverseRay3D}}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)