diff --git a/include/DistanceComputationTools.h b/include/DistanceComputationTools.h index 7baea07..22af4eb 100644 --- a/include/DistanceComputationTools.h +++ b/include/DistanceComputationTools.h @@ -133,7 +133,8 @@ namespace CCCoreLib \param compOctree the pre-computed octree of the compared cloud (warning: both octrees must have the same cubical bounding-box - it is automatically computed if 0) \param refOctree the pre-computed octree of the reference cloud (warning: both octrees must have the same cubical bounding-box - it is automatically computed if 0) - \return 0 if ok, a negative value otherwise + \return DISTANCE_COMPUTATION_RESULTS::SUCCESS on success, + a negative error code from DISTANCE_COMPUTATION_RESULTS otherwise. **/ static int computeCloud2CloudDistances( GenericIndexedCloudPersist* comparedCloud, GenericIndexedCloudPersist* referenceCloud, @@ -522,7 +523,7 @@ namespace CCCoreLib ERROR_UNKOWN_ERRORMEASURES_TYPE, ERROR_INTERNAL, INVALID_INPUT, - SUCCESS = 1, + SUCCESS = 0, }; //! Computes the "distance" (see ERROR_MEASURES) between a point cloud and a plane diff --git a/src/DistanceComputationTools.cpp b/src/DistanceComputationTools.cpp index 484e529..a230349 100644 --- a/src/DistanceComputationTools.cpp +++ b/src/DistanceComputationTools.cpp @@ -235,6 +235,10 @@ int DistanceComputationTools::computeCloud2CloudDistances( GenericIndexedCloudPe //something went wrong result = DISTANCE_COMPUTATION_RESULTS::ERROR_EXECUTE_FUNCTION_FOR_ALL_CELLS_AT_LEVEL_FAILURE; } + else + { + result = DISTANCE_COMPUTATION_RESULTS::SUCCESS; + } if (comparedOctree && !compOctree) diff --git a/src/RegistrationTools.cpp b/src/RegistrationTools.cpp index 6ee6f90..92bfd05 100644 --- a/src/RegistrationTools.cpp +++ b/src/RegistrationTools.cpp @@ -383,7 +383,8 @@ ICPRegistrationTools::RESULT_TYPE ICPRegistrationTools::Register( GenericIndexed DistanceComputationTools::Cloud2CloudDistancesComputationParams c2cDistParams; c2cDistParams.CPSet = data.CPSetRef; c2cDistParams.maxThreadCount = params.maxThreadCount; - if (DistanceComputationTools::computeCloud2CloudDistances(data.cloud, model.cloud, c2cDistParams, progressCb) < 0) + if (DistanceComputationTools::computeCloud2CloudDistances(data.cloud, model.cloud, c2cDistParams, progressCb) < + DistanceComputationTools::DISTANCE_COMPUTATION_RESULTS::SUCCESS) { //an error occurred during distances computation... return ICP_ERROR_DIST_COMPUTATION; @@ -654,7 +655,7 @@ ICPRegistrationTools::RESULT_TYPE ICPRegistrationTools::Register( GenericIndexed { //retrieve the data point normal const CCVector3* Nd = data.cloud->getNormal(i); - + //retrieve the nearest model point normal CCVector3 Nm; if (inputModelMesh) @@ -951,7 +952,8 @@ ICPRegistrationTools::RESULT_TYPE ICPRegistrationTools::Register( GenericIndexed DistanceComputationTools::Cloud2CloudDistancesComputationParams c2cDistParams; c2cDistParams.CPSet = data.CPSetRef; c2cDistParams.maxThreadCount = params.maxThreadCount; - if (DistanceComputationTools::computeCloud2CloudDistances(data.cloud, model.cloud, c2cDistParams) < 0) + if (DistanceComputationTools::computeCloud2CloudDistances(data.cloud, model.cloud, c2cDistParams) < + DistanceComputationTools::DISTANCE_COMPUTATION_RESULTS::SUCCESS) { //an error occurred during distances computation... result = ICP_ERROR_REGISTRATION_STEP; @@ -1155,7 +1157,7 @@ bool RegistrationTools::RegistrationProcedure( GenericCloud* P, //data { return false; } - + PointCoordinateType sin_t = static_cast(S / Q); PointCoordinateType cos_t = static_cast(C / Q); PointCoordinateType inv_cos_t = 1 - cos_t;