## TriangulationDataStructure_3::Cell

### Definition

The concept TriangulationDataStructure_3::Cell stores four Vertex_handles to its four vertices and four Cell_handles to its four neighbors. The vertices are indexed 0, 1, 2, and 3 in consistent order. The neighbor indexed i lies opposite to vertex i.

In degenerate dimensions, cells are used to store faces of maximal dimension: in dimension 2, each cell represents only one facet of index 3, and 3 edges (0,1), (1,2) and (2,0); in dimension 1, each cell represents one edge (0,1). (See also Section .)

### Types

The class TriangulationDataStructure_3::Cell defines the following types.

typedef TriangulationDataStructure_3
| Triangulation_data_structure;
typedef TriangulationDataStructure_3::Vertex_handle
| Vertex_handle;
typedef TriangulationDataStructure_3::Cell_handle
| Cell_handle;

### Creation

In order to obtain new cells or destruct unused cells, the user must call the create_cell() and delete_cell() methods of the triangulation data structure.

### Operations

### Access Functions

Vertex_handle | c.vertex ( int i) | Returns the vertex i of c. Precondition: i {0, 1, 2, 3}.
int | c.index ( Vertex_handle v)
|  | Returns the index of vertex v in c. Precondition: v is a vertex of c.
bool | c.has_vertex ( Vertex_handle v)
|  | Returns true if v is a vertex of c.
bool | c.has_vertex ( Vertex_handle v, int & i)
|  | Returns true if v is a vertex of c, and computes its index i in c.
Cell_handle | c.neighbor ( int i)
|  | Returns the neighbor i of c. Precondition: i {0, 1, 2, 3}.
int | c.index ( Cell_handle n)
|  | Returns the index corresponding to neighboring cell n. Precondition: n is a neighbor of c.
bool | c.has_neighbor ( Cell_handle n)
|  | Returns true if n is a neighbor of c.
bool | c.has_neighbor ( Cell_handle n, int & i)
|  | Returns true if n is a neighbor of c, and computes its index i in c.
Vertex_handle | c.mirror_vertex ( int i)
|  | Returns the vertex of the neighbor of c that is opposite to c. Precondition: i {0, 1, 2, 3}.
int | c.mirror_index ( int i)
|  | Returns the index of c in its ith neighbor. Precondition: i {0, 1, 2, 3}.

### Setting

void | c.set_vertex ( int i, Vertex_handle v)
|  | Sets vertex i to v. Precondition: i {0, 1, 2, 3}.

void

c.set_vertices ( | Vertex_handle v0, Vertex_handle v1, Vertex_handle v2, Vertex_handle v3)

|  | Sets the vertex pointers.
void | c.set_neighbor ( int i, Cell_handle n)
|  | Sets neighbor i to n. Precondition: i {0, 1, 2, 3}.

void

c.set_neighbors ( | Cell_handle n0, Cell_handle n1, Cell_handle n2, Cell_handle n3)

|  | Sets the neighbors pointers.

### Checking

bool | c.is_valid ( int dim=3, bool verbose = false)

dim is the dimension of the triangulation, with default value 3.
In dimension 3 (resp. 2, 1) this function must check that the cell shares three (resp. two, one) vertices with its neighbors, and these neighbors have a correct reciprocal neighboring link. Moreover, the consistency of the orientations of common faces must be checked.
The validity of all the vertices of the cell must be checked.
The validity of the base cell is also checked.
When verbose is set to true, messages are printed to give a precise indication of the kind of invalidity encountered.

### See Also

TriangulationDataStructure_3::Vertex.