Class SimpleTriangle


  • public class SimpleTriangle
    extends Object
    Provides methods and elements for a simple representation of a triangle based on IQuadEdge edges.
    • Constructor Detail

      • SimpleTriangle

        public SimpleTriangle​(IIncrementalTin tin,
                              IQuadEdge a,
                              IQuadEdge b,
                              IQuadEdge c)
        Construct a simple triangle from the specified edges. For efficiency purposes, this constructor is very lean and does not perform sanity checking on the inputs. In particular, it is essential that the specified edge be a member of the specified TIN and that the TIN must not be modified while the SimpleTriangle instance is in use.
        Parameters:
        tin - a reference to the TIN that was used to create this triangle.
        a - a valid edge
        b - a valid edge
        c - a valid edge
      • SimpleTriangle

        public SimpleTriangle​(IIncrementalTin tin,
                              IQuadEdge a)
        Construct a simple triangle from the specified edges. For efficiency purposes, this constructor is very lean and does not perform sanity checking on the inputs. In particular, it is essential that the specified edge be a member of the specified TIN and that the TIN must not be modified while the SimpleTriangle instance is in use.
        Parameters:
        tin - a reference to the TIN that was used to create this triangle.
        a - a valid edge which must be a member of the specified TIN.
    • Method Detail

      • getEdgeA

        public IQuadEdge getEdgeA()
        Get edge a from the triangle
        Returns:
        a valid edge
      • getEdgeB

        public IQuadEdge getEdgeB()
        Get edge b from the triangle
        Returns:
        a valid edge
      • getEdgeC

        public IQuadEdge getEdgeC()
        Get edge c from the triangle
        Returns:
        a valid edge
      • getVertexA

        public Vertex getVertexA()
        Gets vertex A of the triangle. The method names used in this class follow the conventions of trigonometry. Vertices are labeled so that vertex A is opposite edge a, vertex B is opposite edge b, etc. This approach is slightly different than that used in other parts of the Tinfour API.
        Returns:
        a valid vertex
      • getVertexB

        public Vertex getVertexB()
        Gets vertex B of the triangle. The method names used in this class follow the conventions of trigonometry. Vertices are labeled so that vertex A is opposite edge a, vertex B is opposite edge b, etc. This approach is slightly different than that used in other parts of the Tinfour API.
        Returns:
        a valid vertex
      • getVertexC

        public Vertex getVertexC()
        Gets vertex A of the triangle. The method names used in this class follow the conventions of trigonometry. Vertices are labeled so that vertex A is opposite edge a, vertex B is opposite edge b, etc. This approach is slightly different than that used in other parts of the Tinfour API.
        Returns:
        a valid vertex
      • getArea

        public double getArea()
        Gets the area of the triangle. This value is positive if the triangle is given in counterclockwise order and negative if it is given in clockwise order. A value of zero indicates a degenerate triangle.
        Returns:
        a valid floating point number.
      • getShortestEdge

        public IQuadEdge getShortestEdge()
        Get the shortest edge of the triangle.
        Returns:
        the shortest edge (by squared length)
      • getContainingRegion

        public IConstraint getContainingRegion()
        Gets the polygon-based constraint that contains this triangle, if any.

        Under ConstructionThis method is not yet complete. Because the Tinfour implementation does not yet record which side of an edge an region-based constraint lies on, there are cases involving constraint borders that will not be accurately detected. It can only reliably report membership when a triangle has at least one edge that is entirely inside a constraint area

        Returns:
        if the triangle is enclosed by a constraint, a valid instance; otherwise, a null.
      • getPath2D

        public Path2D getPath2D​(AffineTransform transform)
        Gets a Java Path2D based on the geometry of the triangle mapped through an optional affine transform.
        Parameters:
        transform - a valid transform, or the null to use the identity transform.
        Returns:
        a valid instance of a Java Path2D
      • getCircumcircle

        public Circumcircle getCircumcircle()
        Obtains the circumcircle for a simple triangle.

        This method uses an ordinary-precision computation for circumcircles that yields acceptable accuracy for well-formed triangles. Applications that need more accuracy or may need to deal with nearly degenerate triangles (nearly flat triangles) may prefer to use Tinfour's GeometricOperations class for that purpose.

        Returns:
        a valid instance
      • getCentroid

        public Vertex getCentroid()
        Gets the centroid for the triangle. The centroid is computed as the simple average of the x, y, and z coordinates for the vertices that define the triangle.
        Returns:
        a valid instance of a Vertex.
      • isGhost

        public boolean isGhost()
        Indicates whether the triangle is a ghost triangle. A ghost triangle is one that lies outside the bounds of a Delaunay triangulation and contains an undefined vertex.

        The TriangleCollector class does not produce ghost triangles, but those created from perimeter edges may be ghosts.

        Returns:
        true if the triangle is a ghost triangle; otherwise, false.
      • getIndex

        public int getIndex()
        Gets a unique index value associated with the triangle.

        The index value for the triangle is taken from the lowest-value index of the three edges that comprise the triangle. It will be stable provided that the underlying Triangulated Irregular Network (TIN) is not modified.

        Returns:
        an arbitrary integer value.