Class SimpleTriangle3D
- All Implemented Interfaces:
HyperplaneConvexSubset<Vector3D>
,HyperplaneSubset<Vector3D>
,Splittable<Vector3D,
,HyperplaneSubset<Vector3D>> Sized
,ConvexPolygon3D
,PlaneConvexSubset
,PlaneSubset
,Triangle3D
Triangle3D
.
Instances of this class are guaranteed to be immutable.
-
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
ConstructorsConstructorDescriptionSimpleTriangle3D
(Plane plane, Vector3D p1, Vector3D p2, Vector3D p3) Construct a new instance from a plane and 3 points. -
Method Summary
Modifier and TypeMethodDescriptionGet the centroid, or geometric center, of the hyperplane subset or null if no centroid exists or one exists but is not unique.The first point in the triangle.The second point in the triangle.The third point in the triangle.double
getSize()
Get the size of the instance.Get the vertices for the convex subset in a counter-clockwise order as viewed looking down the plane normal.reverse()
Reverse the orientation of the hyperplane for this instance, returning the result as a new instance.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, getEmbedded, getPlane, 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
classify, closest, contains, isEmpty, isFull
Methods inherited from interface org.apache.commons.geometry.euclidean.threed.PlaneConvexSubset
getEmbedded, split, toConvex
Methods inherited from interface org.apache.commons.geometry.euclidean.threed.PlaneSubset
getBounds, getHyperplane, getPlane, intersection, intersection
Methods inherited from interface org.apache.commons.geometry.core.Sized
isFinite, isInfinite
Methods inherited from interface org.apache.commons.geometry.euclidean.threed.Triangle3D
toTriangles
-
Field Details
-
p1
First point in the triangle. -
p2
Second point in the triangle. -
p3
Third point in the triangle.
-
-
Constructor Details
-
SimpleTriangle3D
Construct a new instance from a plane and 3 points. Callers are responsible for ensuring that the points lie on the plane and define a triangle. No validation is performed.- Parameters:
plane
- the plane containing the trianglep1
- first point in the trianglep2
- second point in the trianglep3
- third point in the triangle
-
-
Method Details
-
getPoint1
The first point in the triangle.- Specified by:
getPoint1
in interfaceTriangle3D
- Returns:
- the first point in the triangle
-
getPoint2
The second point in the triangle.- Specified by:
getPoint2
in interfaceTriangle3D
- Returns:
- the second point in the triangle
-
getPoint3
The third point in the triangle.- Specified by:
getPoint3
in interfaceTriangle3D
- Returns:
- the third point in the triangle
-
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.
- Specified by:
getVertices
in interfacePlaneConvexSubset
- Returns:
- the list of vertices for the plane convex subset in a counter-clockwise order as viewed looking down the plane normal
-
getSize
public double getSize()Get the size of the instance.- Specified by:
getSize
in interfaceSized
- Overrides:
getSize
in classAbstractConvexPolygon3D
- Returns:
- 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>
- Overrides:
getCentroid
in classAbstractConvexPolygon3D
- Returns:
- the centroid of the hyperplane subset or null if no unique centroid exists
- See Also:
-
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.- Specified by:
reverse
in interfaceConvexPolygon3D
- Specified by:
reverse
in interfaceHyperplaneConvexSubset<Vector3D>
- Specified by:
reverse
in interfacePlaneConvexSubset
- Specified by:
reverse
in interfaceTriangle3D
- Returns:
- a hyperplane convex subset representing the same region but with the opposite orientation.
-
transform
Return a new hyperplane subset resulting from the application of the given transform. The current instance is not modified.- Specified by:
transform
in interfaceConvexPolygon3D
- Specified by:
transform
in interfaceHyperplaneConvexSubset<Vector3D>
- Specified by:
transform
in interfaceHyperplaneSubset<Vector3D>
- Specified by:
transform
in interfacePlaneConvexSubset
- Specified by:
transform
in interfaceTriangle3D
- Parameters:
transform
- the transform instance to apply- Returns:
- new transformed hyperplane subset
-