public class PolygonsSet extends AbstractRegion<Euclidean2D,Euclidean1D>
Region.Location
Constructor and Description |
---|
PolygonsSet()
Build a polygons set representing the whole real line.
|
PolygonsSet(BSPTree<Euclidean2D> tree)
Build a polygons set from a BSP tree.
|
PolygonsSet(Collection<SubHyperplane<Euclidean2D>> boundary)
Build a polygons set from a Boundary REPresentation (B-rep).
|
PolygonsSet(double xMin,
double xMax,
double yMin,
double yMax)
Build a parallellepipedic box.
|
Modifier and Type | Method and Description |
---|---|
PolygonsSet |
buildNew(BSPTree<Euclidean2D> tree)
Build a region using the instance as a prototype.
|
protected void |
computeGeometricalProperties()
Compute some geometrical properties.
|
Vector2D[][] |
getVertices()
Get the vertices of the polygon.
|
applyTransform, checkPoint, checkPoint, contains, copySelf, getBarycenter, getBoundarySize, getSize, getTree, intersection, isEmpty, isEmpty, setBarycenter, setSize, side
public PolygonsSet()
public PolygonsSet(BSPTree<Euclidean2D> tree)
The leaf nodes of the BSP tree must have a
Boolean
attribute representing the inside status of
the corresponding cell (true for inside cells, false for outside
cells). In order to avoid building too many small objects, it is
recommended to use the predefined constants
Boolean.TRUE
and Boolean.FALSE
tree
- inside/outside BSP tree representing the regionpublic PolygonsSet(Collection<SubHyperplane<Euclidean2D>> boundary)
The boundary is provided as a collection of sub-hyperplanes
. Each sub-hyperplane has the
interior part of the region on its minus side and the exterior on
its plus side.
The boundary elements can be in any order, and can form
several non-connected sets (like for example polygons with holes
or a set of disjoint polyhedrons considered as a whole). In
fact, the elements do not even need to be connected together
(their topological connections are not used here). However, if the
boundary does not really separate an inside open from an outside
open (open having here its topological meaning), then subsequent
calls to the checkPoint
method will not be meaningful anymore.
If the boundary is empty, the region will represent the whole space.
boundary
- collection of boundary elements, as a
collection of SubHyperplane
objectspublic PolygonsSet(double xMin, double xMax, double yMin, double yMax)
xMin
- low bound along the x directionxMax
- high bound along the x directionyMin
- low bound along the y directionyMax
- high bound along the y directionpublic PolygonsSet buildNew(BSPTree<Euclidean2D> tree)
This method allow to create new instances without knowing exactly the type of the region. It is an application of the prototype design pattern.
The leaf nodes of the BSP tree must have a
Boolean
attribute representing the inside status of
the corresponding cell (true for inside cells, false for outside
cells). In order to avoid building too many small objects, it is
recommended to use the predefined constants
Boolean.TRUE
and Boolean.FALSE
. The
tree also must have either null internal nodes or
internal nodes representing the boundary as specified in the
getTree
method).
buildNew
in interface Region<Euclidean2D>
buildNew
in class AbstractRegion<Euclidean2D,Euclidean1D>
tree
- inside/outside BSP tree representing the new regionprotected void computeGeometricalProperties()
The properties to compute are the barycenter and the size.
computeGeometricalProperties
in class AbstractRegion<Euclidean2D,Euclidean1D>
public Vector2D[][] getVertices()
The polygon boundary can be represented as an array of loops, each loop being itself an array of vertices.
In order to identify open loops which start and end by infinite edges, the open loops arrays start with a null point. In this case, the first non null point and the last point of the array do not represent real vertices, they are dummy points intended only to get the direction of the first and last edge. An open loop consisting of a single infinite line will therefore be represented by a three elements array with one null point followed by two dummy points. The open loops are always the first ones in the loops array.
If the polygon has no boundary at all, a zero length loop array will be returned.
All line segments in the various loops have the inside of the region on their left side and the outside on their right side when moving in the underlying line direction. This means that closed loops surrounding finite areas obey the direct trigonometric orientation.
Copyright © 2003-2012 Apache Software Foundation. All Rights Reserved.