Skip to content

Commit cd86431

Browse files
WIP-UPDATE: fix angle threshold for segment consideration in segmentation
1 parent ecdd389 commit cd86431

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/diffCheck/segmentation/DFSegmentation.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,8 +269,9 @@ namespace diffCheck::segmentation
269269
for (auto normal : segment->Normals){segmentNormal += normal;}
270270
segmentNormal.normalize();
271271
double currentDistance = (faceCenter - segmentCenter).norm();
272+
double currentAngle = std::abs(sin(acos(faceNormal.dot(faceCenter - segmentCenter))));
272273
// if the distance is smaller than the previous one, update the distance and the corresponding segment
273-
if (std::abs(sin(acos(faceNormal.dot(segmentNormal)))) < angleThreshold && currentDistance < faceDistance)
274+
if (std::abs(sin(acos(faceNormal.dot(segmentNormal)))) < angleThreshold && currentDistance < faceDistance && std::abs(1 - currentAngle) < angleThreshold)
274275
{
275276
correspondingSegment = segment;
276277
faceDistance = currentDistance;
@@ -440,7 +441,7 @@ namespace diffCheck::segmentation
440441

441442
double currentDistance = (clusterCenter - faceCenter).norm() * std::abs(std::cos(clusterNormalToJunctionLineAngle))
442443
/ std::min(std::abs(clusterNormal.dot(faceNormal)), 0.05) ;
443-
if (std::abs(sin(acos(faceNormal.dot(clusterNormal)))) < angleThreshold && currentDistance < distance)
444+
if (std::abs(sin(acos(faceNormal.dot(clusterNormal)))) < angleThreshold && currentDistance < distance && std::abs(1 - std::sin(clusterNormalToJunctionLineAngle)) < associationThreshold)
444445
{
445446
goodMeshIndex = meshIndex;
446447
goodFaceIndex = faceIndex;

0 commit comments

Comments
 (0)