### Half-Edge Mesh

* key to the HEM class methods and face splitting modifier*

This is a class to be used with the Anar+ library for Processing to create a half-edge (or doubly-connected) mesh datastructure which uses the parametric geometry of Anar’s faces, and points. The schema for this HEM class is based on the description of doubly-connected edge lists in Chapter 2 of the excellent Computational Geometry: Algorithms and Applications.

A half-edge mesh records, first of all, the geometry arrays of a mesh: the vertices, edges, and faces. Additionally, each edge, vertex, and face is supplemented by integer arrays which explain the connectivity of the mesh. A half-edge mesh is so called because each edge is split in two; the resulting ‘half-edges’ are associated with one of the two faces that is adjacent to that edge and given a direction (clockwise or anticlockwise) which is consistent for the mesh and opposite of the other half-edge (its ‘twin’).

The value of the Half-Edge datastructure becomes quickly apparent when working with large, irregular face arrays, as are often produced when exporting from CAD software. Future posts will cover intersection, location, and manipulation of the HEM where the speed and efficiency of the half-edge structure is levereged. The sketch which is packaged with this class, however simply gives an example of recursive subdivision of the HEM, and in the code, the process of adding new faces, edges, and vertices in a connected manner.

*recursive subdivision with no translation*

*recursive subdivision with new vertices translated in the direction of the face normal*

(.pde download)

(for a non Anar+ version see W:Blut’s HEMesh library)

## Comments

4 Responses to “Half-Edge Mesh”## Trackbacks

Check out what others are saying...[…] a previous post I covered the implementation of a Half-Edged Mesh as a class in Processing. In that definition, […]

[…] sketch expands on the earlier Half-Edge Mesh sketch, demonstrating how to generate a large HEM class from text files containing the vertex […]

[…] sketch adds to the Half-Edge Mesh sketch, a function sectionHEM for cutting a planar section through a mesh. It also uses the Mesh […]

[…] the logic behind the data-structure of a half-edge mesh can be difficult or unintuitive to work with at first, once it becomes clear, it can become […]