tutorial_07b.docu 1.24 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
/** \page tutorial_07b Deleting geometry elements

This small example shows how to remove faces and vertices from a mesh.

We basically use the geometry created in \ref tutorial_01.

If we want our mesh class to be able to remove vertices, faces or (half-) edges
we have to extend the default traits for our mesh class.
Vertices, faces and (half-)edges need the OpenMesh::Attributes::Status attribute
which is used to hold the flag "deleted" if an element is deleted.

The struct which defines the mesh traits then looks like this:

\dontinclude delete_geometry.cc
\skipline struct
\until };

After having created the geometry of the cube one can delete faces and vertices
by simply calling delete_vertices() (delete_faces() or delete_edges() respectiely).

In this example we delete all faces excpet one and the corresponding vertices.
The code looks like this

\dontinclude delete_geometry.cc
\skipline // Delete face 0
\until mesh.delete_vertex(vhandle[3], false);

Now the deleted faces and vertices are marked as "deleted" internally.
Call garbage_collection() to definitely remove them from memory.

\dontinclude delete_geometry.cc
\skipline // Delete all
\until mesh.garbage_collection();

The full source code of the example:

\include delete_geometry.cc

**/