Local iteration

The following methods return iterators. The default orientation is counter-clockwise within a face and clockwise around a vertex: iteration follows the next edge within a face or the opposite half-edge's next edge.

The start of the iteration is undefined for faces and inner vertices. For boundary vertices, iteration starts from the boundary. For non-manifold vertices, iteration starts from one (unspecified) boundary.

Iteration around vertex

Examples

for h in star(mesh, v)
    ...
end

collect(ring(mesh, v)) :: Vector{VHnd}

[f for f in fan(mesh, v)]

Iteration within face

Example

for h in halfedges(mesh, f)
    @show h
end

Circulate forever

Iterators terminate after one turn. Circulation defines iterators that don't terminate, i.e., the user is responsible for termination (break).

circulate provides a unified interface for circulating around a vertex or a face, yielding outgoing half-edges, neighboring vertices, or incident faces.

for h in circulate(mesh, v::VHnd[, elt=HHnd])
    ...
    condition && break # user terminates
end

for h in circulate(mesh, f::FHnd[, elt=HHnd])
    ...
    condition && break # user terminates
end

Special cases

In order to enumerate all vertices spanning a face by collecting vertices, memory must be allocated for the resulting Vector.

The methods triangle and quad enumerate the vertices spanning a triangle or a quad as Tuple of length 3 and 4, respectively. There is no memory allocation, but a precondition on the face degree, e.g., istriangle. If the face degree doesn't match, the methods return nothing.

vertices! updates a vector that stores vertices spanning a face in-place.

PMesh.ccwfanMethod
for f in cwfan(mesh, v::VHnd)
    ...
end

Iterate facesf::FHnd incident to vertex v in counter-clockwise order.

See also fan, cwfan.

source
PMesh.ccwringMethod
for vn in ccwring(mesh, v::VHnd)
    ...
end

Iterator vertex neighbors vn::VHnd in 1-ring of v in counter-clockwise order.

See also ring, cwring.

source
PMesh.ccwstarMethod
for h in ccwstar(mesh, v::VHnd)
    ...
end

Iterate outgoing edges h::HHnd in 1-ring of v in counter-clockwise order.

See also star, cwstar.

source
PMesh.ccwverticesMethod
for i in ccwvertices(Val(N), mesh, f::FHnd)

Generate N vertices spanning face f. The face f must have degree N or the iteration is undefined!

Warning

This method is significantly slower than the special cases like triangle. – It may be removed in a future version!

source
PMesh.circulateFunction
for h in circulate(mesh, v::VHnd[, elt=HHnd])
    ...
end

for h in circulate(mesh, f::FHnd[, elt=HHnd])
    ...
end

Iterate around vertex v or face f forever (i.e, user needs to explicitly break out of the loop). The iteration yields elt, which can be outgoing half-edges (HHnd), neighboring vertices (VHnd) or incident faces (FHnd).

source
PMesh.cwfanMethod
for f in cwfan(mesh, v::VHnd)

Iterate facesf::FHnd incident to vertex v in clockwise order.

See also fan, ccwfan.

source
PMesh.cwringMethod
for vn in cwring(mesh, v::VHnd)
    ...
end

Iterate vertex neighbors vn::VHnd in 1-ring of v in clockwise order.

See also ring, ccwring.

source
PMesh.cwstarMethod
for hn in cwstar(mesh, h::VHnd)
    ...
end

Iterate outgoing edges h::hHnd in 1-ring of v in clockwise order.

See also star, ccwstar.

source
PMesh.first3Method
v1, v1, v2, hnext = first3(mesh, f::FHnd)

Get the first 3 vertices (VHnd) of face f and the handle of the "next edge" such that

  • hnext == NoH if f is a triangle
  • destination(hnext) provides the next vertex in f else

See also triangle, quad

source
PMesh.isquadFunction
isquad(mesh, f::FHnd)
isquad(mesh, h::HHnd)

Determine whether f or face(h) is a quad.

Precondition

Requires isused(mesh, f): f must be a face.

source
PMesh.istriangleFunction
istriangle(mesh, f::FHnd)
istriangle(mesh, h::HHnd)

Determine whether f or face(h) is a triangle.

Precondition

Requires isused(mesh, f): f must be a face.

source
PMesh.quadMethod
v1, v2, v3, v4 = quad(mesh, f::FHnd)

Get vertices (VHnd) spanning quad f as an NTuple{4, VHnd} or (NoV, NoV, NoV, NoV) if face is not a quad.

See also triangle, vertices

source
PMesh.triangleMethod
v1, v1, v2 = triangle(mesh, f::FHnd)

Get vertices (VHnd) spanning triangle f as an NTuple{3, VHnd} or (NoV, NoV, NoV) if face is not a triangle.

See also quad, vertices

source
PMesh.vertices!Method
vs = VHnd[]
vertices!(vs, mesh, f)

Update vs::Vector in-place to store vertices spanning face f.

Warning

This method seems not to be significantly faster than collect(vertices(mesh, f). – It may be removed in a future version!

source
PMesh.LocalIterType

Iterate local neighborhood in mesh.

  • M mesh type
  • Center iterate around vertex (VHnd) or face (FHnd)
  • Element type of returned elements (VHnd, FHnd, HHnd)
  • ItrOrient is one of Val(:ccw) or Val(:cw)
  • EltOrient is one of Val(:out) or Val(:in)
  • Length is one of Val(:unknown), Val(n), Val(:infinite)

See also star, ring, fan, vertices, halfedges

source