Class EdgesBuilder
- java.lang.Object
-
- org.apache.commons.math3.geometry.spherical.twod.EdgesBuilder
-
- All Implemented Interfaces:
BSPTreeVisitor<Sphere2D>
class EdgesBuilder extends java.lang.Object implements BSPTreeVisitor<Sphere2D>
Visitor building edges.- Since:
- 3.3
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.commons.math3.geometry.partitioning.BSPTreeVisitor
BSPTreeVisitor.Order
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.Map<Edge,BSPTree<Sphere2D>>edgeToNodeBuilt edges and their associated nodes.private java.util.Map<BSPTree<Sphere2D>,java.util.List<Edge>>nodeToEdgesListReversed map.private BSPTree<Sphere2D>rootRoot of the tree.private doubletoleranceTolerance below which points are consider to be identical.
-
Constructor Summary
Constructors Constructor Description EdgesBuilder(BSPTree<Sphere2D> root, double tolerance)Simple constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidaddContribution(SubCircle sub, boolean reversed, BSPTree<Sphere2D> node)Add the contribution of a boundary edge.java.util.List<Edge>getEdges()Get the boundary edges.private EdgegetFollowingEdge(Edge previous)Get the edge that should naturally follow another one.voidvisitInternalNode(BSPTree<Sphere2D> node)Visit a BSP tree node node having a non-null sub-hyperplane.voidvisitLeafNode(BSPTree<Sphere2D> node)Visit a leaf BSP tree node node having a null sub-hyperplane.BSPTreeVisitor.OrdervisitOrder(BSPTree<Sphere2D> node)Determine the visit order for this node.
-
-
-
Method Detail
-
visitOrder
public BSPTreeVisitor.Order visitOrder(BSPTree<Sphere2D> node)
Determine the visit order for this node.Before attempting to visit an internal node, this method is called to determine the desired ordering of the visit. It is guaranteed that this method will be called before
visitInternalNodefor a given node, it will be called exactly once for each internal node.- Specified by:
visitOrderin interfaceBSPTreeVisitor<Sphere2D>- Parameters:
node- BSP node guaranteed to have a non null cut sub-hyperplane- Returns:
- desired visit order, must be one of
BSPTreeVisitor.Order.PLUS_MINUS_SUB,BSPTreeVisitor.Order.PLUS_SUB_MINUS,BSPTreeVisitor.Order.MINUS_PLUS_SUB,BSPTreeVisitor.Order.MINUS_SUB_PLUS,BSPTreeVisitor.Order.SUB_PLUS_MINUS,BSPTreeVisitor.Order.SUB_MINUS_PLUS
-
visitInternalNode
public void visitInternalNode(BSPTree<Sphere2D> node)
Visit a BSP tree node node having a non-null sub-hyperplane.It is guaranteed that this method will be called after
visitOrderhas been called for a given node, it wil be called exactly once for each internal node.- Specified by:
visitInternalNodein interfaceBSPTreeVisitor<Sphere2D>- Parameters:
node- BSP node guaranteed to have a non null cut sub-hyperplane- See Also:
BSPTreeVisitor.visitLeafNode(org.apache.commons.math3.geometry.partitioning.BSPTree<S>)
-
visitLeafNode
public void visitLeafNode(BSPTree<Sphere2D> node)
Visit a leaf BSP tree node node having a null sub-hyperplane.- Specified by:
visitLeafNodein interfaceBSPTreeVisitor<Sphere2D>- Parameters:
node- leaf BSP node having a null sub-hyperplane- See Also:
BSPTreeVisitor.visitInternalNode(org.apache.commons.math3.geometry.partitioning.BSPTree<S>)
-
addContribution
private void addContribution(SubCircle sub, boolean reversed, BSPTree<Sphere2D> node)
Add the contribution of a boundary edge.- Parameters:
sub- boundary facetreversed- if true, the facet has the inside on its plus sidenode- node to which the edge belongs
-
getFollowingEdge
private Edge getFollowingEdge(Edge previous) throws MathIllegalStateException
Get the edge that should naturally follow another one.- Parameters:
previous- edge to be continued- Returns:
- other edge, starting where the previous one ends (they have not been connected yet)
- Throws:
MathIllegalStateException- if there is not a single other edge
-
getEdges
public java.util.List<Edge> getEdges() throws MathIllegalStateException
Get the boundary edges.- Returns:
- boundary edges
- Throws:
MathIllegalStateException- if there is not a single other edge
-
-