Houdini 20.0 VEX

Half-edges

VEX has functions that let you treat edges as unshared per-face “half-edges”.

On this page

Overview

In Houdini, edges are normally treated as undirected and shared between faces. However, for some tasks (such as simplifying or cleaning geometry) it is useful to view faces as each having their own edges.

You can think of this as splitting each shared undirected edge along its length into two half edges. (Boundary edges of course will only have one “half-edge”.)

Each half-edge is directed (it has a start vertex and an end vertex).

The half-edge functions let you quickly find a half-edge’s source and destination vertex, the next half-edge, get the other half-edges from the same edge, find all half-edges sharing a given point, and other manipulations.

Equivalence

Two half-edges are equivalent if they are “split” from the same shared edge. In the following figure, three primitives share an edge. The half-edges e, f, and g are equivalent because they are from the same edge. Directionality does not matter – e is considered equivalent to f and g even though they have opposite directions.

The source (and destination) vertex of a half-edge uniquely identify it, meaning that there can be at most one half-edge with a given vertex as the source. This is because a vertex can belong to only one primitive. However, because several vertices can be wired to the same point, half-edges can have shared source and destination points. Another way of thinking about equivalence is that two half-edges are equivalent if their vertices are shared by the same two points.

One of a set of equivalent half-edges is considered the primary half-edge in that class. The VEX functions let you check if a given half-edge is primary, or given a non-primary half-edge, find the equivalent primary half-edge. In the case of an unshared edge, it only has a single primary half-edge.

Functions

hedge_isvalid

Check whether a half-edge is valid

hedge_isprimary

Check whether a half-edge is primary

hedge_primary

Find the primary equivalent half-edge. If it belongs to an unshared edge, then the same half-edge is returned.

hedge_isequiv

Test whether two half-edges are equivalent

hedge_nextequiv

Iterate over the half-edges in an equivalence class

hedge_equivcount

Get the number of half-edges in an equivalence class

hedge_srcvertex

Get the source vertex of a half-edge

hedge_dstvertex

Get the destination vertex of a half-edge

hedge_presrcvertex

Get the vertex preceding the source vertex in half-edge primitive

hedge_postdstvertex

Get the vertex following the destination vertex in half-edge primitive

hedge_prim

Get the primitive of a half-edge

hedge_srcpoint

Get the source point of a half-edge

hedge_dstpoint

Get the destination point of a half-edge

hedge_presrcpoint

Get the pre-source point of a half-edge

hedge_postdstpoint

Get the post-destination point of a half-edge

hedge_next

Get the next half-edge in primitive

hedge_prev

Get the previous half-edge in primitive

pointedge

Find half-edge between two points

pointhedge

Find half-edge with given source and destination

pointhedge

Find a half-edge with a given source point

pointhedgenext

Iterate over half-edges with a given source point

vertexhedge

Get the half-edge with a source vertex

primhedge

Get a half-edge on a given primitive

VEX

Language

Next steps

Reference