Class VertexListConvexPolygon3D
- java.lang.Object
-
- org.apache.commons.geometry.euclidean.threed.AbstractPlaneSubset
-
- org.apache.commons.geometry.euclidean.threed.AbstractConvexPolygon3D
-
- org.apache.commons.geometry.euclidean.threed.VertexListConvexPolygon3D
-
- All Implemented Interfaces:
HyperplaneConvexSubset<Vector3D>
,HyperplaneSubset<Vector3D>
,Splittable<Vector3D,HyperplaneSubset<Vector3D>>
,Sized
,ConvexPolygon3D
,PlaneConvexSubset
,PlaneSubset
final class VertexListConvexPolygon3D extends AbstractConvexPolygon3D
InternalConvexPolygon3D
implementation class that uses a list of vertices to represent the plane subset.
-
-
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
-
-
Constructor Summary
Constructors Constructor Description VertexListConvexPolygon3D(Plane plane, java.util.List<Vector3D> vertices)
Construct a new instance with the given plane and list of vertices.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.List<Vector3D>
getVertices()
Get the vertices for the convex subset in a counter-clockwise order as viewed looking down the plane normal.VertexListConvexPolygon3D
reverse()
Reverse the orientation of the hyperplane for this instance, returning the result as a new instance.java.util.List<Triangle3D>
toTriangles()
Return a list of triangles representing the same subset region as this instance.VertexListConvexPolygon3D
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.AbstractConvexPolygon3D
classify, closest, getBounds, getCentroid, getEmbedded, getPlane, getSize, isEmpty, isFull, split, 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.core.partitioning.HyperplaneSubset
contains
-
Methods inherited from interface org.apache.commons.geometry.euclidean.threed.PlaneConvexSubset
toConvex
-
Methods inherited from interface org.apache.commons.geometry.euclidean.threed.PlaneSubset
getHyperplane, intersection, intersection
-
Methods inherited from interface org.apache.commons.geometry.core.Sized
isFinite, isInfinite
-
-
-
-
Field Detail
-
vertices
private final java.util.List<Vector3D> vertices
Vertex loop defining the convex polygon.
-
-
Constructor Detail
-
VertexListConvexPolygon3D
VertexListConvexPolygon3D(Plane plane, java.util.List<Vector3D> vertices)
Construct a new instance with the given plane and list of vertices. Callers are responsible for ensuring that the given vertices form a convex subset lying inplane
. The list of vertices should not contain the duplicated first endpoint. No validation is performed.- Parameters:
plane
- plane containing convex polygonvertices
- vertices defining the convex polygon- Throws:
java.lang.IllegalArgumentException
- if fewer than 3 vertices are given
-
-
Method Detail
-
getVertices
public java.util.List<Vector3D> getVertices()
Get the vertices for the convex subset in a counter-clockwise order as viewed looking down the plane normal. Each vertex in the returned list is unique. If the boundary of the subset is closed, the start vertex is not repeated at the end of the list.It is important to note that, in general, the list of vertices returned by this method is not sufficient to completely characterize the subset. For example, a simple triangle has 3 vertices, but an infinite area constructed from two parallel lines and two lines that intersect between them will also have 3 vertices. It is also possible for non-empty subsets to contain no vertices at all. For example, a subset with no boundaries (representing the full plane), a subset with a single boundary (ie, a half-plane), or a subset with two parallel boundaries will not contain any vertices.
- Returns:
- the list of vertices for the plane convex subset in a counter-clockwise order as viewed looking down the plane normal
-
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
-
transform
public VertexListConvexPolygon3D 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
-
reverse
public VertexListConvexPolygon3D reverse()
Reverse the orientation of the hyperplane for this instance, returning the result as a new instance. The returned subset contains the same points but has a reversed orientation.- Returns:
- a hyperplane convex subset representing the same region but with the opposite orientation.
-
-