class EdgesBuilder extends java.lang.Object implements BSPTreeVisitor<Sphere2D>
BSPTreeVisitor.Order
Modifier and Type | Field and Description |
---|---|
private java.util.Map<Edge,BSPTree<Sphere2D>> |
edgeToNode
Built edges and their associated nodes.
|
private java.util.Map<BSPTree<Sphere2D>,java.util.List<Edge>> |
nodeToEdgesList
Reversed map.
|
private BSPTree<Sphere2D> |
root
Root of the tree.
|
private double |
tolerance
Tolerance below which points are consider to be identical.
|
Constructor and Description |
---|
EdgesBuilder(BSPTree<Sphere2D> root,
double tolerance)
Simple constructor.
|
Modifier and Type | Method and Description |
---|---|
private void |
addContribution(SubCircle sub,
boolean reversed,
BSPTree<Sphere2D> node)
Add the contribution of a boundary edge.
|
java.util.List<Edge> |
getEdges()
Get the boundary edges.
|
private Edge |
getFollowingEdge(Edge previous)
Get the edge that should naturally follow another one.
|
void |
visitInternalNode(BSPTree<Sphere2D> node)
Visit a BSP tree node node having a non-null sub-hyperplane.
|
void |
visitLeafNode(BSPTree<Sphere2D> node)
Visit a leaf BSP tree node node having a null sub-hyperplane.
|
BSPTreeVisitor.Order |
visitOrder(BSPTree<Sphere2D> node)
Determine the visit order for this node.
|
private final double tolerance
private final java.util.Map<Edge,BSPTree<Sphere2D>> edgeToNode
public BSPTreeVisitor.Order visitOrder(BSPTree<Sphere2D> 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 visitInternalNode
for a given node, it will be
called exactly once for each internal node.
visitOrder
in interface BSPTreeVisitor<Sphere2D>
node
- BSP node guaranteed to have a non null cut sub-hyperplaneBSPTreeVisitor.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
public void visitInternalNode(BSPTree<Sphere2D> node)
It is guaranteed that this method will be called after visitOrder
has been called for a given node,
it wil be called exactly once for each internal node.
visitInternalNode
in interface BSPTreeVisitor<Sphere2D>
node
- BSP node guaranteed to have a non null cut sub-hyperplaneBSPTreeVisitor.visitLeafNode(org.apache.commons.math3.geometry.partitioning.BSPTree<S>)
public void visitLeafNode(BSPTree<Sphere2D> node)
visitLeafNode
in interface BSPTreeVisitor<Sphere2D>
node
- leaf BSP node having a null sub-hyperplaneBSPTreeVisitor.visitInternalNode(org.apache.commons.math3.geometry.partitioning.BSPTree<S>)
private void addContribution(SubCircle sub, boolean reversed, BSPTree<Sphere2D> node)
sub
- boundary facetreversed
- if true, the facet has the inside on its plus sidenode
- node to which the edge belongsprivate Edge getFollowingEdge(Edge previous) throws MathIllegalStateException
previous
- edge to be continuedMathIllegalStateException
- if there is not a single other edgepublic java.util.List<Edge> getEdges() throws MathIllegalStateException
MathIllegalStateException
- if there is not a single other edgeCopyright (c) 2003-2014 Apache Software Foundation