From d862385c8956b9cc1002323feddf0b65a777a1c1 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sun, 19 Mar 2023 23:52:22 +0000 Subject: Use OpenMesh built-in to calculate face centre --- assetFactory/faceController.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'assetFactory') diff --git a/assetFactory/faceController.cpp b/assetFactory/faceController.cpp index 1ec1467..2fb0412 100644 --- a/assetFactory/faceController.cpp +++ b/assetFactory/faceController.cpp @@ -33,8 +33,7 @@ FaceController::apply(ModelFactoryMesh & mesh, const StyleStack & parents, const return std::move(out); }); const auto vertexCount = points.size(); - const auto centre - = std::accumulate(points.begin(), points.end(), glm::vec3 {}) / static_cast(vertexCount); + const auto centre = mesh.calc_face_centroid(cf.second); if (type == "extrude") { Shape::CreatedFaces newFaces; // mutate points -- cgit v1.2.3