Developer Documentation

Conceptual Class Hierarchy

Since there is no such thing as a OpenMesh class and the library makes heavy use of C++ template, we show the inheritance graph of OpenMesh::TriMesh_ArrayKernelT as proxy for all possible mesh types.

Please note! Most of the inheritence relationships are realized by template parameterization! Therefore some of the inheritance links are not documented in a inheritance graph in the reference. This picture shows the overall concept.

# Building the kernel

1. The BaseKernel defines the basic operations on properties like add/remove/access.
2. Next the AttribKernelT adds the standard properties all associated methods.
3. Finally the ArrayKernelT provides the methods to add/remove/access the mesh items vertices, (half-)edges, and faces. The base class is passed as a template parameter, since depending on the underlying storage type the AttribKernel might change.

# Building the mesh

1. The PolyMeshT inherits from the kernel and provide all necessary methods to work with polygonal meshes.
2. Finally we derive TriMeshT from PolyMeshT to have an specialization for triangle meshes.

Looks simple, but it isn't - it's a bit more complicated:

template <class Traits>
struct TriMesh_ArrayKernel_GeneratorT
{
typedef FinalMeshItemsT<ArrayItems, Traits, true> MeshItems;
typedef AttribKernelT<MeshItems> AttribKernel;
typedef ArrayKernelT<AttribKernel, MeshItems> MeshKernel;
typedef TriMeshT<MeshKernel> Mesh;
};

To generate the actual mesh type the helper template class `TriMesh_ArrayKernel_GeneratorT` is used. It takes the traits in a template argument and passes it to `FinalMeshItemsT` to get the final type of the mesh items (MeshItems). The `MeshItems` defines the types for Point, Normal, Color, TexCoord, Vertex, and for all mesh items. With the help of `MeshItems` create the type of the `AttribKernel`, which defines the apropriate standard properties for the items. Finally use `AttribKernel` and `MeshItems` to create the mesh kernel type `MeshKernel`. It's quite a way to get a kernel . As long as the created kernel follows the kernel concept (Mesh Kernels), we can easily create now the mesh. Here we use now `TriMeshT` to create the final mesh type `Mesh`.