m3sh.hds.Mesh.

halfedges#

Mesh.halfedges#

Halfedge dictionary.

Dictionary that maps pairs of Vertex objects to Halfedge instances.

Examples

To visit all Halfedge instances of a mesh one can use

for h in mesh.halfedges.values():
    ...

To directly visit halfedges as Vertex instance pairs use

for v, w in mesh.halfedges.keys():
    ...

To check whether two vertices of a mesh are adjacent (connected by an edge) we can do one of the following. The resulting value depends on the chosen query method:

(v, w) in mesh.halfedges                 # True or False
h = mesh.halfedges[v, w]                 # may raise KeyError
h = mesh.halfedges.get((v, w))           # can result in h = None