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.
This commit is contained in:
2025-11-13 16:07:57 +03:00
parent 40e26be72e
commit 2b21caf58f

View File

@@ -58,10 +58,10 @@ namespace omath::collision
// Initial tetra faces (windings corrected in make_face)
std::vector<Face> 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);