Testcase and fix for a problem transforming an empty bbox with very small numbers in a transformation matrix

export-menu
Marius Kintel 2014-01-13 20:57:49 -05:00
parent 23b04c3a9f
commit 34ae2b8f68
6 changed files with 14 additions and 1 deletions

View File

@ -14,6 +14,7 @@
*/
BoundingBox operator*(const Transform3d &m, const BoundingBox &box)
{
if (box.isEmpty()) return box;
BoundingBox newbox;
Vector3d boxvec[2] = { box.min(), box.max() };
for (int k=0;k<2;k++) {

View File

@ -0,0 +1,11 @@
// rotate([90,0,0]) results in a matrix with some close-to-zero values
// Transforming an empty boundingbox by this matrix has caused a problem resulting
// in the union being evaluated to nothing.
rotate([90,0,0])
difference() {
cube(60, center=true);
union() {
translate([0,0,40]) cube(50, center=true);
cube(0);
}
}

View File

@ -840,7 +840,8 @@ list(APPEND CGALPNGTEST_FILES ${CMAKE_SOURCE_DIR}/../testdata/scad/misc/include-
${CMAKE_SOURCE_DIR}/../testdata/scad/misc/use-tests.scad
${CMAKE_SOURCE_DIR}/../testdata/scad/bugs/transform-nan-inf-tests.scad
${CMAKE_SOURCE_DIR}/../testdata/scad/misc/localfiles-test.scad
${CMAKE_SOURCE_DIR}/../testdata/scad/misc/localfiles_dir/localfiles-compatibility-test.scad)
${CMAKE_SOURCE_DIR}/../testdata/scad/misc/localfiles_dir/localfiles-compatibility-test.scad
${CMAKE_SOURCE_DIR}/../testdata/scad/misc/rotate-empty-bbox.scad)
list(APPEND OPENCSGTEST_FILES ${CGALPNGTEST_FILES})
list(APPEND OPENCSGTEST_FILES ${CMAKE_SOURCE_DIR}/../testdata/scad/bugs/intersection-prune-test.scad)

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB