cgal icon indicating copy to clipboard operation
cgal copied to clipboard

refine with plane convex version fails on non closed meshes

Open sloriot opened this issue 4 months ago • 1 comments

The following program fails. The mesh is convex but not closed (convex in a plane). If that's not too much work, I think we should support this case, or clearly document it.

#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Surface_mesh.h>

#include <CGAL/Polygon_mesh_processing/clip.h>

using Kernel = CGAL::Exact_predicates_exact_constructions_kernel;
using Mesh = CGAL::Surface_mesh<Kernel::Point_3>;

namespace PMP = CGAL::Polygon_mesh_processing;
namespace params = CGAL::parameters;


int main()
{
  Mesh mesh;
  CGAL::make_triangle(Kernel::Point_3(0,0,0),Kernel::Point_3(1,0,0),Kernel::Point_3(0.5,0.5,1), mesh);

  PMP::refine_with_plane(mesh, Kernel::Plane_3(0,1,0,-0.4), params::do_not_triangulate_faces(true).use_convex_specialization(true));

  std::ofstream("out.off") << mesh;
}

sloriot avatar Jul 29 '26 12:07 sloriot

Hi @sloriot @LeoValque,

I reproduced this locally. In debug mode, it triggers the assertion violation at clip_convex.h:235: oriented_side(plane, get(vpm, source(h,pm))) == ON_NEGATIVE_SIDE inside refine_convex_with_plane_using_opposite_direction(), while in release mode it segfaults at Euler::split_face on the border halfedge.

Just wanted to check if @LeoValque is actively working on this? If not, I would be happy to investigate a fix for non-closed planar meshes and open a PR.

Ayush-CS-89112521 avatar Oct 29 '26 20:10 Ayush-CS-89112521