From 2b21caf58f9c2ad4d19e9b8b9d56bb7b07260bc8 Mon Sep 17 00:00:00 2001 From: Orange Date: Thu, 13 Nov 2025 16:07:57 +0300 Subject: [PATCH] Refactors face initialization Replaces `push_back` with `emplace_back` when initializing faces in the EPA algorithm. This avoids unnecessary copying and improves performance during face creation. --- include/omath/collision/epa_algorithm.hpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/omath/collision/epa_algorithm.hpp b/include/omath/collision/epa_algorithm.hpp index 2c7f7e9..df25ccb 100644 --- a/include/omath/collision/epa_algorithm.hpp +++ b/include/omath/collision/epa_algorithm.hpp @@ -58,10 +58,10 @@ namespace omath::collision // Initial tetra faces (windings corrected in make_face) std::vector faces; faces.reserve(128); - faces.push_back(make_face(verts, 0, 1, 2)); - faces.push_back(make_face(verts, 0, 2, 3)); - faces.push_back(make_face(verts, 0, 3, 1)); - faces.push_back(make_face(verts, 1, 3, 2)); + faces.emplace_back(make_face(verts, 0, 1, 2)); + faces.emplace_back(make_face(verts, 0, 2, 3)); + faces.emplace_back(make_face(verts, 0, 3, 1)); + faces.emplace_back(make_face(verts, 1, 3, 2)); auto heap = rebuild_heap(faces);