Back to Digital Arts

Half-edge mesh

Replacing position matching with exact adjacency data.

The editor in Edit Mode with a cylinder selected, showing its vertices and the selection count.

My first version, mesh_topology.js, worked out which vertices were the same by rounding their positions and comparing them. Two different points that rounded to the same value were treated as one vertex.

I replaced this with a half-edge mesh in half_edge_mesh.js. Each vertex is one record that every touching face refers to. Finding the face on the other side of an edge, or the faces around a vertex, is a lookup by ID.

The mesh stores triangles only, to match the project's data dictionary. The cylinder in the screenshot is in vertex mode with its vertices selected.