Class InteriorAngleLinePathConnector
java.lang.Object
org.apache.commons.geometry.euclidean.internal.AbstractPathConnector<AbstractLinePathConnector.ConnectableLineSubset>
org.apache.commons.geometry.euclidean.twod.path.AbstractLinePathConnector
org.apache.commons.geometry.euclidean.twod.path.InteriorAngleLinePathConnector
- Direct Known Subclasses:
InteriorAngleLinePathConnector.Maximize
,InteriorAngleLinePathConnector.Minimize
Line subset 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 line subset and an outgoing
line subset as measured on the minus (interior) side of the incoming line.
If looking along the direction of the incoming line subset, smaller interior
angles point more to the left and larger ones point more to the right.
This class provides two concrete implementations: InteriorAngleLinePathConnector.Maximize
and
InteriorAngleLinePathConnector.Minimize
, which choose connections with the largest or smallest interior
angles respectively.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final class
Implementation ofInteriorAngleLinePathConnector
that chooses line subset connections that produce the largest interior angles.static final class
Implementation ofInteriorAngleLinePathConnector
that chooses line subset connections that produce the smallest interior angles.Nested classes/interfaces inherited from class org.apache.commons.geometry.euclidean.twod.path.AbstractLinePathConnector
AbstractLinePathConnector.ConnectableLineSubset
Nested classes/interfaces inherited from class org.apache.commons.geometry.euclidean.internal.AbstractPathConnector
AbstractPathConnector.ConnectableElement<E extends AbstractPathConnector.ConnectableElement<E>>
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionconnectMaximized
(Collection<LineConvexSubset> subsets) Convenience method for connecting a collection of line subsets with interior angles maximized when possible.connectMinimized
(Collection<LineConvexSubset> subsets) Convenience method for connecting a collection of line subsets with interior angles minimized when possible.protected abstract boolean
isBetterAngle
(double newAngle, double previousAngle) Return true ifnewAngle
represents a better interior angle thanpreviousAngle
.selectConnection
(AbstractLinePathConnector.ConnectableLineSubset incoming, List<AbstractLinePathConnector.ConnectableLineSubset> 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.euclidean.twod.path.AbstractLinePathConnector
add, add, connect, connectAll, connectAll
Methods inherited from class org.apache.commons.geometry.euclidean.internal.AbstractPathConnector
addPathElement, computePathRoots, connectPathElements, selectPointConnection
-
Constructor Details
-
InteriorAngleLinePathConnector
public InteriorAngleLinePathConnector()
-
-
Method Details
-
selectConnection
protected AbstractLinePathConnector.ConnectableLineSubset selectConnection(AbstractLinePathConnector.ConnectableLineSubset incoming, List<AbstractLinePathConnector.ConnectableLineSubset> 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<AbstractLinePathConnector.ConnectableLineSubset>
- 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
Convenience method for connecting a collection of line subsets with interior angles maximized when possible. This method is equivalent tonew Maximize().connect(subsets)
.- Parameters:
subsets
- line subsets to connect- Returns:
- a list of connected line subset paths
- See Also:
-
connectMinimized
Convenience method for connecting a collection of line subsets with interior angles minimized when possible. This method is equivalent tonew Minimize().connect(subsets)
.- Parameters:
subsets
- line subsets to connect- Returns:
- a list of connected line subset paths
- See Also:
-