[
https://issues.apache.org/jira/browse/GEOMETRY-92?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17098951#comment-17098951
]
Matt Juntunen commented on GEOMETRY-92:
---------------------------------------
[~erans], I've implemented the changes we discussed and added them to my PR.
Here are a few notes:
* All references to subhyperplanes, sublines, subplanes, etc have been
(hopefully!) removed and replaced with the appropriate name using the
"hyperplane subset" naming convention. I noticed that this made some of the
documentation slightly more awkward to read but it is at least clearer.
* I ended up using a single factory class per space/dimension for hyperplanes
and hyperplane-convex-subsets. It just seemed cleaner that way. Here are some
examples:
{code:java}
Line line = Lines.fromPoints(a, b, precision);
Segment seg = Lines.segmentFromPoints(a, b, precision);
Line3D line3 = Lines3D.fromPoint(c, d, precision);
Ray3D ray3 = Lines3D.rayFromPointAndDirection(c, Vector3D.Unit.PLUS_X,
precision);
{code}
* I created a {{lines}} package under {{euclidean.threed}} to contain all of
the line classes.
* I removed the spanning subset classes from the public API completely since
they didn't seem necessary. For example, there is a package-private class in
Euclidean 2D named {{LineSpanningSubset}} but it is only referenced in the
public API through its base class, {{LineConvexSubset}}.
* I removed the 1D hyperplane subset classes from the public API since they
are only useful internally; there are no subspaces of 1D space.
There are a couple more things I'd like to do before calling this ready to
merge:
1. Remove the {{AbstractEmbeddingHyperplaneSubset}} class in favor of the new
{{RegionEmbedding}} interface. This will be cleaner since all public API
methods would then be defined in interfaces.
2. Create a {{LinePath}} base class for {{Polyline}} since our current usage of
{{Polyline}} is also not technically correct: we allow the elements of the
polyline to be infinite, whereas all definitions of this term restrict the
elements to be line segments. So, I'm thinking we create a {{LinePath}} base
class where the path elements are allowed to be infinite and have {{Polyline}}
extend it, with the additional requirement that all elements are line segments.
3. Create a {{euclidean.twod.paths}} package to contain the line path classes.
WDYT?
> 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
> Labels: beta1
> 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)