[
https://issues.apache.org/jira/browse/GEOMETRY-92?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17086952#comment-17086952
]
Gilles Sadowski commented on GEOMETRY-92:
-----------------------------------------
{quote}they will be used quite frequently
{quote}
IMO, namespaces make the code more self-documenting (cf. below example that
only has the minor drawback of having to type 10 additional characters).
{quote}Span I consider a little bit different
{quote}
>From functionality and implementation perspectives, it's not obvious why some
>subclasses of {{ConvexSubLine3D}} are "more equal than others"... ;)
Also, from a usability POV, it's easier to find all related "tools" (in this
case, the various "subsets" of a "line") nested within the class that
represents it (i.e. {{Line3D}}).
{quote}
{code:java}
Ray3D ray = Ray3D.fromPointAndDirection(pt, dir, precision);
{code}
{quote}
That would just be replaced with
{code:java}
Line3D.Ray ray = Line3D.Ray.fromPointAndDirection(pt, dir, precision);
{code}
{quote}"opposite ray" doesn't quite match
{quote}
Right indeed; sorry.
{quote}a line that only has an end point and no start point, which is not a ray
at all.
{quote}
What are its use-cases?
> 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
> Time Spent: 10m
> Remaining Estimate: 0h
>
> 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)