Skip to main content

boundary_loops

Function boundary_loops 

Source
pub fn boundary_loops(mesh: &Mesh) -> Result<Vec<BoundaryLoop>>
Expand description

The boundary loops of mesh, sorted by smallest vertex, then by vertex sequence (for a closed loop, the vertex after the smallest).

Each loop follows the boundary edges (edges of exactly one proper triangle). At each vertex b, entered along a -> b, the walk rotates through b’s triangle fan from the incoming edge’s triangle across interior edges to the far side of that fan piece. At an ordinary vertex that far side is the next edge. At a pinch vertex, where the fan splits into pieces, the far side borders the other opening, so the next edge is taken across the gap from another piece instead (by turning angle when there are several): two holes sharing one vertex are two loops. Where the fan reaches a non-manifold edge, the outgoing boundary edges at that vertex are paired in key order instead, and loops through a vertex on a non-manifold edge are marked unclean. So are loops that cross an orientation seam (see BoundaryLoop::clean).

Walks first start at chain heads, vertices with more outgoing than incoming boundary half-edges, so that an open chain is walked whole from its first end; the closed loops are walked after.