Template Function lvr2::calculateBoundingRectangle

Function Documentation

template<typename BaseVecT>
BoundingRectangle<typename BaseVecT::CoordType> lvr2::calculateBoundingRectangle(const vector<VertexHandle> &contour, const BaseMesh<BaseVecT> &mesh, const Cluster<FaceHandle> &cluster, const FaceMap<Normal<typename BaseVecT::CoordType>> &normals, float texelSize, ClusterHandle clusterH)

Calculates bounding rectangle for a given cluster.

Calculates a bounding rectangle for a given cluster. To do so, first a regression plane for the cluster must be calculated. It is assumed that the cluster is mostly planar for this to work. With the regression plane the algorithm creates an initial bounding rectangle that encloses all of the clusters vertices. Then, iterative improvement steps rotate the bounding rectangle and calculate the predicted number of texels for a bounding box of this size. The rotation with the least amount of texels will be used.

Parameters:
  • contour – contour of cluster

  • mesh – mesh

  • cluster – cluster

  • normals – normals

  • texelSize – texelSize

  • clusterH – cluster handle (TODO: is not used! remove)