Class TriangulationDS_2<X extends Point_>

java.lang.Object
Jcg.triangulations2D.TriangulationDS_2<X>

public class TriangulationDS_2<X extends Point_> extends Object
Data structure for representing 2D triangulations that uses the standard face/vertex encoding, represented by classes TriangulationDSFace_2 and TriangulationDSVertex_2 respectively.
In this representation we store the collection of faces as well as the collection of vertices of the triangulation. Each face provides access to its vertices and neighboring faces, while each vertex provides access to one of its incident faces.
Author:
Luca Castelli Aleardi and Steve Oudot
  • Field Details

  • Constructor Details

    • TriangulationDS_2

      public TriangulationDS_2()
      creates an empty triangulation data structure.
    • TriangulationDS_2

      public TriangulationDS_2(int nFaces, int nVertices)
      creates an empty triangulation data structure with prescribed numbers of faces and vertices.
    • TriangulationDS_2

      public TriangulationDS_2(X[] points, int[][] neighbors)
      Create a triangulation DS from a vertex shared mesh representation It takes linear space and linear time.
  • Method Details

    • createFace

      public TriangulationDSFace_2<X> createFace()
      creates a new face and adds it to the faces container of the triangulation data structure.
    • sizeOfVertices

      public int sizeOfVertices()
      returns the number of vertices of the triangulation.
    • sizeOfFaces

      public int sizeOfFaces()
      returns the number of faces of the triangulation.
      Returns:
    • hasFace

      public boolean hasFace(TriangulationDSFace_2<X> c)
      checks whether the triangulation contains face c.
      Parameters:
      c -
      Returns:
    • hasVertex

      public boolean hasVertex(TriangulationDSVertex_2<X> v)
      checks whether the triangulation contains vertex v.
    • hasBoundary

      public boolean hasBoundary()
      checks whether the triangulation has a boundary.
    • createVertex

      public TriangulationDSVertex_2<X> createVertex(X p, TriangulationDSFace_2<X> f)
      creates a new vertex in the triangulation, with the given incident triangle.
    • createFace

      creates a new face in the triangulation, with the given incident vertices and adjacent triangles.
    • flipEdge

      public HalfedgeHandle<X> flipEdge(HalfedgeHandle<X> e)
      flips an edge in the triangulation and returns the new edge
    • areEqual

      public boolean areEqual(TriangulationDSFace_2<X> face1, int i1, TriangulationDSFace_2<X> face2, int i2)
      checks whether an edge is shared by two faces f1 and f2: the function check whether the corresponding vertices appear both in f1 and f2, in the correct order. LCA: a' tester
    • resetVertexIndices

      public void resetVertexIndices()
      Reset indices for all vertices.
      Indices correspond to the order of storage in the collections (e.g., vertex v0 is the first in the ArrayList 'vertices')
    • incidentFaces

      Returns the collection of all faces incident to vertex v.
    • isValid

      public boolean isValid()
      checks the combinatorial validity of the triangulation.
    • makeTriangle

      public TriangulationDSFace_2<X> makeTriangle(X p1, X p2, X p3)
      creates a triangle with vertices p1, p2, p3.
    • insertInTriangle

      public TriangulationDSVertex_2<X> insertInTriangle(X p, TriangulationDSFace_2<X> t)
      Inserts point p in face c. Face c is split into 3 triangles.
    • insertOutside

      public TriangulationDSVertex_2<X> insertOutside(X point, TriangulationDSFace_2<X> c, int i)
      Inserts point p outside the triangulation. A new triangle is added and attached to a boundary triangle c (they share the edge opposite to vertex i in c).
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • insertBarycenter

      public void insertBarycenter(TriangulationDSFace_2<X> f)
      insert in a triangle the barycenter point of its incident vertices