Class ArcsSet
Note that due to the wrapping around \(2 \pi\), barycenter is
ill-defined here. It was defined only in order to fulfill
the requirements of the Region
interface, but its use is discouraged.
- Since:
- 3.3
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classSpecialized exception for inconsistent BSP tree state inconsistency.static classClass holding the results of thesplitmethod.private classLocal iterator for sub-arcs.Nested classes/interfaces inherited from interface Region
Region.Location -
Constructor Summary
ConstructorsConstructorDescriptionArcsSet(double tolerance) Build an arcs set representing the whole circle.ArcsSet(double lower, double upper, double tolerance) Build an arcs set corresponding to a single arc.ArcsSet(Collection<SubHyperplane<Sphere1D>> boundary, double tolerance) Build an arcs set from a Boundary REPresentation (B-rep).Build an arcs set from an inside/outside BSP tree. -
Method Summary
Modifier and TypeMethodDescriptionprivate voidaddArcLimit(BSPTree<Sphere1D> tree, double alpha, boolean isStart) Add an arc limit to a BSP tree under construction.asList()Build an ordered list of arcs representing the instance.Build a region using the instance as a prototype.buildTree(double lower, double upper, double tolerance) Build an inside/outside tree representing a single arc.private voidCheck consistency.childAfter(BSPTree<Sphere1D> node) Find the child node just after an internal node.childBefore(BSPTree<Sphere1D> node) Find the child node just before an internal node.protected voidCompute some geometrical properties.private ArcsSetcreateSplitPart(List<Double> limits) Create a split part.private doubleGet the limit angle of an internal node.Get the node corresponding to the first arc start.getFirstLeaf(BSPTree<Sphere1D> root) Get the first leaf node of a tree.getLastLeaf(BSPTree<Sphere1D> root) Get the last leaf node of a tree.private booleanisAfterParent(BSPTree<Sphere1D> node) Check if a node is the child after its parent in trigonometric order.private booleanCheck if an internal node corresponds to the end angle of an arc.private booleanisArcStart(BSPTree<Sphere1D> node) Check if an internal node corresponds to the start angle of an arc.private booleanisBeforeParent(BSPTree<Sphere1D> node) Check if a node is the child before its parent in trigonometric order.private booleanCheck if an internal node has a direct limit angle.Iterator<double[]> iterator()Find the leaf node just after an internal node.leafBefore(BSPTree<Sphere1D> node) Find the leaf node just before an internal node.nextInternalNode(BSPTree<Sphere1D> node) Get the next internal node.previousInternalNode(BSPTree<Sphere1D> node) Get the previous internal node.projectToBoundary(Point<Sphere1D> point) Project a point on the boundary of the region.Deprecated.Split the instance in two parts by an arc.Methods inherited from class AbstractRegion
applyTransform, checkPoint, checkPoint, checkPoint, checkPoint, contains, copySelf, getBarycenter, getBoundarySize, getSize, getTolerance, getTree, intersection, isEmpty, isEmpty, isFull, isFull, setBarycenter, setBarycenter, setSize, sideMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Iterable
forEach, spliterator
-
Constructor Details
-
ArcsSet
public ArcsSet(double tolerance) Build an arcs set representing the whole circle.- Parameters:
tolerance- tolerance below which close sub-arcs are merged together
-
ArcsSet
Build an arcs set corresponding to a single arc.If either
loweris equals toupperor the interval exceeds \( 2 \pi \), the arc is considered to be the full circle and its initial defining boundaries will be forgotten.loweris not allowed to be greater thanupper(an exception is thrown in this case).- Parameters:
lower- lower bound of the arcupper- upper bound of the arctolerance- tolerance below which close sub-arcs are merged together- Throws:
NumberIsTooLargeException- if lower is greater than upper
-
ArcsSet
public ArcsSet(BSPTree<Sphere1D> tree, double tolerance) throws ArcsSet.InconsistentStateAt2PiWrapping Build an arcs set from an inside/outside BSP tree.The leaf nodes of the BSP tree must have a
Booleanattribute 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 constantsBoolean.TRUEandBoolean.FALSE- Parameters:
tree- inside/outside BSP tree representing the arcs settolerance- tolerance below which close sub-arcs are merged together- Throws:
ArcsSet.InconsistentStateAt2PiWrapping- if the tree leaf nodes are not consistent across the \( 0, 2 \pi \) crossing
-
ArcsSet
public ArcsSet(Collection<SubHyperplane<Sphere1D>> boundary, double tolerance) throws ArcsSet.InconsistentStateAt2PiWrapping Build an arcs set from a Boundary REPresentation (B-rep).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
checkPointmethod will not be meaningful anymore.If the boundary is empty, the region will represent the whole space.
- Parameters:
boundary- collection of boundary elementstolerance- tolerance below which close sub-arcs are merged together- Throws:
ArcsSet.InconsistentStateAt2PiWrapping- if the tree leaf nodes are not consistent across the \( 0, 2 \pi \) crossing
-
-
Method Details
-
buildTree
private static BSPTree<Sphere1D> buildTree(double lower, double upper, double tolerance) throws NumberIsTooLargeException Build an inside/outside tree representing a single arc.- Parameters:
lower- lower angular bound of the arcupper- upper angular bound of the arctolerance- tolerance below which close sub-arcs are merged together- Returns:
- the built tree
- Throws:
NumberIsTooLargeException- if lower is greater than upper
-
check2PiConsistency
Check consistency.- Throws:
ArcsSet.InconsistentStateAt2PiWrapping- if the tree leaf nodes are not consistent across the \( 0, 2 \pi \) crossing
-
getFirstLeaf
-
getLastLeaf
-
getFirstArcStart
-
isArcStart
-
isArcEnd
-
nextInternalNode
-
previousInternalNode
-
leafBefore
-
leafAfter
-
isBeforeParent
-
isAfterParent
-
childBefore
-
childAfter
-
isDirect
-
getAngle
-
buildNew
Build a region using the instance as a prototype.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
Booleanattribute 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 constantsBoolean.TRUEandBoolean.FALSE. The tree also must have either null internal nodes or internal nodes representing the boundary as specified in thegetTreemethod). -
computeGeometricalProperties
protected void computeGeometricalProperties()Compute some geometrical properties.The properties to compute are the barycenter and the size.
- Specified by:
computeGeometricalPropertiesin classAbstractRegion<Sphere1D,Sphere1D>
-
projectToBoundary
Project a point on the boundary of the region.- Specified by:
projectToBoundaryin interfaceRegion<Sphere1D>- Overrides:
projectToBoundaryin classAbstractRegion<Sphere1D,Sphere1D> - Parameters:
point- point to check- Returns:
- projection of the point on the boundary
- Since:
- 3.3
-
asList
Build an ordered list of arcs representing the instance.This method builds this arcs set as an ordered list of
Arcelements. An empty tree will build an empty list while a tree representing the whole circle will build a one element list with bounds set to \( 0 and 2 \pi \).- Returns:
- a new ordered list containing
Arcelements
-
iterator
-
side
Deprecated.as of 3.6, replaced withsplit(Arc).ArcsSet.Split.getSide()Compute the relative position of the instance with respect to an arc.The
Side.MINUSside of the arc is the one covered by the arc.- Parameters:
arc- arc to check instance against- Returns:
- one of
Side.PLUS,Side.MINUS,Side.BOTHorSide.HYPER
-
split
Split the instance in two parts by an arc.- Parameters:
arc- splitting arc- Returns:
- an object containing both the part of the instance on the plus side of the arc and the part of the instance on the minus side of the arc
-
addArcLimit
-
createSplitPart
Create a split part.As per construction, the list of limit angles is known to have an even number of entries, with start angles at even indices and end angles at odd indices.
- Parameters:
limits- limit angles of the split part- Returns:
- split part (may be null)
-
split(Arc).ArcsSet.Split.getSide()