|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.commons.math3.geometry.euclidean.twod.NestedLoops
class NestedLoops
This class represent a tree of nested 2D boundary loops.
This class is used for piecewise polygons construction. Polygons are built using the outline edges as representative of boundaries, the orientation of these lines are meaningful. However, we want to allow the user to specify its outline loops without having to take care of this orientation. This class is devoted to correct mis-oriented loops.
Orientation is computed assuming the piecewise polygon is finite, i.e. the outermost loops have their exterior side facing points at infinity, and hence are oriented counter-clockwise. The orientation of internal loops is computed as the reverse of the orientation of their immediate surrounding loop.
Field Summary | |
---|---|
private Vector2D[] |
loop
Boundary loop. |
private boolean |
originalIsClockwise
Indicator for original loop orientation. |
private Region<Euclidean2D> |
polygon
Polygon enclosing a finite region. |
private ArrayList<NestedLoops> |
surrounded
Surrounded loops. |
Constructor Summary | |
---|---|
|
NestedLoops()
Simple Constructor. |
private |
NestedLoops(Vector2D[] loop)
Constructor. |
Method Summary | |
---|---|
private void |
add(NestedLoops node)
Add a loop in a tree. |
void |
add(Vector2D[] bLoop)
Add a loop in a tree. |
void |
correctOrientation()
Correct the orientation of the loops contained in the tree. |
private void |
setClockWise(boolean clockwise)
Set the loop orientation. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private Vector2D[] loop
private ArrayList<NestedLoops> surrounded
private Region<Euclidean2D> polygon
private boolean originalIsClockwise
Constructor Detail |
---|
public NestedLoops()
Build an empty tree of nested loops. This instance will become the root node of a complete tree, it is not associated with any loop by itself, the outermost loops are in the root tree child nodes.
private NestedLoops(Vector2D[] loop) throws MathIllegalArgumentException
Build a tree node with neither parent nor children
loop
- boundary loop (will be reversed in place if needed)
MathIllegalArgumentException
- if an outline has an open boundary loopMethod Detail |
---|
public void add(Vector2D[] bLoop) throws MathIllegalArgumentException
bLoop
- boundary loop (will be reversed in place if needed)
MathIllegalArgumentException
- if an outline has crossing
boundary loops or open boundary loopsprivate void add(NestedLoops node) throws MathIllegalArgumentException
node
- boundary loop (will be reversed in place if needed)
MathIllegalArgumentException
- if an outline has boundary
loops that cross each otherpublic void correctOrientation()
This is this method that really inverts the loops that where
provided through the add
method if
they are mis-oriented
private void setClockWise(boolean clockwise)
clockwise
- if true, the loop should be set to clockwise
orientation
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |