Class TriangulationDS_2<X extends Point_>
java.lang.Object
Jcg.triangulations2D.TriangulationDS_2<X>
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.
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 Summary
FieldsModifier and TypeFieldDescriptionSet of faces of the triangulationSet of vertices of the triangulation -
Constructor Summary
ConstructorsConstructorDescriptioncreates an empty triangulation data structure.TriangulationDS_2(int nFaces, int nVertices) creates an empty triangulation data structure with prescribed numbers of faces and vertices.TriangulationDS_2(X[] points, int[][] neighbors) Create a triangulation DS from a vertex shared mesh representation It takes linear space and linear time. -
Method Summary
Modifier and TypeMethodDescriptionbooleanareEqual(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.creates a new face and adds it to the faces container of the triangulation data structure.createFace(TriangulationDSVertex_2<X> v1, TriangulationDSVertex_2<X> v2, TriangulationDSVertex_2<X> v3, TriangulationDSFace_2<X> c1, TriangulationDSFace_2<X> c2, TriangulationDSFace_2<X> c3) creates a new face in the triangulation, with the given incident vertices and adjacent triangles.createVertex(X p, TriangulationDSFace_2<X> f) creates a new vertex in the triangulation, with the given incident triangle.flipEdge(HalfedgeHandle<X> e) flips an edge in the triangulation and returns the new edgebooleanchecks whether the triangulation has a boundary.booleanchecks whether the triangulation contains face c.booleanchecks whether the triangulation contains vertex v.Returns the collection of all faces incident to vertex v.voidinsert in a triangle the barycenter point of its incident verticesinsertInTriangle(X p, TriangulationDSFace_2<X> t) Inserts point p in face c.insertOutside(X point, TriangulationDSFace_2<X> c, int i) Inserts point p outside the triangulation.booleanisValid()checks the combinatorial validity of the triangulation.makeTriangle(X p1, X p2, X p3) creates a triangle with vertices p1, p2, p3.voidReset indices for all vertices.intreturns the number of faces of the triangulation.intreturns the number of vertices of the triangulation.toString()
-
Field Details
-
faces
Set of faces of the triangulation -
vertices
Set of vertices of the triangulation
-
-
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
Create a triangulation DS from a vertex shared mesh representation It takes linear space and linear time.
-
-
Method Details
-
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
checks whether the triangulation contains face c.- Parameters:
c-- Returns:
-
hasVertex
checks whether the triangulation contains vertex v. -
hasBoundary
public boolean hasBoundary()checks whether the triangulation has a boundary. -
createVertex
creates a new vertex in the triangulation, with the given incident triangle. -
createFace
public TriangulationDSFace_2<X> createFace(TriangulationDSVertex_2<X> v1, TriangulationDSVertex_2<X> v2, TriangulationDSVertex_2<X> v3, TriangulationDSFace_2<X> c1, TriangulationDSFace_2<X> c2, TriangulationDSFace_2<X> c3) creates a new face in the triangulation, with the given incident vertices and adjacent triangles. -
flipEdge
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
creates a triangle with vertices p1, p2, p3. -
insertInTriangle
Inserts point p in face c. Face c is split into 3 triangles. -
insertOutside
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
-
insertBarycenter
insert in a triangle the barycenter point of its incident vertices
-