Skip to content

Commit

Permalink
WIP-UPDATE: fix angle threshold for segment consideration in segmenta…
Browse files Browse the repository at this point in the history
…tion
  • Loading branch information
DamienGilliard committed Nov 6, 2024
1 parent ecdd389 commit cd86431
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/diffCheck/segmentation/DFSegmentation.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit cd86431

Please sign in to comment.