Skip to content
Sébastien Mestrallet edited this page Oct 17, 2023 · 11 revisions

libigl is the mesh processing library of the Interactive Geometry Lab from ETH Zürich.

Its design principle are

  • header-only
  • the use of Eigen matrices to store everything, no complex data types
  • minimal dependencies
  • each function has a dedicated .h/.cpp pair of the same name

Mesh representation

to complete their documentation.

V : vertices

A nb_vertices by 3 matrix of double. Each row i represent a vertex with its $x$, $y$ and $z$ coordinates. i $\in$ [0,nb_vertices-1]

A drawing of the data stored in matrix V.

F : faces (triangles)

A nb_faces by 3 matrix of int. Each row i represent a face, with the vertices index at the 3 corners $\in {0,1,2}$. i $\in$ [0,nb_faces-1] ; {F(i,0),F(i,1),F(i,2)} $\in$ [0,nb_vertices-1]. ⚠️ the vertex order determines the orientation (right-hand rule).

A drawing of the data stored in matrix F

TT : triangle-triangle adjacency

A nb_faces by 3 matrix of int. At (i,local_edge) is the face index of the neighbor of face i on its local_edge. i $\in$ [0,nb_faces-1] ; local_edge $\in {0,1,2}$ ; TT(i,local_edge) $\in$ [0,nb_faces-1]

⚠️ TT and TTi are the only data structure where libigl defines local edge $x$ as the local edge between corner $x$ and $(x+1)%3$. For E, EMAP, uE2E, EF, EI, local edge $x$ is the local edge opposite to corner $x$.

A drawing of the data stored in matrix TT

TTi : inverse triangle-triangle adjacency

A nb_faces by 3 matrix of int. At (i,local_edge) is the local edge of face TT(i,local_edge) to go back to face i. i $\in$ [0,nb_faces-1] ; local_edge $\in {0,1,2}$ ; TTi(i,local_edge) $\in {0,1,2}$

⚠️ TT and TTi are the only data structure where libigl defines local edge $x$ as the local edge between corner $x$ and $(x+1)%3$. For E, EMAP, uE2E, EF, EI, local edge $x$ is the local edge opposite to corner $x$.

A drawing of the data stored in matrix TTi

E : oriented edges

A nb_edges (= nb_faces $\times$ 3) by 2 matrix of int. At row i + nb_faces $\times$ c is the edge opposite to vertex F(i,c). The two columns are for beginning and ending vertex index. i is a face index $\in$ [0,nb_faces-1] ; c is a corner $\in {0,1,2}$ ; {E(i + nb_faces $\times$ c,0),E(i + nb_faces $\times$ c,1)} $\in$ [0,nb_vertices-1]

A drawing of the data stored in matrix E

uE : unique edges

A nb_uedges = nb_edges/2 by 2 matrix of int. The two columns are for vertex indices.

EMAP : oriented edge to unique edge

A nb_edges vector of int such that EMAP(i + nb_faces $\times$ c)} is the unique edge corresponding to the row (i + nb_faces $\times$ c) of E.

uE2E : unique edge to oriented edges

nb_uedges vectors of size-2 vectors. Each value is directed edge (a row number of E).

A drawing of the data stored in matrices uE, EMAP and the vector uE2E

EF : edge flaps

I didn't use them but may be useful

EI : edge flaps corners

I didn't use them but may be useful

A drawing of the data stored in matrices EF and EI

VF : vertex-face adjacency

VF[v][n] is the n-th neighbor of vertex v. The face at a given row (a given vertex) are sorted by ascending index order.

A drawing of the data stored in vector VF

VFi : inverse vertex-face adjacency

VFi[v][n] is the corner of VF[v][n] where v is.

A drawing of the data stored in vector VFi