add extra tests

This commit is contained in:
Sébastien Loriot 2022-06-27 19:19:10 +02:00
parent 3283fd0b37
commit 2670d65fd0
2 changed files with 24 additions and 2 deletions

View File

@ -107,7 +107,7 @@ create_single_source_cgal_program("test_simplify_polylines_pmp.cpp")
create_single_source_cgal_program("triangulate_hole_with_cdt_2_test.cpp")
create_single_source_cgal_program("test_pmp_polyhedral_envelope.cpp")
create_single_source_cgal_program("test_pmp_np_function.cpp")
create_single_source_cgal_program("test_degenerate_pmp_clip.cpp")
create_single_source_cgal_program("test_degenerate_pmp_clip_split_corefine.cpp")
# create_single_source_cgal_program("test_pmp_repair_self_intersections.cpp")
find_package(METIS)

View File

@ -3,7 +3,7 @@
#include <CGAL/Surface_mesh.h>
#include <CGAL/Polyhedron_3.h>
#define CGAL_DEBUG_PMP_CLIP
// #define CGAL_DEBUG_PMP_CLIP
// TODO: test coref
// TODO: test throw coref and clip
@ -25,6 +25,26 @@ void test()
auto run_a_test = [&i] (std::string f, double a, double b, double c, double d)
{
std::cout << "running test " << i << "\n";
{
std::cout << " test clip with throw\n";
TriangleMesh tm;
std::ifstream(f) >> tm;
try{
PMP::clip(tm, K::Plane_3(a,b,c,d), params::throw_on_self_intersection(true));
}
catch(PMP::Corefinement::Self_intersection_exception&)
{}
}
{
std::cout << " test split with SI allowed\n";
TriangleMesh tm;
std::ifstream(f) >> tm;
PMP::split(tm, K::Plane_3(a,b,c,d), params::allow_self_intersections(true));
}
{
std::cout << " test clip with SI allowed\n";
TriangleMesh tm;
std::ifstream(f) >> tm;
#ifdef CGAL_DEBUG_PMP_CLIP
@ -34,6 +54,8 @@ void test()
#ifdef CGAL_DEBUG_PMP_CLIP
std::ofstream("/tmp/output_"+std::to_string(i)+".off") << std::setprecision(17) << tm;
#endif
}
++i;
};