public class IntervalsSet extends AbstractRegion<Euclidean1D,Euclidean1D> implements java.lang.Iterable<double[]>
Modifier and Type | Class and Description |
---|---|
private class |
IntervalsSet.SubIntervalsIterator
Local iterator for sub-intervals.
|
Region.Location
Modifier and Type | Field and Description |
---|---|
private static double |
DEFAULT_TOLERANCE
Default value for tolerance.
|
Constructor and Description |
---|
IntervalsSet()
Deprecated.
as of 3.1 replaced with
IntervalsSet(double) |
IntervalsSet(BSPTree<Euclidean1D> tree)
Deprecated.
as of 3.3, replaced with
IntervalsSet(BSPTree, double) |
IntervalsSet(BSPTree<Euclidean1D> tree,
double tolerance)
Build an intervals set from an inside/outside BSP tree.
|
IntervalsSet(java.util.Collection<SubHyperplane<Euclidean1D>> boundary)
Deprecated.
as of 3.3, replaced with
IntervalsSet(Collection, double) |
IntervalsSet(java.util.Collection<SubHyperplane<Euclidean1D>> boundary,
double tolerance)
Build an intervals set from a Boundary REPresentation (B-rep).
|
IntervalsSet(double tolerance)
Build an intervals set representing the whole real line.
|
IntervalsSet(double lower,
double upper)
Deprecated.
as of 3.3 replaced with
IntervalsSet(double, double, double) |
IntervalsSet(double lower,
double upper,
double tolerance)
Build an intervals set corresponding to a single interval.
|
Modifier and Type | Method and Description |
---|---|
java.util.List<Interval> |
asList()
Build an ordered list of intervals representing the instance.
|
IntervalsSet |
buildNew(BSPTree<Euclidean1D> tree)
Build a region using the instance as a prototype.
|
private static BSPTree<Euclidean1D> |
buildTree(double lower,
double upper,
double tolerance)
Build an inside/outside tree representing a single interval.
|
private BSPTree<Euclidean1D> |
childAfter(BSPTree<Euclidean1D> node)
Find the child node just after an internal node.
|
private BSPTree<Euclidean1D> |
childBefore(BSPTree<Euclidean1D> node)
Find the child node just before an internal node.
|
protected void |
computeGeometricalProperties()
Compute some geometrical properties.
|
private Vector1D |
finiteOrNullPoint(double x)
Build a finite point.
|
private double |
getAngle(BSPTree<Euclidean1D> node)
Get the abscissa of an internal node.
|
private BSPTree<Euclidean1D> |
getFirstIntervalBoundary()
Get the node corresponding to the first interval boundary.
|
private BSPTree<Euclidean1D> |
getFirstLeaf(BSPTree<Euclidean1D> root)
Get the first leaf node of a tree.
|
double |
getInf()
Get the lowest value belonging to the instance.
|
double |
getSup()
Get the highest value belonging to the instance.
|
private boolean |
isAfterParent(BSPTree<Euclidean1D> node)
Check if a node is the child after its parent in ascending order.
|
private boolean |
isBeforeParent(BSPTree<Euclidean1D> node)
Check if a node is the child before its parent in ascending order.
|
private boolean |
isDirect(BSPTree<Euclidean1D> node)
Check if an internal node has a direct oriented point.
|
private boolean |
isIntervalEnd(BSPTree<Euclidean1D> node)
Check if an internal node corresponds to the end abscissa of an interval.
|
private boolean |
isIntervalStart(BSPTree<Euclidean1D> node)
Check if an internal node corresponds to the start abscissa of an interval.
|
java.util.Iterator<double[]> |
iterator() |
private BSPTree<Euclidean1D> |
leafAfter(BSPTree<Euclidean1D> node)
Find the leaf node just after an internal node.
|
private BSPTree<Euclidean1D> |
leafBefore(BSPTree<Euclidean1D> node)
Find the leaf node just before an internal node.
|
private BSPTree<Euclidean1D> |
nextInternalNode(BSPTree<Euclidean1D> node)
Get the next internal node.
|
private BSPTree<Euclidean1D> |
previousInternalNode(BSPTree<Euclidean1D> node)
Get the previous internal node.
|
BoundaryProjection<Euclidean1D> |
projectToBoundary(Point<Euclidean1D> point)
Project a point on the boundary of the region.
|
applyTransform, checkPoint, checkPoint, checkPoint, checkPoint, contains, copySelf, getBarycenter, getBoundarySize, getSize, getTolerance, getTree, intersection, isEmpty, isEmpty, isFull, isFull, setBarycenter, setBarycenter, setSize, side
private static final double DEFAULT_TOLERANCE
public IntervalsSet(double tolerance)
tolerance
- tolerance below which points are considered identical.public IntervalsSet(double lower, double upper, double tolerance)
lower
- lower bound of the interval, must be lesser or equal
to upper
(may be Double.NEGATIVE_INFINITY
)upper
- upper bound of the interval, must be greater or equal
to lower
(may be Double.POSITIVE_INFINITY
)tolerance
- tolerance below which points are considered identical.public IntervalsSet(BSPTree<Euclidean1D> tree, double tolerance)
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 intervals settolerance
- tolerance below which points are considered identical.public IntervalsSet(java.util.Collection<SubHyperplane<Euclidean1D>> boundary, double tolerance)
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 disjoints 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 elementstolerance
- tolerance below which points are considered identical.@Deprecated public IntervalsSet()
IntervalsSet(double)
@Deprecated public IntervalsSet(double lower, double upper)
IntervalsSet(double, double, double)
lower
- lower bound of the interval, must be lesser or equal
to upper
(may be Double.NEGATIVE_INFINITY
)upper
- upper bound of the interval, must be greater or equal
to lower
(may be Double.POSITIVE_INFINITY
)@Deprecated public IntervalsSet(BSPTree<Euclidean1D> tree)
IntervalsSet(BSPTree, double)
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 intervals set@Deprecated public IntervalsSet(java.util.Collection<SubHyperplane<Euclidean1D>> boundary)
IntervalsSet(Collection, double)
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 disjoints 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 elementsprivate static BSPTree<Euclidean1D> buildTree(double lower, double upper, double tolerance)
lower
- lower bound of the interval, must be lesser or equal
to upper
(may be Double.NEGATIVE_INFINITY
)upper
- upper bound of the interval, must be greater or equal
to lower
(may be Double.POSITIVE_INFINITY
)tolerance
- tolerance below which points are considered identical.public IntervalsSet buildNew(BSPTree<Euclidean1D> 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<Euclidean1D>
buildNew
in class AbstractRegion<Euclidean1D,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<Euclidean1D,Euclidean1D>
public double getInf()
Double.NEGATIVE_INFINITY
if the instance doesn't
have any low bound, Double.POSITIVE_INFINITY
if the
instance is empty)public double getSup()
Double.POSITIVE_INFINITY
if the instance doesn't
have any high bound, Double.NEGATIVE_INFINITY
if the
instance is empty)public BoundaryProjection<Euclidean1D> projectToBoundary(Point<Euclidean1D> point)
projectToBoundary
in interface Region<Euclidean1D>
projectToBoundary
in class AbstractRegion<Euclidean1D,Euclidean1D>
point
- point to checkprivate Vector1D finiteOrNullPoint(double x)
x
- abscissa of the pointpublic java.util.List<Interval> asList()
This method builds this intervals set as an ordered list of
Interval
elements. If the intervals set has no
lower limit, the first interval will have its low bound equal to
Double.NEGATIVE_INFINITY
. If the intervals set has
no upper limit, the last interval will have its upper bound equal
to Double.POSITIVE_INFINITY
. An empty tree will
build an empty list while a tree representing the whole real line
will build a one element list with both bounds being
infinite.
Interval
elementsprivate BSPTree<Euclidean1D> getFirstLeaf(BSPTree<Euclidean1D> root)
root
- tree rootprivate BSPTree<Euclidean1D> getFirstIntervalBoundary()
private boolean isIntervalStart(BSPTree<Euclidean1D> node)
node
- internal node to checkprivate boolean isIntervalEnd(BSPTree<Euclidean1D> node)
node
- internal node to checkprivate BSPTree<Euclidean1D> nextInternalNode(BSPTree<Euclidean1D> node)
node
- current internal nodeprivate BSPTree<Euclidean1D> previousInternalNode(BSPTree<Euclidean1D> node)
node
- current internal nodeprivate BSPTree<Euclidean1D> leafBefore(BSPTree<Euclidean1D> node)
node
- internal node at which the sub-tree startsprivate BSPTree<Euclidean1D> leafAfter(BSPTree<Euclidean1D> node)
node
- internal node at which the sub-tree startsprivate boolean isBeforeParent(BSPTree<Euclidean1D> node)
node
- child node consideredprivate boolean isAfterParent(BSPTree<Euclidean1D> node)
node
- child node consideredprivate BSPTree<Euclidean1D> childBefore(BSPTree<Euclidean1D> node)
node
- internal node at which the sub-tree startsprivate BSPTree<Euclidean1D> childAfter(BSPTree<Euclidean1D> node)
node
- internal node at which the sub-tree startsprivate boolean isDirect(BSPTree<Euclidean1D> node)
node
- internal node to checkprivate double getAngle(BSPTree<Euclidean1D> node)
node
- internal node to checkpublic java.util.Iterator<double[]> iterator()
The iterator returns the limit values of sub-intervals in ascending order.
The iterator does not support the optional remove
operation.
iterator
in interface java.lang.Iterable<double[]>
Copyright (c) 2003-2016 Apache Software Foundation