Class EmbeddedTreePlaneSubset
- All Implemented Interfaces:
Embedding<Vector3D,Vector2D>, HyperplaneSubset<Vector3D>, Splittable<Vector3D, HyperplaneSubset<Vector3D>>, RegionEmbedding<Vector3D, Vector2D>, Sized, PlaneSubset, PlaneSubset.Embedded
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 PlaneSubset
PlaneSubset.Embedded -
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 TypeMethodDescriptionvoidadd(EmbeddedTreePlaneSubset subset) Add a plane subset to this instance.voidadd(PlaneConvexSubset subset) Add a plane convex subset to this instance.Classify a point with respect to the subset region.Return the closest point to the argument that is contained in the subset (ie, not classified asoutside), or null if no such point exists.Get aBounds3Dobject defining an axis-aligned bounding box containing all vertices for this subset.protected Bounds3DCompute 3D bounds from a subspace boundary source.Get the centroid, or geometric center, of the hyperplane subset or null if no centroid exists or one exists but is not unique.Return an object containing the plane subset as an embedded 2D subspace region.Get the hyperplane containing this instance.getPlane()Get the plane containing this subset.doublegetSize()Get the size of the instance.Get the embedded subspace region.intersection(Line3D line) Get the unique intersection of this plane subset with the given line.intersection(LineConvexSubset3D lineSubset) Get the unique intersection of this plane subset with the given line subset.booleanisEmpty()Return true if this instance does not contain any points.booleanisFull()Return true if this instance contains all points in the hyperplane.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.Transform a subspace point into a space point.toString()toSubspace(Vector3D pt) Transform a space point into a subspace point.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 Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface Embedding
toSpace, toSubspaceMethods inherited from interface HyperplaneSubset
containsMethods inherited from interface Sized
isFinite, isInfinite
-
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. Iffullis 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. AnIllegalStateExceptionis 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
-
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
-
getPlane
Get the plane containing this subset. This is equivalent toPlaneSubset.getHyperplane().- Specified by:
getPlanein interfacePlaneSubset- Specified by:
getPlanein interfacePlaneSubset.Embedded- Returns:
- the plane containing this subset
- See Also:
-
getHyperplane
Get the hyperplane containing this instance.- Specified by:
getHyperplanein interfaceHyperplaneSubset<Vector3D>- Specified by:
getHyperplanein interfacePlaneSubset- Returns:
- the hyperplane containing this instance
-
isFull
public boolean isFull()Return true if this instance contains all points in the hyperplane.- Specified by:
isFullin interfaceHyperplaneSubset<Vector3D>- Returns:
- true if this instance contains all points in the hyperplane
-
isEmpty
public boolean isEmpty()Return true if this instance does not contain any points.- Specified by:
isEmptyin interfaceHyperplaneSubset<Vector3D>- Returns:
- true if this instance does not contain any points
-
getSize
-
getCentroid
Get the centroid, or geometric center, of the hyperplane subset or null if no centroid exists or one exists but is not unique. A centroid will not exist for empty or infinite subsets.The centroid of a geometric object is defined as the mean position of all points in the object, including interior points, vertices, and other points lying on the boundary. If a physical object has a uniform density, then its center of mass is the same as its geometric centroid.
- Specified by:
getCentroidin interfaceHyperplaneSubset<Vector3D>- Returns:
- the centroid of the hyperplane subset or null if no unique centroid exists
- See Also:
-
toSpace
-
toSubspace
Transform a space point into a subspace point.- Specified by:
toSubspacein interfaceEmbedding<Vector3D,Vector2D> - Parameters:
pt- n-dimension point of the space- Returns:
- lower-dimension point of the subspace corresponding to the specified space point
- See Also:
-
classify
Classify a point with respect to the subset region. The point is classified as follows:- Specified by:
classifyin interfaceHyperplaneSubset<Vector3D>- Parameters:
pt- the point to classify- Returns:
- classification of the point with respect to the hyperplane and subspace region
-
closest
Return the closest point to the argument that is contained in the subset (ie, not classified asoutside), or null if no such point exists.- Specified by:
closestin interfaceHyperplaneSubset<Vector3D>- Parameters:
pt- the reference point- Returns:
- the closest point to the reference point that is contained in the subset, or null if no such point exists
-
toString
-
getBoundsFromSubspace
Compute 3D bounds from a subspace boundary source.- Parameters:
src- subspace boundary source- Returns:
- 3D bounds from the given embedded subspace boundary source or null if no valid bounds could be determined
-
intersection
Get the unique intersection of this plane subset with the given line. Null is returned if no unique intersection point exists (ie, the line and plane are parallel or coincident) or the line does not intersect the plane subset.- Specified by:
intersectionin interfacePlaneSubset- Parameters:
line- line to intersect with this plane subset- Returns:
- the unique intersection point between the line and this plane subset or null if no such point exists.
- See Also:
-
intersection
Get the unique intersection of this plane subset with the given line subset. Null is returned if the underlying line and plane do not have a unique intersection point (ie, they are parallel or coincident) or the intersection point is unique but is not contained in both the line subset and plane subset.- Specified by:
intersectionin interfacePlaneSubset- Parameters:
lineSubset- line subset to intersect with- Returns:
- the unique intersection point between this plane subset and the argument or null if no such point exists.
- See Also:
-