29 lines
1.1 KiB
Diff
29 lines
1.1 KiB
Diff
# UNDF: UNDF-2026-000000912
|
|
--- a/src/libslic3r/CutSurface.cpp
|
|
+++ b/src/libslic3r/CutSurface.cpp
|
|
@@ -3758,6 +3758,7 @@
|
|
indexed_triangle_set priv::create_indexed_triangle_set(
|
|
const std::vector<FI> &faces, const CutMesh &mesh)
|
|
{
|
|
+ std::unordered_map<uint32_t, int> vertex_map; // VI index -> position in vertices vector
|
|
std::vector<VI> vertices;
|
|
vertices.reserve(faces.size() * 2);
|
|
|
|
@@ -3773,8 +3774,13 @@
|
|
do {
|
|
VI vi = mesh.source(hi);
|
|
- auto res = std::find(vertices.begin(), vertices.end(), vi);
|
|
- t[ti++] = res - vertices.begin();
|
|
- if (res == vertices.end()) vertices.push_back(vi);
|
|
+ uint32_t vi_idx = static_cast<uint32_t>(vi);
|
|
+ auto it = vertex_map.find(vi_idx);
|
|
+ if (it != vertex_map.end()) {
|
|
+ t[ti++] = it->second;
|
|
+ } else {
|
|
+ int pos = static_cast<int>(vertices.size());
|
|
+ vertex_map[vi_idx] = pos;
|
|
+ vertices.push_back(vi);
|
|
+ t[ti++] = pos;
|
|
+ }
|
|
hi = mesh.next(hi);
|
|
} while (hi != hi_end);
|