Class GreatArcPath
java.lang.Object
org.apache.commons.geometry.spherical.twod.GreatArcPath
- All Implemented Interfaces:
BoundarySource<GreatArc>,BoundarySource2S
Class representing a connected sequence of
GreatArc instances.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classClass used to build arc paths. -
Field Summary
FieldsModifier and TypeFieldDescriptionArcs comprising the instance.private static final GreatArcPathInstance containing no arcs. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturn a stream containing the boundaries for this instance.static GreatArcPath.Builderbuilder(org.apache.commons.numbers.core.Precision.DoubleEquivalence precision) Return aGreatArcPath.Builderinstance configured with the given precision context.static GreatArcPathempty()Get an instance containing no arcs.static GreatArcPathfromArcs(Collection<GreatArc> arcs) Construct a new path from the given arcs.static GreatArcPathConstruct a new path from the given arcs.static GreatArcPathfromVertexLoop(Collection<Point2S> vertices, org.apache.commons.numbers.core.Precision.DoubleEquivalence precision) Return a new path formed by connecting the given vertices.static GreatArcPathfromVertices(Collection<Point2S> vertices, boolean close, org.apache.commons.numbers.core.Precision.DoubleEquivalence precision) Return a new path formed by connecting the given vertices.static GreatArcPathfromVertices(Collection<Point2S> vertices, org.apache.commons.numbers.core.Precision.DoubleEquivalence precision) Return a new path formed by connecting the given vertices.getArcs()Get the arcs in path.Get the end arc for the path or null if the path is empty.Get the end vertex for the path or null if the path is empty or consists of a single, full arc.Get the start arc for the path or null if the path is empty.Get the start vertex for the path or null if the path is empty or consists of a single, full arc.Get the vertices contained in the path in the order they appear.booleanisClosed()Return true if the path is closed, meaning that the end point for the last arc is equal to the start point for the path.booleanisEmpty()Return true if the path does not contain any arcs.toString()Return a string representation of this arc path instance.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.commons.geometry.spherical.twod.BoundarySource2S
toList, toTree
-
Field Details
-
EMPTY
Instance containing no arcs. -
arcs
Arcs comprising the instance.
-
-
Constructor Details
-
GreatArcPath
Simple constructor. No validation is performed on the input arc.- Parameters:
arcs- arcs for the path, in connection order
-
-
Method Details
-
boundaryStream
Return a stream containing the boundaries for this instance.- Specified by:
boundaryStreamin interfaceBoundarySource<GreatArc>- Returns:
- a stream containing the boundaries for this instance
-
getArcs
Get the arcs in path.- Returns:
- the arcs in the path
-
getStartArc
Get the start arc for the path or null if the path is empty.- Returns:
- the start arc for the path or null if the path is empty
-
getEndArc
Get the end arc for the path or null if the path is empty.- Returns:
- the end arc for the path or null if the path is empty
-
getStartVertex
Get the start vertex for the path or null if the path is empty or consists of a single, full arc.- Returns:
- the start vertex for the path
-
getEndVertex
Get the end vertex for the path or null if the path is empty or consists of a single, full arc.- Returns:
- the end vertex for the path
-
getVertices
Get the vertices contained in the path in the order they appear. Closed paths contain the start vertex at the beginning of the list as well as the end.- Returns:
- the vertices contained in the path in order they appear
-
isEmpty
public boolean isEmpty()Return true if the path does not contain any arcs.- Returns:
- true if the path does not contain any arcs
-
isClosed
public boolean isClosed()Return true if the path is closed, meaning that the end point for the last arc is equal to the start point for the path.- Returns:
- true if the end point for the last arc is equal to the start point for the path
-
toString
Return a string representation of this arc path instance.In order to keep the string representation short but useful, the exact format of the return value depends on the properties of the path. See below for examples.
- Empty path
GreatArcPath[empty= true]
- Single, full arc
GreatArcPath[full= true, circle= GreatCircle[pole= (0.0, 0.0, 1.0), x= (0.0, 1.0, -0.0), y= (-1.0, 0.0, 0.0)]]
- One or more non-full arcs
GreatArcPath[vertices= [(0.0, 1.5707963267948966), (1.5707963267948966, 1.5707963267948966)]]
- Empty path
-
fromArcs
Construct a new path from the given arcs.- Parameters:
arcs- arc instance to use to construct the path- Returns:
- a new instance constructed from the given arc instances
-
fromArcs
Construct a new path from the given arcs.- Parameters:
arcs- arc instance to use to construct the path- Returns:
- a new instance constructed from the given arc instances
-
fromVertexLoop
public static GreatArcPath fromVertexLoop(Collection<Point2S> vertices, org.apache.commons.numbers.core.Precision.DoubleEquivalence precision) Return a new path formed by connecting the given vertices. An additional arc is added from the last point to the first point to construct a loop, if the two points are not already considered equal by the given precision context. This method is equivalent to callingfromPoints(points, true, precision).- Parameters:
vertices- the points to construct the path fromprecision- precision precision context used to construct the arc instances for the path- Returns:
- a new path formed by connecting the given vertices
- See Also:
-
fromVertices
public static GreatArcPath fromVertices(Collection<Point2S> vertices, org.apache.commons.numbers.core.Precision.DoubleEquivalence precision) Return a new path formed by connecting the given vertices. No additional arc is inserted to connect the last point to the first. This method is equivalent to callingfromPoint(points, false, precision).- Parameters:
vertices- the points to construct the path fromprecision- precision context used to construct the arc instances for the path- Returns:
- a new path formed by connecting the given vertices
- See Also:
-
fromVertices
public static GreatArcPath fromVertices(Collection<Point2S> vertices, boolean close, org.apache.commons.numbers.core.Precision.DoubleEquivalence precision) Return a new path formed by connecting the given vertices.- Parameters:
vertices- the points to construct the path fromclose- if true, then an additional arc will be added from the last point to the first, if the points are not already considered equal by the given precision contextprecision- precision context used to construct the arc instances for the path- Returns:
- a new path formed by connecting the given points
-
builder
public static GreatArcPath.Builder builder(org.apache.commons.numbers.core.Precision.DoubleEquivalence precision) Return aGreatArcPath.Builderinstance configured with the given precision context. The precision context is used when building arcs from points and may be omitted if raw points are not used.- Parameters:
precision- precision context to use when building arcs from raw points; may be null if raw points are not used.- Returns:
- a new
GreatArcPath.Builderinstance
-
empty
Get an instance containing no arcs.- Returns:
- an instance containing no arcs
-