OpenMesh
Specifying an OpenMesh using Eigen3 vectors

This section will show how to build your own custom mesh type using Eigen3 vectors for points, normals or other entities.

First of all you need to include the Eigen header shipped with OpenMesh:

#include <OpenMesh/Core/Geometry/EigenVectorT.hh>

This header contains the external functions and vector traits used by OpenMesh.

Afterwards you can specify your mesh:

struct EigenTraits : OpenMesh::DefaultTraits {
using Point = Eigen::Vector3d;
using Normal = Eigen::Vector3d;
using TexCoord2D = Eigen::Vector2d;
};
EigenTriMesh mesh;

Now you can use mesh as any other OpenMesh while using Eigen vectors as the underlying data type.

Note
OpenMesh uses stl vectors for storing its data. This might lead to errors regarding memory alignment with sse instructions: http://eigen.tuxfamily.org/dox/group__TopicStlContainers.html You might need to define -DEIGEN_DONT_VECTORIZE

Project OpenMesh, ©  Computer Graphics Group, RWTH Aachen. Documentation generated using doxygen .