mirror of https://github.com/CGAL/cgal
add corefine test
This commit is contained in:
parent
2670d65fd0
commit
cc2d27e519
|
|
@ -6,10 +6,6 @@
|
||||||
// #define CGAL_DEBUG_PMP_CLIP
|
// #define CGAL_DEBUG_PMP_CLIP
|
||||||
|
|
||||||
// TODO: test coref
|
// TODO: test coref
|
||||||
// TODO: test throw coref and clip
|
|
||||||
// TODO: check split
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
namespace PMP = CGAL::Polygon_mesh_processing;
|
namespace PMP = CGAL::Polygon_mesh_processing;
|
||||||
namespace params = CGAL::parameters;
|
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));
|
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";
|
std::cout << " test clip with SI allowed\n";
|
||||||
TriangleMesh tm;
|
TriangleMesh tm;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue