mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-24 15:13:58 -06: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
1 changed files with 14 additions and 5 deletions
|
@ -150,11 +150,20 @@ template<class _Mesh> TriangleMesh cgal_to_triangle_mesh(const _Mesh &cgalmesh)
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto &face : cgalmesh.faces()) {
|
for (auto &face : cgalmesh.faces()) {
|
||||||
auto vtc = cgalmesh.vertices_around_face(cgalmesh.halfedge(face));
|
auto vtc = cgalmesh.vertices_around_face(cgalmesh.halfedge(face));
|
||||||
int i = 0;
|
|
||||||
Vec3i trface;
|
int i = 0;
|
||||||
for (auto v : vtc) trface(i++) = static_cast<int>(v);
|
Vec3i facet;
|
||||||
facets.emplace_back(trface);
|
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};
|
TriangleMesh out{points, facets};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue