this example shows how to change the data type for positions, normals, colors, and texture,

In the previous tutorial (Using standard properties) we learned to use standard properties by calling the appropriate request method. Unlike the custom properties, where the user specifies the data type by passing the type to the handle (e.g. MyMesh::FPropHandleT<int>), the data types of the standard properties are defined by so-called mesh traits. With traits we can customize and extend the mesh data structure. We can do this by changing two important features

(In general it's better to have the same scalar type for the point and normal vector, for instance double in this case. Otherwise we have to cast quite a lot depending on the implementation of the vector class.)

Be aware that these settings overwrite the ones of the parent traits class! As we usually derive from the DefaultTraits let's have a close look.

Actually the struct OpenMesh::DefaultTraits is merely empty. It solely defines the types for Point, Normal, TexCoord, and Color and one attribute, that we used implicitly all the time:

// HalfedgeAttributes( OpenMesh::Attributes::PrevHalfedge );

The attribute PrevHalfedge is different, as it does not control a property. Yet it has a great impact on the resulting mesh type, as it adds additional information to the halfedge structure. The impact is twofold:

fast access to previous halfedge

increase of memory consumption

Using this feature depends highly on our needs. One situation where the previous halfedges are quite handy, is the mesh member function add_face(). The execution time for the member function drops dramatically, when the information about the previous halfedge is available. Usually we want to have this information. But if not, because we must save memory, we can easily remove it with

// HalfedgeAttributes( OpenMesh::Attributes::None );

Then we need 8 bytes less per edge, which can be quite a lot as one can derive from the Euler formula ( ), that for a regular triangle meshes with genus the number of edges is approximately three times the number of vertices : .