mirror of https://github.com/CGAL/cgal
fix when bbox has a 0-width + update testsuite
This commit is contained in:
parent
8a27676102
commit
a51a153c31
|
|
@ -406,9 +406,9 @@ bool clip( TriangleMesh& tm,
|
|||
CGAL::Bbox_3 bbox = ::CGAL::Polygon_mesh_processing::bbox(tm);
|
||||
|
||||
//extend the bbox a bit to avoid border cases
|
||||
double xd=(bbox.xmax()-bbox.xmin())/100;
|
||||
double yd=(bbox.ymax()-bbox.ymin())/100;
|
||||
double zd=(bbox.zmax()-bbox.zmin())/100;
|
||||
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);
|
||||
TriangleMesh clipper;
|
||||
|
|
|
|||
|
|
@ -206,6 +206,16 @@ void test()
|
|||
CGAL::clear(tm1);
|
||||
CGAL::clear(tm2);
|
||||
|
||||
// clip meshes with intersection polyline opened
|
||||
make_triangle( K::Point_3(0, 0, 0), K::Point_3(0, 4, 0), K::Point_3(4, 0, 0), tm1 );
|
||||
PMP::clip(tm1, K::Plane_3(1, 0, 0, -2));
|
||||
assert(vertices(tm1).size()==4);
|
||||
CGAL::clear(tm1);
|
||||
|
||||
make_triangle( K::Point_3(0, 0, 0), K::Point_3(0, 4, 0), K::Point_3(4, 0, 0), tm1 );
|
||||
PMP::clip(tm1, K::Plane_3(-1, 0, 0, 2));
|
||||
assert(vertices(tm1).size()==3);
|
||||
CGAL::clear(tm1);
|
||||
}
|
||||
|
||||
int main()
|
||||
|
|
|
|||
Loading…
Reference in New Issue