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
public final class EmbeddedTreePlaneSubset extends AbstractEmbeddedRegionPlaneSubset
Class representing an arbitrary subset of a plane using aRegionBSPTree2D
. 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
Fields Modifier and Type Field Description private RegionBSPTree2D
region
The 2D region representing the area on the plane.
-
Constructor Summary
Constructors Constructor Description EmbeddedTreePlaneSubset(EmbeddingPlane plane)
Construct 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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(EmbeddedTreePlaneSubset subset)
Add a plane subset to this instance.void
add(PlaneConvexSubset subset)
Add a plane convex subset to this instance.Bounds3D
getBounds()
Get aBounds3D
object defining an axis-aligned bounding box containing all vertices for this subset.PlaneSubset.Embedded
getEmbedded()
Return an object containing the plane subset as an embedded 2D subspace region.private Rotation2D
getEmbeddedRegionRotation(PlaneSubset.Embedded embedded)
Construct a rotation transform used to transform the subspace of the given embedded region plane subset into the subspace of this instance.RegionBSPTree2D
getSubspaceRegion()
Get the embedded subspace region.Split<EmbeddedTreePlaneSubset>
split(Hyperplane<Vector3D> splitter)
Split this instance with the given hyperplane.java.util.List<PlaneConvexSubset>
toConvex()
Convert this instance into a list of convex child subsets representing the same region.java.util.List<Triangle3D>
toTriangles()
Return a list of triangles representing the same subset region as this instance.EmbeddedTreePlaneSubset
transform(Transform<Vector3D> transform)
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 Detail
-
region
private final RegionBSPTree2D region
The 2D region representing the area on the plane.
-
-
Constructor Detail
-
EmbeddedTreePlaneSubset
public EmbeddedTreePlaneSubset(EmbeddingPlane plane)
Construct a new, empty plane subset for the given plane.- Parameters:
plane
- plane containing the subset
-
EmbeddedTreePlaneSubset
public EmbeddedTreePlaneSubset(EmbeddingPlane plane, boolean full)
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
public EmbeddedTreePlaneSubset(EmbeddingPlane plane, RegionBSPTree2D region)
Construct a new instance from its defining plane and subspace region.- Parameters:
plane
- plane containing the subsetregion
- subspace region for the plane subset
-
-
Method Detail
-
getEmbedded
public PlaneSubset.Embedded 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
public RegionBSPTree2D getSubspaceRegion()
Get the embedded subspace region.- Returns:
- the embedded subspace region
-
toConvex
public java.util.List<PlaneConvexSubset> 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
public java.util.List<Triangle3D> 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
public Bounds3D 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
public Split<EmbeddedTreePlaneSubset> split(Hyperplane<Vector3D> splitter)
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
public EmbeddedTreePlaneSubset transform(Transform<Vector3D> 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
public void add(PlaneConvexSubset subset)
Add a plane convex subset to this instance.- Parameters:
subset
- plane convex subset to add- Throws:
java.lang.IllegalArgumentException
- if the given plane subset is not from a plane equivalent to this instance
-
add
public void add(EmbeddedTreePlaneSubset subset)
Add a plane subset to this instance.- Parameters:
subset
- plane subset to add- Throws:
java.lang.IllegalArgumentException
- if the given plane subset is not from a plane equivalent to this instance
-
getEmbeddedRegionRotation
private Rotation2D getEmbeddedRegionRotation(PlaneSubset.Embedded embedded)
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
-
-