OpenMesh
|
This small code example shows how to attach and access additional properties on a mesh.
Note that this is an old style of using properties. Nowadays you should use the OpenMesh::PropertyManager instead.
When you want to add an additional properties you have to attach it to a primitive of the mesh. You can attach to verticies, halfedges, edges, faces or to the mesh itself. Use the add_property function:
Accessing to the property is available via the property function. This function gets the property handle (created above) and a handle (e.g. to a vertex or a face):
As you can attach properties to the mesh, you might want to add a property in one function and access it in another, where the handle is not yet available. You can retrieve the required handle in the following way (Note that the handles are accessed by their name and type):
The properties can be removed by calling remove_property:
A useful function to see all properties on the mesh is:
A useful class for handling properties and their lifetime is the OpenMesh::PropertyManager.