From a93e6449804e75e351ac46a84ceff8f034ddd25d Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Tue, 6 Sep 2011 22:01:42 +0200 Subject: Added hull tests diff --git a/testdata/scad/features/hull-tests.scad b/testdata/scad/features/hull-tests.scad deleted file mode 100644 index 3114ac5..0000000 --- a/testdata/scad/features/hull-tests.scad +++ /dev/null @@ -1,43 +0,0 @@ -// Works correctly -module convex2dSimple() { - hull() { - translate([15,10]) circle(10); - circle(10); - } -} - -// Works correctly -module convex2dHole() { - hull() { - translate([15,10,0]) circle(10); - difference() { - circle(10); - circle(5); - } - } -} - -// 3d not currently implemented -module convex3dSimple() { - hull() { - translate([15,10]) cylinder(r=10); - cylinder(r=10); - } -} - -// 3d not currently implemented -module convex3dHole() { - hull() { - translate([15,10,0]) cylinder(10); - difference() { - cylinder(10); - cylinder(5); - } - } -} - - -convex2dHole(); -translate([40,0,0]) convex2dSimple(); -translate([0,40,0]) convex3dHole(); -translate([40,40,0]) convex3dSimple(); diff --git a/testdata/scad/features/hull2-tests.scad b/testdata/scad/features/hull2-tests.scad new file mode 100644 index 0000000..3bea3c5 --- /dev/null +++ b/testdata/scad/features/hull2-tests.scad @@ -0,0 +1,30 @@ +module convex2dSimple() { + hull() { + translate([15,10]) circle(10); + circle(10); + } +} + +module concave2dSimple() { + hull() { + translate([15,10]) square(2); + translate([15,0]) square(2); + square(2); + } +} + +// Works correctly +module convex2dHole() { + hull() { + translate([15,10,0]) circle(10); + difference() { + circle(10); + circle(5); + } + } +} + + +convex2dHole(); +translate([40,0,0]) convex2dSimple(); +translate([0,-20,0]) concave2dSimple(); diff --git a/testdata/scad/features/hull3-tests.scad b/testdata/scad/features/hull3-tests.scad new file mode 100644 index 0000000..a3e7d92 --- /dev/null +++ b/testdata/scad/features/hull3-tests.scad @@ -0,0 +1,21 @@ +// 3d not currently implemented +module convex3dSimple() { + hull() { + translate([15,10]) cylinder(r=10); + cylinder(r=10); + } +} + +// 3d not currently implemented +module convex3dHole() { + hull() { + translate([15,10,0]) cylinder(10); + difference() { + cylinder(10); + cylinder(5); + } + } +} + +translate([0,40,0]) convex3dHole(); +translate([40,40,0]) convex3dSimple(); diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 41fd0cd..b0aa6ed 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -144,7 +144,7 @@ include_directories(${CGAL_INCLUDE_DIRS}) # add_executable(cgaltest cgaltest.cc ../src/CGAL_Nef_polyhedron.cc ../src/CSGTermEvaluator.cc ../src/CGALEvaluator.cc ../src/PolySetCGALEvaluator.cc ../src/qhash.cc - ../src/CGAL_Nef_polyhedron_DxfData.cc ../src/cgaladv_minkowski2.cc + ../src/CGAL_Nef_polyhedron_DxfData.cc ../src/cgaladv_minkowski2.cc ../src/cgaladv_convexhull2.cc ${COMMON_SOURCES}) set_target_properties(cgaltest PROPERTIES COMPILE_FLAGS "-DENABLE_CGAL ${CGAL_CXX_FLAGS_INIT}") target_link_libraries(cgaltest ${CGAL_LIBRARY} ${CGAL_3RD_PARTY_LIBRARIES} ${QT_LIBRARIES} ${OPENGL_LIBRARY}) @@ -156,7 +156,7 @@ add_executable(cgalpngtest cgalpngtest.cc OffscreenView.cc OffscreenContext.mm ../src/CGALRenderer.cc ../src/CGAL_Nef_polyhedron.cc ../src/CSGTermEvaluator.cc ../src/CGALEvaluator.cc ../src/PolySetCGALEvaluator.cc ../src/qhash.cc - ../src/CGAL_Nef_polyhedron_DxfData.cc ../src/cgaladv_minkowski2.cc + ../src/CGAL_Nef_polyhedron_DxfData.cc ../src/cgaladv_minkowski2.cc ../src/cgaladv_convexhull2.cc ${COMMON_SOURCES}) set_target_properties(cgalpngtest PROPERTIES COMPILE_FLAGS "-DENABLE_CGAL ${CGAL_CXX_FLAGS_INIT}") target_link_libraries(cgalpngtest ${CGAL_LIBRARY} ${CGAL_3RD_PARTY_LIBRARIES} ${QT_LIBRARIES} ${GLEW_LIBRARY} ${COCOA_LIBRARY} ${OPENGL_LIBRARY}) @@ -168,7 +168,7 @@ add_executable(opencsgtest opencsgtest.cc OffscreenView.cc OffscreenContext.mm ../src/OpenCSGRenderer.cc ../src/ThrownTogetherRenderer.cc ../src/CSGTermEvaluator.cc ../src/CGAL_Nef_polyhedron.cc ../src/CGALEvaluator.cc ../src/PolySetCGALEvaluator.cc ../src/qhash.cc - ../src/CGAL_Nef_polyhedron_DxfData.cc ../src/cgaladv_minkowski2.cc + ../src/CGAL_Nef_polyhedron_DxfData.cc ../src/cgaladv_minkowski2.cc ../src/cgaladv_convexhull2.cc ${COMMON_SOURCES}) set_target_properties(opencsgtest PROPERTIES COMPILE_FLAGS "-DENABLE_OPENCSG -DENABLE_CGAL ${CGAL_CXX_FLAGS_INIT}") target_link_libraries(opencsgtest ${CGAL_LIBRARY} ${CGAL_3RD_PARTY_LIBRARIES} ${QT_LIBRARIES} ${OPENCSG_LIBRARY} ${GLEW_LIBRARY} ${COCOA_LIBRARY} ${OPENGL_LIBRARY}) @@ -219,6 +219,7 @@ LIST(APPEND CGALPNGTEST_FILES ${CMAKE_SOURCE_DIR}/../testdata/scad/features/rotate_extrude-tests.scad ${CMAKE_SOURCE_DIR}/../testdata/scad/features/minkowski2-tests.scad ${CMAKE_SOURCE_DIR}/../testdata/scad/features/minkowski3-tests.scad + ${CMAKE_SOURCE_DIR}/../testdata/scad/features/hull2-tests.scad ${CMAKE_SOURCE_DIR}/../testdata/scad/features/surface-tests.scad ${CMAKE_SOURCE_DIR}/../testdata/scad/features/import_dxf-tests.scad ${CMAKE_SOURCE_DIR}/../testdata/scad/features/transform-tests.scad diff --git a/tests/regression/cgalpngtest/hull2-tests-expected.png b/tests/regression/cgalpngtest/hull2-tests-expected.png new file mode 100644 index 0000000..256b349 Binary files /dev/null and b/tests/regression/cgalpngtest/hull2-tests-expected.png differ diff --git a/tests/regression/opencsgtest/hull2-tests-expected.png b/tests/regression/opencsgtest/hull2-tests-expected.png new file mode 100644 index 0000000..66ee6b2 Binary files /dev/null and b/tests/regression/opencsgtest/hull2-tests-expected.png differ -- cgit v0.10.1