From 7feebef0de04373cb8e03d5d932b51d884ba1e99 Mon Sep 17 00:00:00 2001 From: El Hadi Moussi Date: Wed, 7 Aug 2024 10:03:37 +0200 Subject: [PATCH] Add conversions --- src/ShapeRecogn/Areas.cxx | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/ShapeRecogn/Areas.cxx b/src/ShapeRecogn/Areas.cxx index f3d274fdf..4c9041168 100644 --- a/src/ShapeRecogn/Areas.cxx +++ b/src/ShapeRecogn/Areas.cxx @@ -48,9 +48,9 @@ void Areas::addNode(mcIdType areaId, mcIdType nodeId) Area &area = areas[areaId]; area.nodeIds.push_back(nodeId); size_t nbNodes = area.nodeIds.size(); - area.k1 = ((nbNodes - 1) * area.k1 + nodes->getK1(nodeId)) / nbNodes; - area.k2 = ((nbNodes - 1) * area.k2 + nodes->getK2(nodeId)) / nbNodes; - area.kdiff0 = ((nbNodes - 1) * area.kdiff0 + nodes->getKdiff0(nodeId)) / nbNodes; + area.k1 = ((double)(nbNodes - 1) * area.k1 + nodes->getK1(nodeId)) / (double)nbNodes; + area.k2 = ((double)(nbNodes - 1) * area.k2 + nodes->getK2(nodeId)) / (double)nbNodes; + area.kdiff0 = ((double)(nbNodes - 1) * area.kdiff0 + nodes->getKdiff0(nodeId)) / (double)nbNodes; } void Areas::cleanInvalidNodeAreas() @@ -254,7 +254,7 @@ void Areas::computePlaneProperties(mcIdType areaId) area.normal[i] += normals[3 * nodeId + i]; } for (size_t i = 0; i < 3; ++i) - area.normal[i] /= nbNodes; + area.normal[i] /= (double)nbNodes; } void Areas::computeSphereProperties(mcIdType areaId) @@ -273,7 +273,7 @@ void Areas::computeSphereProperties(mcIdType areaId) center[i] += nodeCoords[i] - area.radius * normals[3 * nodeId + i]; } for (size_t i = 0; i < 3; ++i) - center[i] /= nbNodes; + center[i] /= (double)nbNodes; } area.center = center; area.radius = fabs(area.radius); @@ -302,9 +302,9 @@ void Areas::computeCylinderProperties(mcIdType areaId) } // Axis point is the mean of the projected nodes for (size_t i = 0; i < 3; ++i) - area.axisPoint[i] /= nbNodes; + area.axisPoint[i] /= (double)nbNodes; // Radius of the cylinder is the mean of the approximate radius of each node - area.radius = fabs(area.radius / nbNodes); + area.radius = fabs(area.radius / (double)nbNodes); // Compute the axis of the cylinder area.axis = MathOps::computePCAFirstAxis(projectedNodes); } @@ -331,7 +331,7 @@ void Areas::computeConeProperties(mcIdType areaId) } // Axis point is the mean of the projected nodes for (size_t i = 0; i < 3; ++i) - area.axisPoint[i] /= nbNodes; + area.axisPoint[i] /= (double)nbNodes; // Compute the axis of the cone area.axis = MathOps::computePCAFirstAxis(projectedNodes); double normAxis = MathOps::computeNorm(area.axis); @@ -397,7 +397,7 @@ void Areas::computeConeProperties(mcIdType areaId) } } for (size_t j = 0; j < 3; ++j) - area.apex[j] /= q1_indices.size(); + area.apex[j] /= (double)q1_indices.size(); } void Areas::computeTorusProperties(mcIdType areaId) -- 2.39.2