From c97d3ffb6541cc924f519004f70fa125d1c4394d Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Thu, 1 Apr 2021 16:47:07 +0100 Subject: [PATCH] Take into account that obtuse vertices are not clipped. --- .../include/CGAL/Polyhedral_envelope.h | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polyhedral_envelope.h b/Polygon_mesh_processing/include/CGAL/Polyhedral_envelope.h index 15ec98ec8f5..7d275153d5c 100644 --- a/Polygon_mesh_processing/include/CGAL/Polyhedral_envelope.h +++ b/Polygon_mesh_processing/include/CGAL/Polyhedral_envelope.h @@ -1123,9 +1123,14 @@ private: int inter = 0; - if(((cutp[i] == 0)||(cutp[i] == 1)) && ( (cutp[j] == 2)||(cutp[j] == 4) ||(cutp[j] == 6) )){ // ATTENTION Only correct together with CGAL_INITIAL - int j0 = (cutp[j] == 2)? 0 : (cutp[j]==4)? 1 : 2; - int j1 = (cutp[j] == 2)? 1 : (cutp[j]==4)? 2 : 0; + static const int edges[3][3] = { {2, 4, 6 }, {2, 3, 5}, {2, 4, 5} }; + + int ob = prism.obtuse; + if (ob == -1) ob = 0; + + if(((cutp[i] == 0)||(cutp[i] == 1)) && ( (cutp[j] == edges[ob][0])||(cutp[j] == edges[ob][1]) ||(cutp[j] == edges[ob][2]) )){ // ATTENTION Only correct together with CGAL_INITIAL + int j0 = (cutp[j] == edges[ob][0])? 0 : (cutp[j]==edges[ob][1])? 1 : 2; + int j1 = (cutp[j] == edges[ob][0])? 1 : (cutp[j]==edges[ob][1])? 2 : 0; const Vector3i & v3i = env_faces[cindex]; const Point_3& pj0 = env_vertices[v3i[j0]]; const Point_3& pj1 = env_vertices[v3i[j1]];