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
#ifndef MESHSEGMENTATION_H
#define MESHSEGMENTATION_H

#include <vector>
#include <unordered_map>
#include "trimesh.hpp"

namespace bwabstraction
{

/**
 * @brief The MeshSegmentation class implements mesh segmentation algorithms for TriMesh objects.
 * Given a TriMesh object, the MeshSegmentation class provides methods to segment it into submeshes.
 * The result submeshes are returned as a vector of TriMesh objects.
 */
class MeshSegmentation
{

public:

    static std::vector<TriMesh *> ComponentSegmentation(TriMesh *pMesh, OpenMesh::FPropHandleT<unsigned int> fPropComponentID);
    static void FreeSubmeshVector(std::vector<TriMesh *> &pSubmeshes);

private:

    static void AddFace(TriMesh *pMesh, TriMesh *pSubmesh, std::unordered_map<int, int> &pVertexHandleMap, OpenMesh::FaceHandle pFace);

};

} // namespace bwabstraction

#endif // MESHSEGMENTATION_H