Class SimpleTriangle3D

    • Field Detail

      • p1

        private final Vector3D p1
        First point in the triangle.
      • p2

        private final Vector3D p2
        Second point in the triangle.
      • p3

        private final Vector3D p3
        Third point in the triangle.
    • Constructor Detail

      • SimpleTriangle3D

        SimpleTriangle3D​(Plane plane,
                         Vector3D p1,
                         Vector3D p2,
                         Vector3D p3)
        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 triangle
        p1 - first point in the triangle
        p2 - second point in the triangle
        p3 - third point in the triangle
    • Method Detail

      • getPoint1

        public Vector3D getPoint1()
        The first point in the triangle.
        Specified by:
        getPoint1 in interface Triangle3D
        Returns:
        the first point in the triangle
      • getPoint2

        public Vector3D getPoint2()
        The second point in the triangle.
        Specified by:
        getPoint2 in interface Triangle3D
        Returns:
        the second point in the triangle
      • getPoint3

        public Vector3D getPoint3()
        The third point in the triangle.
        Specified by:
        getPoint3 in interface Triangle3D
        Returns:
        the third point in the triangle
      • 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.

        Specified by:
        getVertices in interface PlaneConvexSubset
        Returns:
        the list of vertices for the plane convex subset in a counter-clockwise order as viewed looking down the plane normal
      • getCentroid

        public Vector3D 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 interface HyperplaneSubset<Vector3D>
        Overrides:
        getCentroid in class AbstractConvexPolygon3D
        Returns:
        the centroid of the hyperplane subset or null if no unique centroid exists
        See Also:
        Centroid