S- Type of the space.
public interface Region<S extends Space>
Region are subsets of a space, they can be infinite (whole space, half space, infinite stripe ...) or finite (polygons in 2D, polyhedrons in 3D ...). Their main characteristic is to separate points that are considered to be inside the region from points considered to be outside of it. In between, there may be points on the boundary of the region.
This implementation is limited to regions for which the boundary
is composed of several
including regions with no boundary at all: the whole space and the
empty region. They are not necessarily finite and not necessarily
path-connected. They can contain holes.
Regions can be combined using the traditional sets operations : union, intersection, difference and symetric difference (exclusive or) for the binary operations, complement for the unary operation.
|Modifier and Type||Interface and Description|
Enumerate for the location of a point with respect to the region.
|Modifier and Type||Method and Description|
Build a region using the instance as a prototype.
Check a point with respect to the region.
Check if the instance entirely contains another region.
Copy the instance.
Get the barycenter of the instance.
Get the size of the boundary.
Get the size of the instance.
Get the underlying BSP tree.
Get the parts of a sub-hyperplane that are contained in the region.
Check if the instance is empty.
Check if the sub-tree starting at a given node is empty.
Compute the relative position of the instance with respect to an hyperplane.
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
tree also must have either null internal nodes or
internal nodes representing the boundary as specified in the
newTree- inside/outside BSP tree representing the new region
The instance created is completely independant of the original
one. A deep copy is used, none of the underlying objects are
shared (except for the underlying tree
attributes and immutable objects).
node- root node of the sub-tree (must have
Regiontree semantics, i.e. the leaf nodes must have
Booleanattributes representing an inside/outside property)
region- region to check against the instance
Region.Location checkPoint(Vector<S> point)
Regions are represented by an underlying inside/outside BSP
tree whose leaf attributes are
representing inside leaf cells if the attribute value is
true and outside leaf cells if the attribute is
false. These leaf attributes are always present and
guaranteed to be non null.
In addition to the leaf attributes, the internal nodes which
correspond to cells split by cut sub-hyperplanes may contain
BoundaryAttribute objects representing
the parts of the corresponding cut sub-hyperplane that belong to
the boundary. When the boundary attributes have been computed,
all internal nodes are guaranteed to have non-null
attributes, however some
BoundaryAttribute instances may have their
plusOutside fields both null if
the corresponding cut sub-hyperplane does not have any parts
belonging to the boundary.
Since computing the boundary is not always required and can be
time-consuming for large trees, these internal nodes attributes
are computed using lazy evaluation only when required by setting
includeBoundaryAttributes argument to
true. Once computed, these attributes remain in the
tree, which implies that in this case, further calls to the
method for the same region will always include these attributes
regardless of the value of the
includeBoundaryAttributes- if true, the boundary attributes at internal nodes are guaranteed to be included (they may be included even if the argument is false, if they have already been computed due to a previous call)
Side side(Hyperplane<S> hyperplane)
SubHyperplane<S> intersection(SubHyperplane<S> sub)
The parts of the sub-hyperplane that belong to the boundary are not included in the resulting parts.
sub- sub-hyperplane traversing the region
Copyright © 2003-2012 The Apache Software Foundation. All Rights Reserved.