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.
| Modifier and Type | Field and Description |
|---|---|
| private Vector2D[] | loop
Boundary loop. |
| private boolean | originalIsClockwise
Indicator for original loop orientation. |
| private Region | polygon
Polygon enclosing a finite region. |
| private List | surrounded
Surrounded loops. |
| private final double | tolerance
Tolerance below which points are considered identical. |
| Access | Constructor and Description |
|---|---|
| pack-priv | NestedLoops(final double
tolerance below which points are considered identical tolerance)Simple Constructor. |
| private | NestedLoops(final Vector2D[]
boundary loop (will be reversed in place if needed) loop, final double tolerance below which points are considered identical tolerance)Constructor. |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| private void | |
| public void | |
| private void | setClockWise(final boolean
if true, the loop should be set to clockwise
orientation clockwise)Set the loop orientation. |
| loop | back to summary |
|---|---|
| private Vector2D[] loop Boundary loop. | |
| originalIsClockwise | back to summary |
|---|---|
| private boolean originalIsClockwise Indicator for original loop orientation. | |
| polygon | back to summary |
|---|---|
| private Region<Euclidean2D> polygon Polygon enclosing a finite region. | |
| surrounded | back to summary |
|---|---|
| private List<NestedLoops> surrounded Surrounded loops. | |
| tolerance | back to summary |
|---|---|
| private final double tolerance Tolerance below which points are considered identical. | |
| NestedLoops | back to summary |
|---|---|
| pack-priv NestedLoops(final double tolerance) Simple Constructor. 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.
| |
| NestedLoops | back to summary |
|---|---|
| private NestedLoops(final Vector2D[] loop, final double tolerance) throws MathIllegalArgumentException Constructor. Build a tree node with neither parent nor children
| |
| add | back to summary |
|---|---|
| public void add(final Vector2D[] bLoop) throws MathIllegalArgumentException Add a loop in a tree.
| |
| add | back to summary |
|---|---|
| private void add(final NestedLoops node) throws MathIllegalArgumentException Add a loop in a tree.
| |
| correctOrientation | back to summary |
|---|---|
| public void correctOrientation() Correct the orientation of the loops contained in the tree. This is this method that really inverts the loops that where
provided through the | |
| setClockWise | back to summary |
|---|---|
| private void setClockWise(final boolean clockwise) Set the loop orientation.
| |