39 #ifndef LVR2_ALGORITHM_CLUSTERALGORITHMS_H_ 40 #define LVR2_ALGORITHM_CLUSTERALGORITHMS_H_ 67 template<
typename BaseVecT>
79 template<
typename BaseVecT>
81 BaseMesh<BaseVecT>&
mesh,
82 const ClusterBiMap<FaceHandle>& clusters,
83 ClusterHandle clusterH
94 template<
typename BaseVecT>
96 const vector<VertexHandle>& contour,
113 template<
typename BaseVecT>
115 ClusterHandle clusterH,
116 const BaseMesh<BaseVecT>&
mesh,
117 const ClusterBiMap<FaceHandle>& clusterBiMap
138 template<
typename BaseVecT>
140 const vector<VertexHandle>& contour,
141 const BaseMesh<BaseVecT>&
mesh,
142 const Cluster<FaceHandle>& cluster,
143 const FaceMap<Normal<typename BaseVecT::CoordType>>& normals,
145 ClusterHandle clusterH
157 template<
typename BaseVecT,
typename Pred>
165 template<
typename BaseVecT>
167 const BaseMesh<BaseVecT>&
mesh,
168 const FaceMap<Normal<typename BaseVecT::CoordType>>& normals,
181 template<
typename BaseVecT>
183 BaseMesh<BaseVecT>&
mesh,
184 FaceMap<Normal<typename BaseVecT::CoordType>>& normals,
199 template<
typename BaseVecT>
201 BaseMesh<BaseVecT>&
mesh,
202 FaceMap<Normal<typename BaseVecT::CoordType>>& normals,
206 int ransacIterations = 100,
207 int ransacSamples = 10
211 template<
typename BaseVecT>
213 const BaseMesh<BaseVecT>&
mesh,
214 const Cluster<FaceHandle>& cluster,
215 const FaceMap<Normal<typename BaseVecT::CoordType>>& normals
219 template<
typename BaseVecT>
221 const BaseMesh<BaseVecT>&
mesh,
222 const Cluster<FaceHandle>& cluster,
223 const FaceMap<Normal<typename BaseVecT::CoordType>>& normals,
224 const int num_iterations = 100,
225 const int num_samples = 10
229 template<
typename BaseVecT>
231 const BaseMesh<BaseVecT>&
mesh,
232 const Cluster<FaceHandle>& cluster,
233 const FaceMap<Normal<typename BaseVecT::CoordType>>& normals,
234 const int num_iterations = 100,
235 const int num_samples = 10
243 template<
typename BaseVecT>
245 const BaseMesh<BaseVecT>&
mesh,
246 const ClusterBiMap<FaceHandle>& clusters,
247 const FaceMap<Normal<typename BaseVecT::CoordType>>& normals,
256 template<
typename BaseVecT>
258 const BaseMesh<BaseVecT>&
mesh,
259 const ClusterBiMap<FaceHandle>& clusters,
260 const FaceMap<Normal<typename BaseVecT::CoordType>>& normals,
262 int iterations = 100,
267 template<
typename BaseVecT>
269 BaseMesh<BaseVecT>&
mesh,
270 const Cluster<FaceHandle>& cluster,
271 const Plane<BaseVecT>& plane,
272 FaceMap<Normal<typename BaseVecT::CoordType>>& normals
276 template<
typename BaseVecT>
278 BaseMesh<BaseVecT>&
mesh,
279 const ClusterBiMap<FaceHandle>& clusters,
281 FaceMap<Normal<typename BaseVecT::CoordType>>& normals
288 template<
typename BaseVecT>
290 BaseMesh<BaseVecT>&
mesh,
291 const ClusterBiMap<FaceHandle>& clusters,
296 template<
typename BaseVecT>
298 BaseMesh<BaseVecT>&
mesh,
299 const ClusterBiMap<FaceHandle>& clusters,
300 const ClusterHandle& clusterH,
301 const ClusterHandle& neighbourClusterH,
302 const Line<BaseVecT>& intersection
311 template<
typename BaseVecT>
313 const BaseMesh<BaseVecT>&
mesh,
314 const ClusterBiMap<FaceHandle>& clusters,
317 size_t minClusterSize
324 template<
typename BaseVecT>
326 BaseMesh<BaseVecT>&
mesh,
327 ClusterBiMap<FaceHandle>& clusters,
328 size_t smallClusterThreshold
333 #include "lvr2/algorithm/ClusterAlgorithms.tcc" vector< VertexHandle > simplifyContour(const BaseMesh< BaseVecT > &mesh, const vector< VertexHandle > &contour, float threshold)
ClusterBiMap< FaceHandle > iterativePlanarClusterGrowingRANSAC(BaseMesh< BaseVecT > &mesh, FaceMap< Normal< typename BaseVecT::CoordType >> &normals, float minSinAngle, int numIterations, int minClusterSize, int ransacIterations=100, int ransacSamples=10)
Algorithm which generates planar clusters from the given mesh, drags points in clusters into regressi...
Plane< BaseVecT > calcRegressionPlane(const BaseMesh< BaseVecT > &mesh, const Cluster< FaceHandle > &cluster, const FaceMap< Normal< typename BaseVecT::CoordType >> &normals)
Calcs a regression plane for the given cluster.
ClusterBiMap< FaceHandle > iterativePlanarClusterGrowing(BaseMesh< BaseVecT > &mesh, FaceMap< Normal< typename BaseVecT::CoordType >> &normals, float minSinAngle, int numIterations, int minClusterSize)
Algorithm which generates planar clusters from the given mesh, drags points in clusters into regressi...
void dragToRegressionPlanes(BaseMesh< BaseVecT > &mesh, const ClusterBiMap< FaceHandle > &clusters, const ClusterMap< Plane< BaseVecT >> &planes, FaceMap< Normal< typename BaseVecT::CoordType >> &normals)
Drags all points from the given clusters into their regression planes.
void deleteSmallPlanarCluster(BaseMesh< BaseVecT > &mesh, ClusterBiMap< FaceHandle > &clusters, size_t smallClusterThreshold)
Removes all clusters and their cotained faces from the given mesh which are smaller than the given sm...
void optimizePlaneIntersections(BaseMesh< BaseVecT > &mesh, const ClusterBiMap< FaceHandle > &clusters, const ClusterMap< Plane< BaseVecT >> &planes)
void dragToRegressionPlane(BaseMesh< BaseVecT > &mesh, const Cluster< FaceHandle > &cluster, const Plane< BaseVecT > &plane, FaceMap< Normal< typename BaseVecT::CoordType >> &normals)
Drags all points from the given cluster into the given plane.
void removeDanglingCluster(BaseMesh< BaseVecT > &mesh, size_t sizeThreshold)
vector< vector< VertexHandle > > findContours(BaseMesh< BaseVecT > &mesh, const ClusterBiMap< FaceHandle > &clusters, ClusterHandle clusterH)
DenseClusterMap< Plane< BaseVecT > > calcRegressionPlanesRANSAC(const BaseMesh< BaseVecT > &mesh, const ClusterBiMap< FaceHandle > &clusters, const FaceMap< Normal< typename BaseVecT::CoordType >> &normals, int minClusterSize, int iterations=100, int samples=10)
Calcs regression planes for all cluster in clusters.
AttributeMap< ClusterHandle, ValueT > ClusterMap
DenseClusterMap< Plane< BaseVecT > > calcRegressionPlanes(const BaseMesh< BaseVecT > &mesh, const ClusterBiMap< FaceHandle > &clusters, const FaceMap< Normal< typename BaseVecT::CoordType >> &normals, int minClusterSize)
Calcs regression planes for all cluster in clusters.
ClusterBiMap< FaceHandle > clusterGrowing(const BaseMesh< BaseVecT > &mesh, Pred pred)
Algorithm which generates clusters from the given mesh. The given predicate decides which faces will ...
ClusterBiMap< FaceHandle > planarClusterGrowing(const BaseMesh< BaseVecT > &mesh, const FaceMap< Normal< typename BaseVecT::CoordType >> &normals, float minSinAngle)
Algorithm which generates plane clusters from the given mesh.
vector< VertexHandle > calculateClusterContourVertices(ClusterHandle clusterH, const BaseMesh< BaseVecT > &mesh, const ClusterBiMap< FaceHandle > &clusterBiMap)
Calculates contour vertices for a given cluster.
AttributeMap< FaceHandle, ValueT > FaceMap
Plane< BaseVecT > calcRegressionPlanePCA(const BaseMesh< BaseVecT > &mesh, const Cluster< FaceHandle > &cluster, const FaceMap< Normal< typename BaseVecT::CoordType >> &normals, const int num_iterations=100, const int num_samples=10)
Calcs a regression plane for the given cluster.
BoundingRectangle< typename BaseVecT::CoordType > 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.
void debugPlanes(const BaseMesh< BaseVecT > &mesh, const ClusterBiMap< FaceHandle > &clusters, const ClusterMap< Plane< BaseVecT >> &planes, string filename, size_t minClusterSize)
Creates a mesh containing the given regression planes (which match the given minimum cluster size) as...
Plane< BaseVecT > calcRegressionPlaneRANSAC(const BaseMesh< BaseVecT > &mesh, const Cluster< FaceHandle > &cluster, const FaceMap< Normal< typename BaseVecT::CoordType >> &normals, const int num_iterations=100, const int num_samples=10)
Calcs a regression plane for the given cluster.
void dragOntoIntersection(BaseMesh< BaseVecT > &mesh, const ClusterBiMap< FaceHandle > &clusters, const ClusterHandle &clusterH, const ClusterHandle &neighbourClusterH, const Line< BaseVecT > &intersection)
Drags all points between two clusters (planes) into their intersection.