Halfedge data structure

Data Structure AlgorithmsAnalysis of AlgorithmsAlgorithms


A HDS for template parameters or halfedge data structure (abbreviated as HalfedgeDS) is defined as an edge-centered data structure capable of maintaining incidence information of vertices, edges and faces, such as for planar maps, polyhedra, or other orientable, two-dimensional surfaces embedded in random dimension. Each edge is broken into two halfedges with opposite orientations. Each halfedge stores one incident face and one incident vertex. One incident halfedge is stored for each face and each vertex. Reduced variants of the halfedge data structure can eliminate some of this information, such as the halfedge pointers in faces or the storage of faces at all.

The halfedge data structure is defined as a combinatorial data structure, geometric interpretation is added by classes built on top of the halfedge data structure. These classes might be more known to implement than the halfedge data structure directly, since the halfedge data structure is treated as an implementation layer.

The halfedge data structure can also be displayed as one of the variants of the quad-edge data structure. In general, the non-orientable 2-manifolds can be represented by quad-edge data, but the variant here is limited to orientable 2-manifolds only.

Example Programs

The Default Halfedge Data Structure

The following example program applies the default halfedge data structure and the decorator class. The default halfedge data structure implements a list-based representation. Items' all incidences and a point type for vertices are explained. The trivial traits class gives the type implemented for the point. The program builds a loop, consisting of two halfedges, one vertex(Vertex) and two faces (Face1 and Face2), and verifies its validity.

#include <CGAL/HalfedgeDS_default.h>
#include <CGAL/HalfedgeDS_decorator.h>
struct Traits { typedefint Point_2; };
typedef CGAL::HalfedgeDS_default<Traits> HDS1;
typedef CGAL::HalfedgeDS_decorator<HDS> Decorator1;
int main() {
   HDS1 hds1;
   Decorator1 decorator(hds1);
   return 0;
Published on 08-Jan-2020 14:41:44