From 3cc7d2c2191524932be54a88fa5f0b0644c8fa89 Mon Sep 17 00:00:00 2001 From: Daniel Girardeau-Montaut Date: Tue, 4 Nov 2025 18:37:04 +0100 Subject: [PATCH] Bug fix: the weights derived from normals comparison during ICP registration of 2 clouds could be wrong (the wrong normals were compared) --- src/RegistrationTools.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/RegistrationTools.cpp b/src/RegistrationTools.cpp index 37a2b2e..684cfbc 100644 --- a/src/RegistrationTools.cpp +++ b/src/RegistrationTools.cpp @@ -659,13 +659,19 @@ ICPRegistrationTools::RESULT_TYPE ICPRegistrationTools::Register( GenericIndexed CCVector3 Nm; if (inputModelMesh) { + assert(data.CPSetPlain); unsigned triIndex = static_cast(data.CPSetPlain->getPointScalarValue(i)); assert(triIndex < inputModelMesh->size()); inputModelMesh->interpolateNormals(triIndex, *data.CPSetPlain->getPoint(i), Nm); } + else if (inputModelCloud) + { + assert(data.CPSetRef); + Nm = *inputModelCloud->getNormal(data.CPSetRef->getPointGlobalIndex(i)); + } else { - Nm = *inputModelCloud->getNormal(i); + assert(false); } //we assume the vectors are unitary!