From cd8643132b48a85ac3566a79d0e7ea5561bbc826 Mon Sep 17 00:00:00 2001 From: DamienGilliard <127743632+DamienGilliard@users.noreply.github.com> Date: Wed, 6 Nov 2024 21:47:13 +0100 Subject: [PATCH] WIP-UPDATE: fix angle threshold for segment consideration in segmentation --- src/diffCheck/segmentation/DFSegmentation.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/diffCheck/segmentation/DFSegmentation.cc b/src/diffCheck/segmentation/DFSegmentation.cc index 84a71244..4bbec40d 100644 --- a/src/diffCheck/segmentation/DFSegmentation.cc +++ b/src/diffCheck/segmentation/DFSegmentation.cc @@ -269,8 +269,9 @@ namespace diffCheck::segmentation for (auto normal : segment->Normals){segmentNormal += normal;} segmentNormal.normalize(); double currentDistance = (faceCenter - segmentCenter).norm(); + double currentAngle = std::abs(sin(acos(faceNormal.dot(faceCenter - segmentCenter)))); // if the distance is smaller than the previous one, update the distance and the corresponding segment - if (std::abs(sin(acos(faceNormal.dot(segmentNormal)))) < angleThreshold && currentDistance < faceDistance) + if (std::abs(sin(acos(faceNormal.dot(segmentNormal)))) < angleThreshold && currentDistance < faceDistance && std::abs(1 - currentAngle) < angleThreshold) { correspondingSegment = segment; faceDistance = currentDistance; @@ -440,7 +441,7 @@ namespace diffCheck::segmentation double currentDistance = (clusterCenter - faceCenter).norm() * std::abs(std::cos(clusterNormalToJunctionLineAngle)) / std::min(std::abs(clusterNormal.dot(faceNormal)), 0.05) ; - if (std::abs(sin(acos(faceNormal.dot(clusterNormal)))) < angleThreshold && currentDistance < distance) + if (std::abs(sin(acos(faceNormal.dot(clusterNormal)))) < angleThreshold && currentDistance < distance && std::abs(1 - std::sin(clusterNormalToJunctionLineAngle)) < associationThreshold) { goodMeshIndex = meshIndex; goodFaceIndex = faceIndex;