Skip to content

Commit 8f430e6

Browse files
feat: CleanAssociatedClusters now keep the per-face structure
1 parent 7d41f20 commit 8f430e6

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/diffCheck/segmentation/DFSegmentation.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ namespace diffCheck::segmentation
330330
void DFSegmentation::CleanUnassociatedClusters(
331331
bool isCylinder,
332332
std::vector<std::shared_ptr<geometry::DFPointCloud>> &unassociatedClusters,
333-
std::vector<std::shared_ptr<geometry::DFPointCloud>> &existingPointCloudSegments,
333+
std::vector<std::vector<std::shared_ptr<geometry::DFPointCloud>>> &existingPointCloudSegments,
334334
std::vector<std::vector<std::shared_ptr<geometry::DFMesh>>> meshes,
335335
double angleThreshold,
336336
double associationThreshold)
@@ -459,12 +459,12 @@ namespace diffCheck::segmentation
459459
DIFFCHECK_WARN("No mesh face found for the cluster. Skipping the cluster.");
460460
continue;
461461
}
462-
if (goodMeshIndex >= existingPointCloudSegments.size())
462+
if (goodMeshIndex >= existingPointCloudSegments.size() || goodFaceIndex >= existingPointCloudSegments[goodMeshIndex].size())
463463
{
464464
DIFFCHECK_WARN("No segment found for the face. Skipping the face.");
465465
continue;
466466
}
467-
std::shared_ptr<geometry::DFPointCloud> completed_segment = existingPointCloudSegments[goodMeshIndex];
467+
std::shared_ptr<geometry::DFPointCloud> completed_segment = existingPointCloudSegments[goodMeshIndex][goodFaceIndex];
468468

469469
for (Eigen::Vector3d point : cluster->Points)
470470
{

src/diffCheck/segmentation/DFSegmentation.hh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,15 @@ namespace diffCheck::segmentation
4444
/** @brief Iterated through clusters and finds the corresponding mesh face. It then associates the points of the cluster that are on the mesh face to the segment already associated with the mesh face.
4545
* @param isCylinder a boolean to indicate if the model is a cylinder. If true, the method will use the GetCenterAndAxis method of the mesh to find the center and axis of the mesh. based on that, we only want points that have normals more or less perpendicular to the cylinder axis.
4646
* @param unassociatedClusters the clusters from the normal-based segmentatinon that haven't been associated yet.
47-
* @param existingPointCloudSegments the already associated segments
47+
* @param existingPointCloudSegments the already associated segments per mesh face.
4848
* @param meshes the mesh faces for all the model. This is used to associate the clusters to the mesh faces.
4949
* * @param angleThreshold the threshold to consider the a cluster as potential candidate for association. the value passed is the minimum sine of the angles. A value of 0 requires perfect alignment (angle = 0), while a value of 0.1 allows an angle of 5.7 degrees.
5050
* @param associationThreshold the threshold to consider the points of a segment and a mesh face as associable. It is the ratio between the surface of the closest mesh triangle and the sum of the areas of the three triangles that form the rest of the pyramid described by the mesh triangle and the point we want to associate or not. The lower the number, the more strict the association will be and some poinnts on the mesh face might be wrongfully excluded.
5151
*/
5252
static void DFSegmentation::CleanUnassociatedClusters(
5353
bool isCylinder,
5454
std::vector<std::shared_ptr<geometry::DFPointCloud>> &unassociatedClusters,
55-
std::vector<std::shared_ptr<geometry::DFPointCloud>> &existingPointCloudSegments,
55+
std::vector<std::vector<std::shared_ptr<geometry::DFPointCloud>>> &existingPointCloudSegments,
5656
std::vector<std::vector<std::shared_ptr<geometry::DFMesh>>> meshes,
5757
double angleThreshold = 0.1,
5858
double associationThreshold = 0.1);

0 commit comments

Comments
 (0)