diff --git a/Polygon_mesh_processing/test/Polygon_mesh_processing/test_degenerate_pmp_clip_split_corefine.cpp b/Polygon_mesh_processing/test/Polygon_mesh_processing/test_degenerate_pmp_clip_split_corefine.cpp index 9562d946222..0decb116499 100644 --- a/Polygon_mesh_processing/test/Polygon_mesh_processing/test_degenerate_pmp_clip_split_corefine.cpp +++ b/Polygon_mesh_processing/test/Polygon_mesh_processing/test_degenerate_pmp_clip_split_corefine.cpp @@ -6,10 +6,6 @@ // #define CGAL_DEBUG_PMP_CLIP // TODO: test coref -// TODO: test throw coref and clip -// TODO: check split - - namespace PMP = CGAL::Polygon_mesh_processing; namespace params = CGAL::parameters; @@ -43,6 +39,33 @@ void test() PMP::split(tm, K::Plane_3(a,b,c,d), params::allow_self_intersections(true)); } + { + std::cout << " test corefine with SI allowed\n"; + TriangleMesh tm; + std::ifstream(f) >> tm; + TriangleMesh box_mesh; + CGAL::Bbox_3 bbox = PMP::bbox(tm); + + //extend the bbox a bit to avoid border cases + double xd=(std::max)(1.,(bbox.xmax()-bbox.xmin())/100); + double yd=(std::max)(1.,(bbox.ymax()-bbox.ymin())/100); + double zd=(std::max)(1.,(bbox.zmax()-bbox.zmin())/100); + bbox=CGAL::Bbox_3(bbox.xmin()-xd, bbox.ymin()-yd, bbox.zmin()-zd, + bbox.xmax()+xd, bbox.ymax()+yd, bbox.zmax()+zd); + PMP::internal::clip_to_bbox(K::Plane_3(a,b,c,d), bbox, + box_mesh, params::default_values()); + try{ + PMP::corefine(tm, box_mesh, params::throw_on_self_intersection(true)); + } + catch(PMP::Corefinement::Self_intersection_exception&) + {} + + PMP::corefine(tm, box_mesh, params::default_values(), params::do_not_modify(true)); + + assert(CGAL::is_triangle_mesh(tm)); + assert(CGAL::is_triangle_mesh(box_mesh)); + } + { std::cout << " test clip with SI allowed\n"; TriangleMesh tm;