mirror of
https://git.mirrors.martin98.com/https://github.com/SoftFever/OrcaSlicer.git
synced 2025-08-01 05:21:59 +08:00
CGAL may have infinite face vertex ranges.
Calling vtc.size() may end up in an infinite loop. Also, quads do not appear in CGAL meshes.
This commit is contained in:
parent
92de7bafc6
commit
0c4fb6dfcc
@ -150,11 +150,20 @@ template<class _Mesh> TriangleMesh cgal_to_triangle_mesh(const _Mesh &cgalmesh)
|
||||
}
|
||||
|
||||
for (auto &face : cgalmesh.faces()) {
|
||||
auto vtc = cgalmesh.vertices_around_face(cgalmesh.halfedge(face));
|
||||
int i = 0;
|
||||
Vec3i trface;
|
||||
for (auto v : vtc) trface(i++) = static_cast<int>(v);
|
||||
facets.emplace_back(trface);
|
||||
auto vtc = cgalmesh.vertices_around_face(cgalmesh.halfedge(face));
|
||||
|
||||
int i = 0;
|
||||
Vec3i facet;
|
||||
for (const auto &v : vtc) {
|
||||
if (i > 2) { i = 0; break; }
|
||||
facet(i++) = v;
|
||||
}
|
||||
|
||||
if (i == 3) {
|
||||
facets.emplace_back(facet);
|
||||
} else {
|
||||
BOOST_LOG_TRIVIAL(error) << "CGAL face is not a triangle.";
|
||||
}
|
||||
}
|
||||
|
||||
TriangleMesh out{points, facets};
|
||||
|
Loading…
x
Reference in New Issue
Block a user