Elif Tosun

274b-ab

Spring 2000

CS274 Computational Geometry

 

Back to 274b-ab homepage

 

CGAL

SUMMARY OF Week5:

This week I've worked on Triangulations in Getting_Started document and in the Reference Manual


GETTING STARTED DOC

Chapter 6:Triangulations

6.1. INTRODUCTION

Apart from elementary geometric objects, CGAL also offers some geometric data structures such as polygons and triangulations. Triangulations of point sets are used in many areas such as numerical analysis, computer aided design, and geographic information systems.

6.1. CONSTRUCTION

Example file: examples/Getting_started/triangulation1.C

 

Given a triangulation tr, a point pt can be inserted with tr.insert(pt). If point pt coincides with an already existing vertex, the triangulation is not changed. If it lies on an edge two adjacent faces are split into two new faces. If it lies inside a face, the face is split into three new faces. And if it lies outside the current triangulation, point is connected to the visible faces of the CH in order to form new faces.

Also, a whole range of points can be inserted using iterators in the following fashion:

tr.insert(first, last), where first and last are input iterators. This is used in the example program.

 

** insert image files. ***

NOTE: I don't understand what the program prints when the following line runs:

std::cout << tr;

 

6.2. ACCESS

Vertices

A triangulation is stored as a collection of vertices and faces. A vertex is an object type that is defined locally within the triangulation class: Triangulation_2::Vertex. Vertices are created automatically when a point is inserted. The point associated with the vertex can be accessed through v.point().- which is a type Point_2. Each triangle has a special vertex at infinity.

All finite vertices can be accessed through a vertex iterator, defined within the triangulation class: Triangulation_2::Vertex_iterator. The value type of a vertex iterator is a vertex. Method vertices_begin() gives and iterator reffering to the first vertex in the range, and vertices_end() is the past-the-end iterator.

 

Faces

A face is an object type that is defined locally within the triangulation class: Triangulation_2::Face. Faces are also created automatically when a point is inserted. A face has 3 vertices: f.vertex(0), f.vertex(1), f.vertex(2). These methods return a pointer to the vertex, Vertex_handle. Conversely, if v is a vertex then f.index(v) returns the vertex index of v in f.

The vertices 0, 1, 2 are ordered in counterclockwise. In order to reach the next vertex, faces have member functions ccw(i) which returns i+1 (mod3) and cw(i) which returns i+2 (mod3).

Each face has three neighbors: f.neighbor(0), f.neighbor(1), f.neighbor(2). These methods run a Face_handle that is the pointer. The neighbor with index i is always opposite the vertex with index i.

Note that each face has three neighbors. An interior triangle with an edge on the CH has neighboring face that has an infinite vertex, and lies outside the CH. To test if a handle v refers to an infinite vertex, there is a method is_infinite(v). There is also a method for testing if a face has an infinite vertex which is is_infinite(f).

Similar to the vertex iterator there is also a face iterator: Triangulation_2::Face_iterator.

Edge

Edges are not stored explicitly in the class. An edge is defined by a pair of a face handle and an index, where the index denotes the edge between the face and the neighbor of that index. However, the triangulation provides an iterator for edges. In fact and edge is an STL pair of a face handle and an integer: pair<Face_handle, int>. Given an object edge of type Edge, the face handle is accessed with edge_first, and the index value with edge.second.

 

6.5. DELAUNAY TRIANGULATION

The successive insertion can result in very elongated triangles. To avoid this the minimum angle over all the triangles should not be too small. A triangulation that maximizes the minimum angle is called a Delaunay triangulation. It has the property that the circumscribing circle of all faces is empty, none of the vertices lie strictly inside that circle. If no four points lie on an empty circumscribing circle, the Delaunay triangulation is unique.

The class Delaunay_triangulation_2 inherits from Triangulation_2, and redefines the insert and remove functions. When a new point is inserted, the face containing that point is not just split but the triangulation is modified so that the max-min angle property is satisfied. As long as no four points lie on an empty circle, the order of insertion does not matter.

 


 

REFERENCE MANUAL

TRIANGULATIONS

Introduction

A simplicial complex is a set c of simplices which satisfies two conditions:

  1. Any face of a simplex in c is also a simplex in c.
  2. Two simplices in c either don't intersect or their intersection is a simplex of smaller dimension which is their common face of maximal dimension.

The dimension of a complex c is the maximal dimension of the simplices of c. A complex of dimension d is said to be pure of any simplex in x is a face of a d-dimensional simplex of c. The domain of a complex c is the union of the simplices in c. A complex is connected if its domain is connected.

 

A triangulation is a 2D simplicial complex which is pure connected and without singularities. A triangulation can be viewed as a collection of tirangular faces, such that two faces either have an empty intersection or share an edge or a vertex. The absence of singularities means that each edge belongs to at most two triangles and that each vertex belongs to a set of faces whose union forms a topological disk.

Each face of a triangulation can be given an orientation (CW or CCW), which also gives an orientation on the edges incident to that face. The orientation of two adjacent faces are said to be consistent if they induce opposite orientations on their common incident edge.

A triangle is "orientable" if the orientation of each face can be chosen in such a way that all pairs of incident faces have consistent orientations.

This chapter works orientable triangulations that may be embedded in a plane or in a higher dimensional space. Examples to such are triangulations of simple polygons in the plane, the Delaunay triangulations of points in the plane or triangulated irregular networks.

Any such triangulation can be described as a set of vertices and triangular faces, with incidence and adjacency relations.

 

Design Rationale

Triangulation is merely a set of triangular faces with constant size complexity. Because of that they are not implemented as a layer on top of a planar map. CGAL uses proper internal representation of triangulations based on faces and vertices rather than based on edges. This representation allows to save storage space and allows the algorithms to run faster.

Each triangular face gives access to its three incident vertices and its three adjacent faces. Each vertex gives access one of its incident faces, and through that face to the circular list of its incident faces.

The triangulations in CGAL are represented by a 3-level structure.

At the bottom level, the base classes for vertices and faces store geometric information such as the coordinates of vertices and any other attribute needed by application. The base classes handle incidence and adjacency relations in terms of void* pointers. This allows to easily change one of the base classes w/out changing the rest of the structure.

At the next level, the advantages for strong type checking is reestablished. In this level the triangulation data structure can be thought of as a container for faces and vertices which can take care of all the combinatorial aspects of triangulation. This data structure implements adjacency and incidence relations with type safe pointer operations and maintains combinatorial integrity. Because of this, the triangulation d.s. defines its own face and vertex classes which are derived from the corresponding base classes.

At the top level, the triangulation class implements user interface with the triangulation. This class offers to the user the high level functionalities that can be expected from a triangulation such as insertion and removal of vertices, traversal of faces, location of a given pt, etc. This level is responsible for the geometric embedding of the triangulation and includes the following : planar triangulation of a set of points, Delaunay, regular or constrained triangulations, etc.

The triangulation classes of CGAL depend on 2 template parameters. The first one stands for a geometric traits class which is assumed to provide the geometric objects forming the triangulation and the geometric predicates on those objects. The second one stands for a model of triangulation data structure acting as a container for faces and vertices while taking care of combinatorial aspects.

Triangulation of points in the plane

The basic triangulation class of CGAL is designed to represent the triangulations of a set of points A in the plane. It has its vertices the points of A and its domain covers the CH of A. The single unbounded face in this partition has the CH boundary as frontier. In many applications it is more convenient to deal with only triangular faces. Therefore each convex hull edge is incident to an infinite face having a thrid vertex as an auxiliary vertex called the infinite vertex. So, each edge is incident to exactly two faces.

The triangulation class of CGAL implements this, and considers the triangulation as a set of triangular , finite and infinite faces.

A triangulation is valid from a combinatorial (the first 2) and geometric (the last one) point of view if the following are true:

Note: the term combinatorial means that those operation are purely topological and do not depend on the geometric embedding.