#802 Added test, issue warning instead of crashing

master
Marius Kintel 2014-05-21 14:01:12 -04:00
parent e64734f8fd
commit 2838795d63
5 changed files with 207 additions and 3 deletions

View File

@ -87,8 +87,17 @@ namespace CGALUtils {
if (op == OPENSCAD_UNION) {
if (!chN->isEmpty()) {
nary_union.add_polyhedron(*chN->p3);
nary_union_num_inserted++;
// nary_union.add_polyhedron() can issue assertion errors:
// https://github.com/openscad/openscad/issues/802
CGAL::Failure_behaviour old_behaviour = CGAL::set_error_behaviour(CGAL::THROW_EXCEPTION);
try {
nary_union.add_polyhedron(*chN->p3);
nary_union_num_inserted++;
}
catch (const CGAL::Failure_exception &e) {
PRINTB("CGAL error in CGALUtils::applyBinaryOperator union: %s", e.what());
}
CGAL::set_error_behaviour(old_behaviour);
}
continue;
}

194
testdata/scad/bugs/issue802.scad vendored Normal file
View File

@ -0,0 +1,194 @@
union() {
cube(5);
translate([ 88.7-5, 87-10, -34-1]) cube(5);
polyhedron( points = [
[153.898,59.513,-32.4658] ,
[163.267,30.683,-34.429] ,
[175.611,59.513,-24.8805] ,
[184.981,30.683,-26.8437] ,
[166.57,-1.77636e-15,-35.1211] ,
[188.284,-1.77636e-15,-27.5359] ,
[163.267,-30.683,-34.429] ,
[184.981,-30.683,-26.8437] ,
[153.898,-59.513,-32.4658] ,
[175.611,-59.513,-24.8805] ,
[181.898,59.513,-27.7158] ,
[191.267,30.683,-29.679] ,
[194.57,-1.77636e-15,-30.3711] ,
[191.267,-30.683,-29.679] ,
[181.898,-59.513,-27.7158] ,
[163.961,59.513,-33.9819] ,
[173.33,30.683,-35.9451] ,
[176.633,-1.77636e-15,-36.6372] ,
[173.33,-30.683,-35.9451] ,
[163.961,-59.513,-33.9819] ,
[148.845,69.513,-31.6884] ,
[148.845,-69.513,-31.6884] ,
[148.845,74.513,-31.6884] ,
[148.845,-74.513,-31.6884] ,
[162.25,59.513,-45.946] ,
[162.25,-59.513,-45.946] ,
[147.116,-74.513,-43.7824] ,
[147.116,74.513,-43.7824] ,
[80.3015,-54.0118,-33.5692] ,
[147.116,-69.513,-43.7824] ,
[80.3015,-59.0118,-33.5692] ,
[81.2307,-54.0118,-27.0692] ,
[81.2307,-59.0118,-27.0692] ,
[2.52448,-36,-22.6917] ,
[80.054,-54.0118,-33.5338] ,
[80.054,-59.0118,-33.5338] ,
[2.52448,-41,-22.6917] ,
[80.9832,-59.0118,-27.0338] ,
[80.9832,-54.0118,-27.0338] ,
[2.666,-36,-21.7018] ,
[2.666,-41,-21.7018] ,
[147.116,69.513,-43.7824] ,
[80.3015,59.0998,-33.5692] ,
[80.3015,64.0998,-33.5692] ,
[81.2307,59.0998,-27.0692] ,
[81.2307,64.0998,-27.0692] ,
[80.054,64.0998,-33.5338] ,
[80.054,59.0998,-33.5338] ,
[2.52448,47,-22.6917] ,
[2.52448,52,-22.6917] ,
[2.666,47,-21.7018] ,
[80.9832,59.0998,-27.0338] ,
[80.9832,64.0998,-27.0338] ,
[2.666,52,-21.7018] ,
],
faces = [
[2,1,0] ,
[3,1,2] ,
[3,4,1] ,
[5,4,3] ,
[5,6,4] ,
[7,6,5] ,
[7,8,6] ,
[9,8,7] ,
[10,3,2] ,
[11,3,10] ,
[11,5,3] ,
[12,5,11] ,
[12,7,5] ,
[13,7,12] ,
[13,9,7] ,
[14,9,13] ,
[15,11,10] ,
[16,11,15] ,
[16,12,11] ,
[17,12,16] ,
[17,13,12] ,
[18,13,17] ,
[18,14,13] ,
[19,14,18] ,
[20,0,1] ,
[20,1,4] ,
[20,4,21] ,
[21,4,6] ,
[21,6,8] ,
[0,20,22] ,
[23,21,8] ,
[16,15,24] ,
[17,16,24] ,
[25,17,24] ,
[18,17,25] ,
[19,18,25] ,
[26,25,24] ,
[26,23,25] ,
[23,19,25] ,
[27,26,24] ,
[24,15,22] ,
[24,22,27] ,
[23,27,22] ,
[23,26,27] ,
[0,15,10] ,
[10,2,0] ,
[22,15,0] ,
[14,19,8] ,
[8,9,14] ,
[8,19,23] ,
]);
translate([0,0,0]) polyhedron( points = [
[153.898,59.513,-32.4658] ,
[163.267,30.683,-34.429] ,
[175.611,59.513,-24.8805] ,
[184.981,30.683,-26.8437] ,
[166.57,-1.77636e-15,-35.1211] ,
[188.284,-1.77636e-15,-27.5359] ,
[163.267,-30.683,-34.429] ,
[184.981,-30.683,-26.8437] ,
[153.898,-59.513,-32.4658] ,
[175.611,-59.513,-24.8805] ,
[181.898,59.513,-27.7158] ,
[191.267,30.683,-29.679] ,
[194.57,-1.77636e-15,-30.3711] ,
[191.267,-30.683,-29.679] ,
[181.898,-59.513,-27.7158] ,
[163.961,59.513,-33.9819] ,
[173.33,30.683,-35.9451] ,
[176.633,-1.77636e-15,-36.6372] ,
[173.33,-30.683,-35.9451] ,
[163.961,-59.513,-33.9819] ,
[148.845,69.513,-31.6884] ,
[148.845,-69.513,-31.6884] ,
[148.845,74.513,-31.6884] ,
[148.845,-74.513,-31.6884] ,
[162.25,59.513,-45.946] ,
[162.25,-59.513,-45.946] ,
[147.116,-74.513,-43.7824] ,
[147.116,74.513,-43.7824] ,
[80.3015,-54.0118,-33.5692] ,
[147.116,-69.513,-43.7824] ,
[80.3015,-59.0118,-33.5692] ,
[81.2307,-54.0118,-27.0692] ,
[81.2307,-59.0118,-27.0692] ,
[2.52448,-36,-22.6917] ,
[80.054,-54.0118,-33.5338] ,
[80.054,-59.0118,-33.5338] ,
[2.52448,-41,-22.6917] ,
[80.9832,-59.0118,-27.0338] ,
[80.9832,-54.0118,-27.0338] ,
[2.666,-36,-21.7018] ,
[2.666,-41,-21.7018] ,
[147.116,69.513,-43.7824] ,
[80.3015,59.0998,-33.5692] ,
[80.3015,64.0998,-33.5692] ,
[81.2307,59.0998,-27.0692] ,
[81.2307,64.0998,-27.0692] ,
[80.054,64.0998,-33.5338] ,
[80.054,59.0998,-33.5338] ,
[2.52448,47,-22.6917] ,
[2.52448,52,-22.6917] ,
[2.666,47,-21.7018] ,
[80.9832,59.0998,-27.0338] ,
[80.9832,64.0998,-27.0338] ,
[2.666,52,-21.7018] ,
],
faces = [
[26,29,28] ,
[26,28,30] ,
[31,21,23] ,
[32,31,23] ,
[23,26,30] ,
[23,30,32] ,
[28,32,30] ,
[28,29,21] ,
[31,28,21] ,
[28,31,32] ,
[22,20,44] ,
[22,44,45] ,
[20,42,44] ,
[45,44,42] ,
[43,45,42] ,
[42,41,27] ,
[43,42,27] ,
[20,41,42] ,
[43,27,22] ,
[45,43,22] ,
[41,22,27] ,
[20,22,41] ,
[26,23,29] ,
[29,23,21] ,
]);
}

View File

@ -920,7 +920,8 @@ list(APPEND BUGS_FILES ${CMAKE_SOURCE_DIR}/../testdata/scad/bugs/issue495.scad
${CMAKE_SOURCE_DIR}/../testdata/scad/bugs/issue591.scad
${CMAKE_SOURCE_DIR}/../testdata/scad/bugs/issue612.scad
${CMAKE_SOURCE_DIR}/../testdata/scad/bugs/issue112.scad
${CMAKE_SOURCE_DIR}/../testdata/scad/bugs/issue666.scad)
${CMAKE_SOURCE_DIR}/../testdata/scad/bugs/issue666.scad
${CMAKE_SOURCE_DIR}/../testdata/scad/bugs/issue802.scad)
list(APPEND OPENCSGTEST_FILES ${BUGS_FILES})
list(APPEND CGALPNGTEST_FILES ${BUGS_FILES})

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB