Template Class Materializer

Class Documentation

template<typename BaseVecT>
class Materializer

Class for calculating materials for each cluster of a given mesh.

For each cluster of a given mesh, this class generates a material. Based on the original pointcloud, it calculates a color for each cluster. If a Texturizer is provided, it generates a texture for the material instead. In that case it will also calculate texture coordinates and keypoints.

Public Functions

Materializer(const BaseMesh<BaseVecT> &mesh, const ClusterBiMap<FaceHandle> &cluster, const FaceMap<Normal<typename BaseVecT::CoordType>> &normals, const PointsetSurface<BaseVecT> &surface)

Constructor.

Parameters:
  • mesh – The mesh

  • cluster – The cluster map

  • normals – The normals map

  • surface – The point cloud

void setTexturizer(std::shared_ptr<Texturizer<BaseVecT>> texturizer)

Sets the texturizer.

Parameters:

texturizer – The texturizer

void addTexturizer(std::shared_ptr<Texturizer<BaseVecT>> texturizer)

Adds another texturizer.

Parameters:

texturizer – The texturizer

MaterializerResult<BaseVecT> generateMaterials()

Generates materials.

For each cluster, check whether a texture should be generated:

  • If no texturizer is provided, no textures will be generated.

  • If a texturizer is provided, count the number of faces in that cluster and generate a texture if the number of faces is within the defined interval (which is stored in the texturizer).

If no texture should be generated, calculate the median color of the faces in the cluster. Then create a material using this color if it doesn’t already exist.

If textures should be generated, calculate the contour vertices of the cluster and a bounding rectangle and let the texturizer generate a texture using the bounding rectangle. Then calculate AKAZE keypoints for the texture image and texture coordinates for each vertex in the cluster.

Returns:

The materializer result, that contains materials and optional texture data

void saveTextures()

Saves the textures by calling the saveTextures() method of the texturizer.