Class Triangle

  • All Implemented Interfaces:
    Serializable, Iterable<Pnt>, Collection<Pnt>, Set<Pnt>


    public class Triangle
    extends ArraySet<Pnt>
    A Triangle is an immutable Set of exactly three Pnts. All Set operations are available. Individual vertices can be accessed via iterator() and also via triangle.get(index). Note that, even if two triangles have the same vertex set, they are *different* triangles. Methods equals() and hashCode() are consistent with this rule.
    See Also:
    Serialized Form
    • Constructor Detail

      • Triangle

        public Triangle(Pnt... vertices)
        Parameters:
        vertices - the vertices of the Triangle.
        Throws:
        IllegalArgumentException - if there are not three distinct vertices
      • Triangle

        public Triangle(Collection<? extends Pnt> collection)
        Parameters:
        collection - a Collection holding the Simplex vertices
        Throws:
        IllegalArgumentException - if there are not three distinct vertices
    • Method Detail

      • toString

        public String toString()
      • getVertexButNot

        public Pnt getVertexButNot(Pnt... badVertices)
        Get arbitrary vertex of this triangle, but not any of the bad vertices.
        Parameters:
        badVertices - one or more bad vertices
        Returns:
        a vertex of this triangle, but not one of the bad vertices
        Throws:
        NoSuchElementException - if no vertex found
      • isNeighbor

        public boolean isNeighbor(Triangle triangle)
        True iff triangles are neighbors. Two triangles are neighbors if they share a facet.
        Parameters:
        triangle - the other Triangle
        Returns:
        true iff this Triangle is a neighbor of triangle
      • facetOpposite

        public ArraySet<Pnt> facetOpposite(Pnt vertex)
        Report the facet opposite vertex.
        Parameters:
        vertex - a vertex of this Triangle
        Returns:
        the facet opposite vertex
        Throws:
        IllegalArgumentException - if the vertex is not in triangle
      • getCircumcenter

        public Pnt getCircumcenter()
        Returns:
        the triangle's circumcenter
      • add

        public boolean add(Pnt vertex)
      • hashCode

        public int hashCode()
      • equals

        public boolean equals(Object o)