m3sh.itertools#
Combinatorial mesh iterators.
The halfedge data structure facilitates efficient neighborhood traversal on a mesh. This module provides generic implementations of the most common traversal schemes using Python’s iterator protocol. Whenever possible and meanigful, adjacent/incident mesh items are visited in counter-clockwise order as determined by the mesh orientation
Example#
To compute the average of the 1-ring neighbors for each vertex of a mesh one can do
import itertools as it
for v in it.verts(mesh):
avg = sum(w.point for w in it.verts(v))
An equivalent implementation using the interface provided by the halfedge data structure would be
for v in mesh.vertices:
h = v.halfedge
avg = 0.0
while True:
avg += h.target.point
h = h.prev.pair
if h is v.halfedge:
break
Relation to simplical complexes#
Some basics forms of the provided iterators model notions from algebraic topology, see [1]. A triangle mesh is a simplical complex …
The star operator#
Let \(K\) be a simplicial complex. The (open) star of a simplex \(\sigma \in K\) is defined as
…
The link operator#
The link is defined as the boundary of the star
…
References#
Allen Hatcher: Algebraic Topology, 2001.
Functions
|
Edge iterator. |
|
Face iterator. |
|
Breadth-first face neighborhood iterator. |
|
Face iterator. |
|
Dual breadth-first face neighborhood iterator. |
|
Halfedge iterator |
|
Vertex iterator. |
|
Breadth-first vertex neighborhood iterator. |
|
Dijkstra based vertex neighborhood iterator. |