Handles
Mesh elements are addressed/accessed by handles. The handle type discriminates between different elements: vertices, faces, half-edges, edges.
Handles map to integral indices, the "conversion" must be preformed explicitly. The rationale is having different handle types for different mesh elements (e.g., vertex handles).
PMeshAttributes.isindex
— Methodisindex(h::Hnd)
Is Int(h)
a valid index, i.e., a positive integer?
isindex(h) == true
does not imply that the handle is valid, i.e., it references an isused
element of managed attribute. (This cannot be decided only from the handle!)
PMeshAttributes.Hnd
— TypeHnd{S}
defines a handle type for elements of category S
, where S
is typically a Symbol
(e.g., Hnd{:V}
for a vertex handle).
A handle is essentially an integral index type, but any use of arithmetic is undefined (e.g., there is nothing like Hnd(1) + 1
).
Handles h
can be converted to Int
, but this must be done explicitly via convert(Int, h)
or Int(h)
.
Handles may or may not be valid: the referenced element may or may not be isused
.
Any handle that cannot be converted to a valid index (isindex
are invalid.
PMeshAttributes.HndInt
— TypeInteger type for handles.