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
- outgoing edges:
star
,cwstar
,ccwstar
- neigboring vertices:
ring
,cwring
,ccwring
- incident faces:
fan
,cwfan
,ccwfan
Examples
for h in star(mesh, v)
...
end
collect(ring(mesh, v)) :: Vector{VHnd}
[f for f in fan(mesh, v)]
Iteration within face
- vertices:
vertices
,cwvertices
,ccwvertices
- half-edges:
halfedges
,cwhalfedges
,ccwhalfedges
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 collect
ing 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.ccwfan
— Methodfor f in cwfan(mesh, v::VHnd)
...
end
Iterate facesf::FHnd
incident to vertex v
in counter-clockwise order.
PMesh.ccwhalfedges
— Methodfor h in ccwhalfedges(mesh, f::FHnd)
...
end
Iterate half-edges spanning face f
in counter-clockwise order.
See also cwhalfedges
PMesh.ccwring
— Methodfor vn in ccwring(mesh, v::VHnd)
...
end
Iterator vertex neighbors vn::VHnd
in 1-ring of v
in counter-clockwise order.
PMesh.ccwstar
— Methodfor h in ccwstar(mesh, v::VHnd)
...
end
Iterate outgoing edges h::HHnd
in 1-ring of v
in counter-clockwise order.
PMesh.ccwvertices
— Methodfor v in ccwvertices(mesh, f::FHnd)
...
end
Iterate vertices spanning face f
in counter-clockwise order.
See also cwvertices
PMesh.ccwvertices
— Methodfor 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!
This method is significantly slower than the special cases like triangle
. – It may be removed in a future version!
PMesh.circulate
— Functionfor 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
).
PMesh.cwfan
— Methodfor f in cwfan(mesh, v::VHnd)
Iterate facesf::FHnd
incident to vertex v
in clockwise order.
PMesh.cwhalfedges
— Methodfor h in halfedges(mesh, f::FHnd)
...
end
Iterate half-edges spanning face f
in clockwise order.
See also ccwhalfedges
PMesh.cwring
— Methodfor vn in cwring(mesh, v::VHnd)
...
end
Iterate vertex neighbors vn::VHnd
in 1-ring of v
in clockwise order.
PMesh.cwstar
— Methodfor hn in cwstar(mesh, h::VHnd)
...
end
Iterate outgoing edges h::hHnd
in 1-ring of v
in clockwise order.
PMesh.cwvertices
— Methodfor v in vertices(mesh, f::FHnd)
...
end
Iterate vertices spanning face f
in clockwise order.
See also cwvertices
PMesh.fan
— MethodSynonym for cwfan
.
PMesh.first3
— Methodv1, 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
iff
is a triangledestination(hnext)
provides the next vertex inf
else
PMesh.halfedges
— Methodfor h in halfedges(mesh, f::FHnd)
...
end
Synonym for ccwhalfedges
PMesh.isquad
— Functionisquad(mesh, f::FHnd)
isquad(mesh, h::HHnd)
Determine whether f
or face(h)
is a quad.
PMesh.istriangle
— Functionistriangle(mesh, f::FHnd)
istriangle(mesh, h::HHnd)
Determine whether f
or face(h)
is a triangle.
PMesh.quad
— Methodv1, 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.
PMesh.ring
— MethodSynonym for cwring
.
PMesh.star
— MethodSynonym for cwstar
.
PMesh.triangle
— Methodv1, 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.
PMesh.vertices!
— Methodvs = VHnd[]
vertices!(vs, mesh, f)
Update vs::Vector
in-place to store vertices spanning face f
.
PMesh.vertices
— Methodfor v in vertices(mesh, f::FHnd)
...
end
Synonym for ccwvertices
PMesh.LocalIter
— TypeIterate local neighborhood in mesh.
M
mesh typeCenter
iterate around vertex (VHnd
) or face (FHnd
)Element
type of returned elements (VHnd
,FHnd
,HHnd
)ItrOrient
is one ofVal(:ccw)
orVal(:cw)
EltOrient
is one ofVal(:out)
orVal(:in)
Length
is one ofVal(:unknown)
,Val(n)
,Val(:infinite)