Class GreatArc
- java.lang.Object
-
- org.apache.commons.geometry.spherical.twod.GreatCircleSubset
-
- org.apache.commons.geometry.spherical.twod.GreatArc
-
- All Implemented Interfaces:
Embedding<Point2S,Point1S>
,HyperplaneConvexSubset<Point2S>
,HyperplaneSubset<Point2S>
,Splittable<Point2S,HyperplaneSubset<Point2S>>
,RegionEmbedding<Point2S,Point1S>
,Sized
public final class GreatArc extends GreatCircleSubset implements HyperplaneConvexSubset<Point2S>
Class representing a single, convex angular interval in aGreatCircle
. Convex angular intervals are those where the shortest path between all pairs of points in the interval are completely contained in the interval. In the case of paths that tie for the shortest length, it is sufficient that one of the paths is completely contained in the interval. In spherical 2D space, convex arcs either fill the entire great circle or have an angular size of less than or equal topi
radians.Instances of this class are guaranteed to be immutable.
- See Also:
GreatCircles
-
-
Field Summary
Fields Modifier and Type Field Description private AngularInterval.Convex
interval
The interval representing the region of the great circle contained in the arc.
-
Constructor Summary
Constructors Constructor Description GreatArc(GreatCircle circle, AngularInterval.Convex interval)
Create a new instance from a great circle and the interval embedded in it.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Point2S
getEndPoint()
Return the end point of the arc, or null if the arc represents the full space.AngularInterval.Convex
getInterval()
Get the angular interval for the arc.Point2S
getMidPoint()
Return the midpoint of the arc, or null if the arc represents the full space.Point2S
getStartPoint()
Return the start point of the arc, or null if the arc represents the full space.AngularInterval.Convex
getSubspaceRegion()
Get the embedded subspace region.GreatArc
reverse()
Reverse the orientation of the hyperplane for this instance, returning the result as a new instance.Split<GreatArc>
split(Hyperplane<Point2S> splitter)
Split this instance with the given hyperplane.java.util.List<GreatArc>
toConvex()
Convert this instance into a list of convex child subsets representing the same region.java.lang.String
toString()
Return a string representation of this great arc.GreatArc
transform(Transform<Point2S> transform)
Return a new hyperplane subset resulting from the application of the given transform.-
Methods inherited from class org.apache.commons.geometry.spherical.twod.GreatCircleSubset
classify, closest, getCentroid, getCircle, getHyperplane, getPrecision, getSize, isEmpty, isFull, toSpace, toSubspace
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.commons.geometry.core.Embedding
toSpace, toSubspace
-
Methods inherited from interface org.apache.commons.geometry.core.partitioning.HyperplaneSubset
classify, closest, contains, getCentroid, getHyperplane, isEmpty, isFull
-
Methods inherited from interface org.apache.commons.geometry.core.Sized
getSize, isFinite, isInfinite
-
-
-
-
Field Detail
-
interval
private final AngularInterval.Convex interval
The interval representing the region of the great circle contained in the arc.
-
-
Constructor Detail
-
GreatArc
GreatArc(GreatCircle circle, AngularInterval.Convex interval)
Create a new instance from a great circle and the interval embedded in it.- Parameters:
circle
- defining great circle instanceinterval
- convex angular interval embedded in the great circle
-
-
Method Detail
-
getStartPoint
public Point2S getStartPoint()
Return the start point of the arc, or null if the arc represents the full space.- Returns:
- the start point of the arc, or null if the arc represents the full space.
-
getEndPoint
public Point2S getEndPoint()
Return the end point of the arc, or null if the arc represents the full space.- Returns:
- the end point of the arc, or null if the arc represents the full space.
-
getMidPoint
public Point2S getMidPoint()
Return the midpoint of the arc, or null if the arc represents the full space.- Returns:
- the midpoint of the arc, or null if the arc represents the full space.
-
getInterval
public AngularInterval.Convex getInterval()
Get the angular interval for the arc.- Returns:
- the angular interval for the arc
- See Also:
getSubspaceRegion()
-
getSubspaceRegion
public AngularInterval.Convex getSubspaceRegion()
Get the embedded subspace region.- Specified by:
getSubspaceRegion
in interfaceRegionEmbedding<Point2S,Point1S>
- Specified by:
getSubspaceRegion
in classGreatCircleSubset
- Returns:
- the embedded subspace region
-
toConvex
public java.util.List<GreatArc> toConvex()
Convert this instance into a list of convex child subsets representing the same region. Implementations are not required to return an optimal convex subdivision of the current instance. They are free to return whatever subdivision is readily available.- Specified by:
toConvex
in interfaceHyperplaneSubset<Point2S>
- Specified by:
toConvex
in classGreatCircleSubset
- Returns:
- a list of hyperplane convex subsets representing the same subspace region as this instance
-
split
public Split<GreatArc> split(Hyperplane<Point2S> splitter)
Split this instance with the given hyperplane.The parts resulting from a split operation with a convex subset are guaranteed to also be convex.
- Specified by:
split
in interfaceHyperplaneConvexSubset<Point2S>
- Specified by:
split
in interfaceSplittable<Point2S,HyperplaneSubset<Point2S>>
- Parameters:
splitter
- the hyperplane to split this object with.- Returns:
- result of the split operation
-
transform
public GreatArc transform(Transform<Point2S> transform)
Return a new hyperplane subset resulting from the application of the given transform. The current instance is not modified.Hyperplane convex subsets subjected to affine transformations remain convex.
- Specified by:
transform
in interfaceHyperplaneConvexSubset<Point2S>
- Specified by:
transform
in interfaceHyperplaneSubset<Point2S>
- Parameters:
transform
- the transform instance to apply- Returns:
- new transformed hyperplane subset
-
reverse
public GreatArc reverse()
Reverse the orientation of the hyperplane for this instance, returning the result as a new instance. The returned subset contains the same points but has a reversed orientation.- Specified by:
reverse
in interfaceHyperplaneConvexSubset<Point2S>
- Returns:
- a hyperplane convex subset representing the same region but with the opposite orientation.
-
toString
public java.lang.String toString()
Return a string representation of this great arc.In order to keep the string representation short but useful, the exact format of the return value depends on the properties of the arc. See below for examples.
- Full arc
GreatArc[full= true, circle= GreatCircle[pole= (0.0, 0.0, 1.0), x= (1.0, 0.0, 0.0), y= (0.0, 1.0, 0.0)]
- Non-full arc
GreatArc[start= (1.0, 1.5707963267948966), end= (2.0, 1.5707963267948966)
- Overrides:
toString
in classjava.lang.Object
- Full arc
-
-