Class RegionBSPTree1D
java.lang.Object
org.apache.commons.geometry.core.partitioning.bsp.AbstractBSPTree<Vector1D, RegionBSPTree1D.RegionNode1D>
org.apache.commons.geometry.core.partitioning.bsp.AbstractRegionBSPTree<Vector1D, RegionBSPTree1D.RegionNode1D>
org.apache.commons.geometry.euclidean.oned.RegionBSPTree1D
- All Implemented Interfaces:
BSPSubtree<Vector1D, RegionBSPTree1D.RegionNode1D>, BSPTree<Vector1D, RegionBSPTree1D.RegionNode1D>, HyperplaneBoundedRegion<Vector1D>, Splittable<Vector1D, HyperplaneBoundedRegion<Vector1D>>, Region<Vector1D>, Sized
public final class RegionBSPTree1D
extends AbstractRegionBSPTree<Vector1D, RegionBSPTree1D.RegionNode1D>
Binary space partitioning (BSP) tree representing a region in one dimensional
Euclidean space.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classBSP tree node for one dimensional Euclidean space.Nested classes/interfaces inherited from class AbstractRegionBSPTree
AbstractRegionBSPTree.AbstractRegionNode<P,N>, AbstractRegionBSPTree.BoundaryProjector<P, N>, AbstractRegionBSPTree.RegionSizeProperties<P> Nested classes/interfaces inherited from class AbstractBSPTree
AbstractBSPTree.AbstractNode<P,N>, AbstractBSPTree.SubtreeInitializer<N> Nested classes/interfaces inherited from interface BSPTree
BSPTree.FindNodeCutRule, BSPTree.Node<P,N> -
Constructor Summary
ConstructorsConstructorDescriptionCreate a new, empty region.RegionBSPTree1D(boolean full) Create a new region. -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd an interval to this region.classify(double x) Classify a point location with respect to the region.Compute the size-related properties of the region.booleancontains(double x) Return true if the given point location is on the inside or boundary of the region.copy()Return a deep copy of this instance.protected RegionBSPTree1D.RegionNode1DCreate a new node for this tree.static RegionBSPTree1Dempty()Return a new, emptyRegionBSPTree1Dinstance.static RegionBSPTree1DConstruct a new instance from the given collection of intervals.static RegionBSPTree1DConstruct a new instance from one or more intervals.static RegionBSPTree1Dfull()Return a newRegionBSPTree1Dinstance containing the entire space.doubleGet the size of the boundary of the region.doublegetMax()Get the maximum value on the inside of the region; returnsDouble.POSITIVE_INFINITYif the region does not have a maximum value andDouble.NEGATIVE_INFINITYif the region is empty.doublegetMin()Get the minimum value on the inside of the region; returnsDouble.NEGATIVE_INFINITYif the region does not have a minimum value andDouble.POSITIVE_INFINITYif the region is empty.Project a point onto the boundary of the region.split(Hyperplane<Vector1D> splitter) Split this instance with the given hyperplane.protected booleanswapsInsideOutside(Transform<Vector1D> transform) Returns true if the given transform would result in a swapping of the interior and exterior of the region if applied.Convert the region represented by this tree into a list of separateIntervals, arranged in order of ascending min value.Methods inherited from class AbstractRegionBSPTree
boundaries, classify, complement, complement, condense, copyNodeProperties, createBoundaryIterable, createBoundaryList, difference, difference, getBoundaries, getCentroid, getRegionSizeProperties, getSize, getSubtreeInitializer, insert, insert, insert, insert, insert, insert, insert, insert, intersection, intersection, invalidate, isEmpty, isFull, setEmpty, setFull, split, union, union, xor, xorMethods inherited from class AbstractBSPTree
accept, accept, copy, copyNode, copySubtree, count, cutNode, extract, extractParentPath, findNode, findNode, getRoot, getVersion, height, importSubtree, insert, nodes, removeNodeCut, setNodeCut, setRoot, splitIntoTrees, splitSubtree, toString, transform, treeString, treeString, trimToNodeMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface Sized
isFinite, isInfinite
-
Constructor Details
-
RegionBSPTree1D
public RegionBSPTree1D()Create a new, empty region. -
RegionBSPTree1D
Create a new region. Iffullis true, then the region will represent the entire number line. Otherwise, it will be empty.- Parameters:
full- whether or not the region should contain the entire number line or be empty
-
-
Method Details
-
copy
Return a deep copy of this instance.- Returns:
- a deep copy of this instance.
- See Also:
-
add
-
classify
Classify a point location with respect to the region.- Parameters:
x- the point to classify- Returns:
- the location of the point with respect to the region
- See Also:
-
contains
Return true if the given point location is on the inside or boundary of the region.- Parameters:
x- the location to test- Returns:
- true if the location is on the inside or boundary of the region
- See Also:
-
getBoundarySize
Get the size of the boundary of the region. The size is a value in thed-1dimension space. For example, in Euclidean space, this will be a length in 2D and an area in 3D.This method simply returns 0 because boundaries in one dimension do not have any size.
- Specified by:
getBoundarySizein interfaceRegion<Vector1D>- Overrides:
getBoundarySizein classAbstractRegionBSPTree<Vector1D, RegionBSPTree1D.RegionNode1D>- Returns:
- the size of the boundary of the region
-
project
Project a point onto the boundary of the region. Null is returned if the region contains no boundaries (ie, is eitherfullorempty).- Specified by:
projectin interfaceRegion<Vector1D>- Overrides:
projectin classAbstractRegionBSPTree<Vector1D, RegionBSPTree1D.RegionNode1D>- Parameters:
pt- pt to project- Returns:
- projection of the point on the boundary of the region or null if the region does not contain any boundaries
-
split
Split this instance with the given hyperplane.When splitting trees representing single points with a splitter lying directly on the point, the result point is placed on one side of the splitter based on its orientation: if the splitter is positive-facing, the point is placed on the plus side of the split; if the splitter is negative-facing, the point is placed on the minus side of the split.
- Parameters:
splitter- the hyperplane to split this object with.- Returns:
- result of the split operation
-
getMin
Get the minimum value on the inside of the region; returnsDouble.NEGATIVE_INFINITYif the region does not have a minimum value andDouble.POSITIVE_INFINITYif the region is empty.- Returns:
- the minimum value on the inside of the region
-
getMax
Get the maximum value on the inside of the region; returnsDouble.POSITIVE_INFINITYif the region does not have a maximum value andDouble.NEGATIVE_INFINITYif the region is empty.- Returns:
- the maximum value on the inside of the region
-
toIntervals
-
createNode
Create a new node for this tree.- Specified by:
createNodein classAbstractBSPTree<Vector1D, RegionBSPTree1D.RegionNode1D>- Returns:
- a new node for this tree
-
computeRegionSizeProperties
Compute the size-related properties of the region.- Specified by:
computeRegionSizePropertiesin classAbstractRegionBSPTree<Vector1D, RegionBSPTree1D.RegionNode1D>- Returns:
- object containing size properties for the region
-
swapsInsideOutside
Returns true if the given transform would result in a swapping of the interior and exterior of the region if applied.This method always returns false since no swapping of this kind occurs in 1D.
- Overrides:
swapsInsideOutsidein classAbstractBSPTree<Vector1D, RegionBSPTree1D.RegionNode1D>- Parameters:
transform- transform to check- Returns:
- true if the given transform swaps the interior and exterior of the region
-
full
Return a newRegionBSPTree1Dinstance containing the entire space.- Returns:
- a new
RegionBSPTree1Dinstance containing the entire space
-
empty
Return a new, emptyRegionBSPTree1Dinstance.- Returns:
- a new, empty
RegionBSPTree1Dinstance
-
from
Construct a new instance from one or more intervals. The returned tree represents the same region as the union of all of the input intervals.- Parameters:
interval- the input intervalmore- additional intervals to add to the region- Returns:
- a new instance representing the same region as the union of all of the given intervals
-
from
Construct a new instance from the given collection of intervals.- Parameters:
intervals- the intervals to populate the region with- Returns:
- a new instance constructed from the given collection of intervals
-