First checkin for OpenMesh 2.0

git-svn-id: http://www.openmesh.org/svnrepo/OpenMesh/trunk@2 fdac6126-5c0c-442c-9429-916003d36597
This commit is contained in:
Jan Möbius
2009-02-06 13:37:46 +00:00
parent c3321ebdd9
commit 97f515985d
417 changed files with 76182 additions and 0 deletions

54
Doc/tutorial_03.docu Normal file
View File

@@ -0,0 +1,54 @@
/** \page tutorial_03 Using (custom) properties
This examples shows:
- How to add and remove custom properties,
- How to get and set the value of a custom property
In the last example we computed the barycenter of each vertex'
neighborhood and stored it in an array. It would be more convenient
and less error-prone if we could store this data in the mesh and
let %OpenMesh manage the data.
It would be even more helpful if we could attach such properties
dynamically to the mesh.
%OpenMesh provides dynamic properties, which can be attached to each
mesh entity (vertex, face, edge, halfedge, and the mesh itself). We
distinguish between custom and standard properties. A custom property
is any user-defined property and is accessed via the member function
\c property(..), a handle and an entity handle
(e.g. VertexHandle). Whereas the standard properties are accessed via
special member functions, e.g. the vertex position is accessed with \c
point(..) and a vertex handle.
In this example we will store the \c cog-value (see previous example)
in an additional vertex property instead of keeping it in a separate
array. To do so we define first a so-called property handle with the desired
type (\c MyMesh::Point) and register the handle at the mesh:
\dontinclude 03-properties/smooth.cc
\skipline vertex property stores
\until mesh.add
<br>The \c mesh allocates enough memory to hold as many elements of type
\c MyMesh::Point as number of vertices exist, and of course the mesh
synchronizes all insert and delete operations on the vertices with the
vertex properties.
Once the wanted property is registered we can use the property to
calculate the barycenter of the neighborhood of each vertex \c v_it
\dontinclude 03-properties/smooth.cc
\skipline vv_it=
\until }
\until mesh.prop
<br>and finally set the new position for each vertex \c v_it
\dontinclude 03-properties/smooth.cc
\skipline mesh.set_point
<br>Below is the complete source code:
\include 03-properties/smooth.cc
*/