Categories
Mesh

Half-edge mesh

Beside the default mesh that Rhino provide, there’s another type of mesh that is very popular among Rhino, grasshopper developers: Half-edge mesh. The half edge mesh concept was first introduced in computational geometry world. Very fortunately, Daniel Piker and Will Person created an open source assembly for half edge mesh named Plankton.

https://www.grasshopper3d.com/group/plankton

Half-edge mesh  is defined by a directed graph of halfedges, each of which represents half of an edge. As its name suggest, edge is the most important, central component of the mesh. From an edge, we can deduce other info of the mesh.

Since we already a built assembly like plankton, I didnt dig deep in how a half edge mesh is created, its extensive theory but more on how can we use the methods in Plankton. For more information on half edge theory, you can follow this link

Half-edge based mesh representations: theory

Mesh image

In general:

Each vertex reference one outgoing halfedge.
Each face reference one of the halfedges bounding it.
Each halfedge can reference to, its opposite half edge, its face, its vertices. Each halfedge has a direction indicating which vertex it going from and to.
Halfedges in each face go in counter clockwise direction.

I will go through 3 topics in details about half edge mesh, each with an example line of code: its connectivity (how does vertex, halfedge etc. relate to each other), how to edit mesh, how to split mesh.

Mesh Topology

I will list out what info you can get from each mesh element

PlanktonMesh

Example photo.JPG

 

Faces

mesh.Faces

HalfEdges

mesh.Halfedges

Vertices

mesh.Vertices

PlanktonHalfedge:

For Example: for half edge 25, we can get previous half edge 22, next half edge 19 (according to the direction, not number) and start vertex 6

HalfEdge

 

var halfEdge = mesh.HalfEdges[i]

Adjacent Face

int adjacentFace = halfEdge.AdjacentFace

Next HalfEdge

int nextHE = halfEdge.NextHalfedge

Previous Half Edge

int prevHE = halfEdge.PrevHalfedge

Start Vertex

int startV = halfEdge.StartVertex

 

PlanktonFace

For example: for face 4, we can get first half edge 19.

Face

var face = mesh.Faces[i]

First half edge

int firstHE = face.FirstHalfedge

 

Vertex

For example: for vertex 6, we can get outgoing halfedge 23

Vertex

var vertex = mesh.Vertices[i]

Outgoing half edge

var outgoingHE = vertex.OutgoingHalfedge