From c89f409aad5143691c43ec7f7c2d47b9f86ccbfc Mon Sep 17 00:00:00 2001 From: El Hadi Moussi Date: Tue, 6 Aug 2024 17:47:13 +0200 Subject: [PATCH] Correct the computation of Cone properties The size of q1_indices and q2_indices can be different --- src/ShapeRecogn/Areas.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ShapeRecogn/Areas.cxx b/src/ShapeRecogn/Areas.cxx index 5c2559f8c..f3d274fdf 100644 --- a/src/ShapeRecogn/Areas.cxx +++ b/src/ShapeRecogn/Areas.cxx @@ -379,7 +379,8 @@ void Areas::computeConeProperties(mcIdType areaId) // std::vector heights(q1_indices.size(), 0.0); // std::vector distancesToApex(q1_indices.size(), 0.0); std::array p{0.0, 0.0, 0.0}; - for (size_t i = 0; i < q1_indices.size(); ++i) + size_t min_q_size = std::min(q1_indices.size(), q2_indices.size()); + for (size_t i = 0; i < min_q_size; ++i) { for (size_t j = 0; j < 3; ++j) p[j] = (projectedNodes[3 * q1_indices[i] + j] - projectedNodes[3 * q2_indices[i] + j]); -- 2.39.2