Class EmbeddedTreePlaneSubset
java.lang.Object
org.apache.commons.geometry.euclidean.threed.AbstractPlaneSubset
org.apache.commons.geometry.euclidean.threed.AbstractEmbeddedRegionPlaneSubset
org.apache.commons.geometry.euclidean.threed.EmbeddedTreePlaneSubset
- All Implemented Interfaces:
Embedding<Vector3D,
,Vector2D> HyperplaneSubset<Vector3D>
,Splittable<Vector3D,
,HyperplaneSubset<Vector3D>> RegionEmbedding<Vector3D,
,Vector2D> Sized
,PlaneSubset
,PlaneSubset.Embedded
Class representing an arbitrary subset of a plane using a
RegionBSPTree2D
.
This class can represent convex, non-convex, finite, infinite, and empty regions.
This class is mutable and not thread safe.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.commons.geometry.euclidean.threed.PlaneSubset
PlaneSubset.Embedded
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final RegionBSPTree2D
The 2D region representing the area on the plane. -
Constructor Summary
ConstructorsConstructorDescriptionConstruct a new, empty plane subset for the given plane.EmbeddedTreePlaneSubset
(EmbeddingPlane plane, boolean full) Construct a new subset for the given plane.EmbeddedTreePlaneSubset
(EmbeddingPlane plane, RegionBSPTree2D region) Construct a new instance from its defining plane and subspace region. -
Method Summary
Modifier and TypeMethodDescriptionvoid
add
(EmbeddedTreePlaneSubset subset) Add a plane subset to this instance.void
add
(PlaneConvexSubset subset) Add a plane convex subset to this instance.Get aBounds3D
object defining an axis-aligned bounding box containing all vertices for this subset.Return an object containing the plane subset as an embedded 2D subspace region.private Rotation2D
Construct a rotation transform used to transform the subspace of the given embedded region plane subset into the subspace of this instance.Get the embedded subspace region.split
(Hyperplane<Vector3D> splitter) Split this instance with the given hyperplane.toConvex()
Convert this instance into a list of convex child subsets representing the same region.Return a list of triangles representing the same subset region as this instance.Return a new hyperplane subset resulting from the application of the given transform.Methods inherited from class org.apache.commons.geometry.euclidean.threed.AbstractEmbeddedRegionPlaneSubset
classify, closest, getBoundsFromSubspace, getCentroid, getHyperplane, getPlane, getSize, isEmpty, isFull, toSpace, toString, toSubspace
Methods inherited from class org.apache.commons.geometry.euclidean.threed.AbstractPlaneSubset
intersection, intersection
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.apache.commons.geometry.core.Embedding
toSpace, toSubspace
Methods inherited from interface org.apache.commons.geometry.core.partitioning.HyperplaneSubset
contains
Methods inherited from interface org.apache.commons.geometry.core.Sized
isFinite, isInfinite
-
Field Details
-
region
The 2D region representing the area on the plane.
-
-
Constructor Details
-
EmbeddedTreePlaneSubset
Construct a new, empty plane subset for the given plane.- Parameters:
plane
- plane containing the subset
-
EmbeddedTreePlaneSubset
Construct a new subset for the given plane. Iffull
is true, then the subset will cover the entire plane; otherwise, it will be empty.- Parameters:
plane
- plane containing the subsetfull
- if true, the subset will cover the entire space; otherwise it will be empty
-
EmbeddedTreePlaneSubset
Construct a new instance from its defining plane and subspace region.- Parameters:
plane
- plane containing the subsetregion
- subspace region for the plane subset
-
-
Method Details
-
getEmbedded
Return an object containing the plane subset as an embedded 2D subspace region.- Returns:
- an object containing the plane subset as an embedded 2D subspace region
-
getSubspaceRegion
Get the embedded subspace region.- Returns:
- the embedded subspace region
-
toConvex
Convert this instance into a list of convex child subsets representing the same region. Implementations are not required to return an optimal convex subdivision of the current instance. They are free to return whatever subdivision is readily available.- Returns:
- a list of hyperplane convex subsets representing the same subspace region as this instance
-
toTriangles
Return a list of triangles representing the same subset region as this instance. AnIllegalStateException
is thrown if the subset has infinite size and therefore cannot be converted to triangles. If the subset has zero size (is empty), an empty list is returned.- Returns:
- a list of triangles representing the same subset region as this instance
-
getBounds
Get aBounds3D
object defining an axis-aligned bounding box containing all vertices for this subset. Null is returned if the subset is infinite or does not contain any vertices.- Returns:
- the bounding box for this instance or null if no valid bounds could be determined
-
split
Split this instance with the given hyperplane.In all cases, the current instance is not modified. However, In order to avoid unnecessary copying, this method will use the current instance as the split value when the instance lies entirely on the plus or minus side of the splitter. For example, if this instance lies entirely on the minus side of the splitter, the plane subset returned by
Split.getMinus()
will be this instance. Similarly,Split.getPlus()
will return the current instance if it lies entirely on the plus side. Callers need to make special note of this, since this class is mutable.- Parameters:
splitter
- the hyperplane to split this object with.- Returns:
- result of the split operation
-
transform
Return a new hyperplane subset resulting from the application of the given transform. The current instance is not modified.- Parameters:
transform
- the transform instance to apply- Returns:
- new transformed hyperplane subset
-
add
Add a plane convex subset to this instance.- Parameters:
subset
- plane convex subset to add- Throws:
IllegalArgumentException
- if the given plane subset is not from a plane equivalent to this instance
-
add
Add a plane subset to this instance.- Parameters:
subset
- plane subset to add- Throws:
IllegalArgumentException
- if the given plane subset is not from a plane equivalent to this instance
-
getEmbeddedRegionRotation
Construct a rotation transform used to transform the subspace of the given embedded region plane subset into the subspace of this instance. Returns null if no transform is needed. This method must only be called with embedded regions that share an equivalent plane with this instance, meaning that the planes have the same origin point and normal- Parameters:
embedded
- the embedded region plane subset to compare with the current instance- Returns:
- a rotation transform to convert from the subspace of the argument into the current subspace; returns null if no such transform is needed
-