Class InteriorAngleGreatArcConnector
- java.lang.Object
-
- org.apache.commons.geometry.euclidean.internal.AbstractPathConnector<AbstractGreatArcConnector.ConnectableGreatArc>
-
- org.apache.commons.geometry.spherical.twod.AbstractGreatArcConnector
-
- org.apache.commons.geometry.spherical.twod.InteriorAngleGreatArcConnector
-
- Direct Known Subclasses:
InteriorAngleGreatArcConnector.Maximize
,InteriorAngleGreatArcConnector.Minimize
public abstract class InteriorAngleGreatArcConnector extends AbstractGreatArcConnector
Great arc connector that selects between multiple connection options based on the resulting interior angle. An interior angle in this case is the angle created between an incoming arc and an outgoing arc as measured on the minus (interior) side of the incoming arc. If looking along the direction of the incoming arc, smaller interior angles point more to the left and larger ones point more to the right.This class provides two concrete implementations:
InteriorAngleGreatArcConnector.Maximize
andInteriorAngleGreatArcConnector.Minimize
, which choose connections with the largest or smallest interior angles respectively.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
InteriorAngleGreatArcConnector.Maximize
Implementation ofInteriorAngleGreatArcConnector
that chooses arc connections that produce the largest interior angles.static class
InteriorAngleGreatArcConnector.Minimize
Implementation ofInteriorAngleGreatArcConnector
that chooses arc connections that produce the smallest interior angles.-
Nested classes/interfaces inherited from class org.apache.commons.geometry.spherical.twod.AbstractGreatArcConnector
AbstractGreatArcConnector.ConnectableGreatArc
-
Nested classes/interfaces inherited from class org.apache.commons.geometry.euclidean.internal.AbstractPathConnector
AbstractPathConnector.ConnectableElement<E extends AbstractPathConnector.ConnectableElement<E>>
-
-
Constructor Summary
Constructors Constructor Description InteriorAngleGreatArcConnector()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static java.util.List<GreatArcPath>
connectMaximized(java.util.Collection<GreatArc> arcs)
Convenience method for connecting a set of arcs with interior angles maximized when possible.static java.util.List<GreatArcPath>
connectMinimized(java.util.Collection<GreatArc> arcs)
Convenience method for connecting a set of line segments with interior angles minimized when possible.protected abstract boolean
isBetterAngle(double newAngle, double previousAngle)
Return true ifnewAngle
represents a better interior angle thanpreviousAngle
.protected AbstractGreatArcConnector.ConnectableGreatArc
selectConnection(AbstractGreatArcConnector.ConnectableGreatArc incoming, java.util.List<AbstractGreatArcConnector.ConnectableGreatArc> outgoing)
Method called to select a connection to use for a given segment when multiple non-length-zero connections are available.-
Methods inherited from class org.apache.commons.geometry.spherical.twod.AbstractGreatArcConnector
add, add, connect, connectAll, connectAll
-
Methods inherited from class org.apache.commons.geometry.euclidean.internal.AbstractPathConnector
addPathElement, computePathRoots, connectPathElements, selectPointConnection
-
-
-
-
Method Detail
-
selectConnection
protected AbstractGreatArcConnector.ConnectableGreatArc selectConnection(AbstractGreatArcConnector.ConnectableGreatArc incoming, java.util.List<AbstractGreatArcConnector.ConnectableGreatArc> outgoing)
Method called to select a connection to use for a given segment when multiple non-length-zero connections are available. In this case, the selection of the outgoing connection depends only on the desired characteristics of the connected path.- Specified by:
selectConnection
in classAbstractPathConnector<AbstractGreatArcConnector.ConnectableGreatArc>
- Parameters:
incoming
- the incoming segmentoutgoing
- list of available outgoing connections; will always contain at least two elements- Returns:
- the connection to use
-
isBetterAngle
protected abstract boolean isBetterAngle(double newAngle, double previousAngle)
Return true ifnewAngle
represents a better interior angle thanpreviousAngle
.- Parameters:
newAngle
- the new angle under considerationpreviousAngle
- the previous best angle- Returns:
- true if
newAngle
represents a better interior angle thanpreviousAngle
-
connectMaximized
public static java.util.List<GreatArcPath> connectMaximized(java.util.Collection<GreatArc> arcs)
Convenience method for connecting a set of arcs with interior angles maximized when possible. This method is equivalent tonew Maximize().connect(segments)
.- Parameters:
arcs
- arcs to connect- Returns:
- a list of connected arc paths
- See Also:
InteriorAngleGreatArcConnector.Maximize
-
connectMinimized
public static java.util.List<GreatArcPath> connectMinimized(java.util.Collection<GreatArc> arcs)
Convenience method for connecting a set of line segments with interior angles minimized when possible. This method is equivalent tonew Minimize().connect(segments)
.- Parameters:
arcs
- arcs to connect- Returns:
- a list of connected arc paths
- See Also:
InteriorAngleGreatArcConnector.Minimize
-
-