Class AbstractConvexPolygon3D
java.lang.Object
org.apache.commons.geometry.euclidean.threed.AbstractPlaneSubset
org.apache.commons.geometry.euclidean.threed.AbstractConvexPolygon3D
- All Implemented Interfaces:
HyperplaneConvexSubset<Vector3D>
,HyperplaneSubset<Vector3D>
,Splittable<Vector3D,
,HyperplaneSubset<Vector3D>> Sized
,ConvexPolygon3D
,PlaneConvexSubset
,PlaneSubset
- Direct Known Subclasses:
SimpleTriangle3D
,VertexListConvexPolygon3D
Abstract base class for
ConvexPolygon3D
implementations.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.commons.geometry.euclidean.threed.PlaneConvexSubset
PlaneConvexSubset.Embedded
Nested classes/interfaces inherited from interface org.apache.commons.geometry.euclidean.threed.PlaneSubset
PlaneSubset.Embedded
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuildPolygonSplitVertexList
(int enterIdx, Vector3D newEnterPt, int exitIdx, Vector3D newExitPt, List<? extends Vector3D> vertices) Internal method for building a vertex list for one side of a split result.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 aBounds3D
object defining an axis-aligned bounding box containing all vertices for this subset.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.getPlane()
Get the plane containing this subset.double
getSize()
Get the size of the instance.boolean
isEmpty()
Return true if this instance does not contain any points.boolean
isFull()
Return true if this instance contains all points in the hyperplane.split
(Hyperplane<Vector3D> splitter) Split this instance with the given hyperplane.toString()
Methods inherited from class org.apache.commons.geometry.euclidean.threed.AbstractPlaneSubset
getHyperplane, 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.euclidean.threed.ConvexPolygon3D
reverse, transform
Methods inherited from interface org.apache.commons.geometry.core.partitioning.HyperplaneSubset
contains
Methods inherited from interface org.apache.commons.geometry.euclidean.threed.PlaneConvexSubset
getVertices, toConvex
Methods inherited from interface org.apache.commons.geometry.euclidean.threed.PlaneSubset
getHyperplane, intersection, intersection, toTriangles
Methods inherited from interface org.apache.commons.geometry.core.Sized
isFinite, isInfinite
-
Field Details
-
plane
Plane containing the convex polygon.
-
-
Constructor Details
-
AbstractConvexPolygon3D
AbstractConvexPolygon3D(Plane plane) Simple constructor.- Parameters:
plane
- the plane containing the convex polygon
-
-
Method Details
-
getPlane
Get the plane containing this subset. This is equivalent toPlaneSubset.getHyperplane()
.- Specified by:
getPlane
in interfacePlaneSubset
- Returns:
- the plane containing this subset
- See Also:
-
isFull
public boolean isFull()Return true if this instance contains all points in the hyperplane.This method always returns
false
.- Specified by:
isFull
in 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.This method always returns
false
.- Specified by:
isEmpty
in interfaceHyperplaneSubset<Vector3D>
- Returns:
- true if this instance does not contain any points
-
getSize
public double getSize()Get the size of the instance. -
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:
getCentroid
in interfaceHyperplaneSubset<Vector3D>
- Returns:
- the centroid of the hyperplane subset or null if no unique centroid exists
- See Also:
-
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.- Specified by:
getBounds
in interfacePlaneSubset
- Returns:
- the bounding box for this instance or null if no valid bounds could be determined
-
classify
Classify a point with respect to the subset region. The point is classified as follows:- Specified by:
classify
in 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:
closest
in 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
-
getEmbedded
Return an object containing the plane subset as an embedded 2D subspace region.- Specified by:
getEmbedded
in interfacePlaneConvexSubset
- Specified by:
getEmbedded
in interfacePlaneSubset
- Returns:
- an object containing the plane subset as an embedded 2D subspace region
-
split
Split this instance with the given hyperplane.- Specified by:
split
in interfaceHyperplaneConvexSubset<Vector3D>
- Specified by:
split
in interfacePlaneConvexSubset
- Specified by:
split
in interfaceSplittable<Vector3D,
HyperplaneSubset<Vector3D>> - Parameters:
splitter
- the hyperplane to split this object with.- Returns:
- result of the split operation
-
buildPolygonSplitVertexList
private List<Vector3D> buildPolygonSplitVertexList(int enterIdx, Vector3D newEnterPt, int exitIdx, Vector3D newExitPt, List<? extends Vector3D> vertices) Internal method for building a vertex list for one side of a split result. The method is designed to make the fewest allocations possible.- Parameters:
enterIdx
- the index of the vertex fromvertices
immediately before the polygon transitioned to being fully entered into this side of the split result. If no point fromvertices
lay directly on the splitting plane while entering this side and a new vertex had to be computed for the split result, then this index will be the last vertex on the opposite side of the split. If a vertex did lie directly on the splitting plane, then this index will point to that vertex.newEnterPt
- the newly-computed point to be added as the first vertex in the split result; may be null if no such point existsexitIdx
- the index of the vertex fromvertices
immediately before the polygon transitioned to being fully exited from this side of the split result. If no point fromvertices
lay directly on the splitting plane while exiting this side and a new vertex had to be computed for the split result, then this index will be the last vertex on the this side of the split. If a vertex did lie directly on the splitting plane, then this index will point to that vertex.newExitPt
- the newly-computed point to be added as the last vertex in the split result; may be null if no such point existsvertices
- the original list of vertices that this split result originated from; this list is not modified by this operation- Returns:
- the list of vertices for the split result
-
toString
-