summaryrefslogtreecommitdiff
path: root/testdata
diff options
context:
space:
mode:
authorMarius Kintel <marius@kintel.net>2013-12-09 04:12:13 (GMT)
committerMarius Kintel <marius@kintel.net>2013-12-09 04:12:13 (GMT)
commit462d4d447885594629fefb8a658f9f1d079bcc44 (patch)
tree6690951e4f814b87a1a372a913b75ceda1f6cc1a /testdata
parent435e0c021c5018ee5de69d3218c3e31c8ab75be5 (diff)
parent33c34b6f7c43d19bbfa3bf91e7b577bcc062e5bd (diff)
Merge branch 'master' into travis
Diffstat (limited to 'testdata')
-rw-r--r--testdata/scad/features/for-tests.scad6
-rw-r--r--testdata/scad/features/polygon-tests.scad6
-rw-r--r--testdata/scad/features/projection-cut-tests.scad15
-rw-r--r--testdata/scad/features/projection-extrude-tests.scad3
-rw-r--r--testdata/scad/features/projection-tests.scad31
-rw-r--r--testdata/scad/features/render-2d-tests.scad9
-rw-r--r--testdata/scad/misc/children-tests.scad2
-rw-r--r--testdata/scad/misc/range-tests.scad20
8 files changed, 74 insertions, 18 deletions
diff --git a/testdata/scad/features/for-tests.scad b/testdata/scad/features/for-tests.scad
index fe36789..10295b1 100644
--- a/testdata/scad/features/for-tests.scad
+++ b/testdata/scad/features/for-tests.scad
@@ -22,10 +22,10 @@ for(r=[1:2:6]) translate([r*10-30,30,0]) difference() {cylinder(r=r, center=true
for(r=[1.5:0.2:2.5]) translate([r*10-30,30,0]) cube([1, 4*r, 2], center=true);
// Negative range, negative step
-for(r=[5:-1:1]) translate([r*10-60,40,0]) cylinder(r=r);
+for(r=[5:-1:1]) translate([r*10-30,50,0]) cylinder(r=r);
-// Negative range, positive step
-for(r=[5:1:1]) translate([r*10-30,40,0]) cylinder(r=r);
+// Negative range, positive step (using backward compatible auto swap of begin and end)
+for(r=[5:1]) translate([r*10-30,40,0]) cylinder(r=r);
// Zero step
diff --git a/testdata/scad/features/polygon-tests.scad b/testdata/scad/features/polygon-tests.scad
index b4e92b6..0cd259f 100644
--- a/testdata/scad/features/polygon-tests.scad
+++ b/testdata/scad/features/polygon-tests.scad
@@ -15,4 +15,10 @@ translate([-2,0,0]) polygon(points);
translate([-2,-2,0]) polygon(points=points, paths=[[0,1,2,3], [4,5,6,7]]);
translate([2,-4,0]) polygon([[0,0], [1,0], [1,1], [0,0]]);
+// With hole
+translate([-2,-4,0])
+ polygon(points=[[0,0], [1,0], [1,1], [0,1], [0.2,0.2], [0.8,0.2], [0.8,0.8], [0.2,0.8]],
+ paths=[[0,1,2,3],[4,5,6,7]]
+);
+
// FIXME: convexity
diff --git a/testdata/scad/features/projection-cut-tests.scad b/testdata/scad/features/projection-cut-tests.scad
new file mode 100644
index 0000000..0409a3e
--- /dev/null
+++ b/testdata/scad/features/projection-cut-tests.scad
@@ -0,0 +1,15 @@
+// 2D child
+projection(cut=true) { square(); }
+
+projection(cut=true) translate([20,0,0]) cube(10, center=true);
+
+// Boundary case: clipping the top of a cube
+translate([0,20,0]) projection(cut=true) translate([0,0,-4.999999]) cube(10, center=true);
+
+// holes
+translate([0,-10,0]) projection(cut=true) {
+ union() {
+ difference() { cube(5,center=true); cube(4,center=true); }
+ translate([2.1,2.1]) difference() { cube(5,center=true); cube(4,center=true); }
+ }
+}
diff --git a/testdata/scad/features/projection-extrude-tests.scad b/testdata/scad/features/projection-extrude-tests.scad
new file mode 100644
index 0000000..d9c216c
--- /dev/null
+++ b/testdata/scad/features/projection-extrude-tests.scad
@@ -0,0 +1,3 @@
+// Linear extrude
+translate([22,0,0]) linear_extrude(height=20) projection(cut=true) translate([0,0,9]) sphere(r=10);
+translate([44,0,0]) linear_extrude(height=20) projection(cut=true) translate([0,0,7]) sphere(r=10);
diff --git a/testdata/scad/features/projection-tests.scad b/testdata/scad/features/projection-tests.scad
index e6c52ea..27d03fe 100644
--- a/testdata/scad/features/projection-tests.scad
+++ b/testdata/scad/features/projection-tests.scad
@@ -3,18 +3,25 @@ projection();
// No children
projection() { }
// 2D child
-projection(cut=true) { square(); }
+projection() { square(); }
-linear_extrude(height=20) projection(cut=false) sphere(r=10);
-translate([22,0,0]) linear_extrude(height=20) projection(cut=true) translate([0,0,9]) sphere(r=10);
-translate([44,0,0]) linear_extrude(height=20) projection(cut=true) translate([0,0,7]) sphere(r=10);
+// Simple
+projection(cut=false) cube(10);
-// Boundary case: clipping the top of a cube
-translate([0,-22,0]) linear_extrude(height=5) projection(cut=true) translate([0,0,-4.999999]) cube(10, center=true);
+// Two children
+translate([-12,0]) projection(cut=false) {
+ cube(10);
+ difference() {
+ sphere(10);
+ cylinder(h=30, r=5, center=true);
+ }
+}
-// holes
-translate([0,-44,0]) linear_extrude(height=5) projection(cut=true)
- union() {
- difference() { cube(5,center=true); cube(4,center=true); }
- translate([2.1,2.1]) difference() { cube(5,center=true); cube(4,center=true); }
- }
+// Holes
+translate([6,-12]) projection(cut=false) {
+ cube(10);
+ difference() {
+ sphere(10);
+ cylinder(h=30, r=5, center=true);
+ }
+}
diff --git a/testdata/scad/features/render-2d-tests.scad b/testdata/scad/features/render-2d-tests.scad
index 683ffe4..f8df115 100644
--- a/testdata/scad/features/render-2d-tests.scad
+++ b/testdata/scad/features/render-2d-tests.scad
@@ -1,6 +1,11 @@
render() {
difference() {
- square(100, center=true);
- circle(r=30);
+ square(10, center=true);
+ circle(r=3);
}
}
+
+translate([12,0,0]) render() {
+ square(10, center=true);
+ circle(r=3);
+}
diff --git a/testdata/scad/misc/children-tests.scad b/testdata/scad/misc/children-tests.scad
index a9a3cf9..1c3d9ea 100644
--- a/testdata/scad/misc/children-tests.scad
+++ b/testdata/scad/misc/children-tests.scad
@@ -53,7 +53,7 @@ module test_children_range() {
children([0:4]); // all
children([1:2]); // child2, child3
children([0:2:4]); // child1, child3, child5
- children([4:-1:0]); // out, out
+ children([0:-1:4]); // out, out
echo("Children range: end");
}
test_children_range() {
diff --git a/testdata/scad/misc/range-tests.scad b/testdata/scad/misc/range-tests.scad
new file mode 100644
index 0000000..42ef2a4
--- /dev/null
+++ b/testdata/scad/misc/range-tests.scad
@@ -0,0 +1,20 @@
+echo("[a01] ----- [1:4]"); for (a = [1:4]) echo ("[a01] ", a);
+echo("[a02] ----- [4:1]"); for (a = [4:1]) echo ("[a02] ", a);
+echo("[a03] ----- [0:0]"); for (a = [0:0]) echo ("[a03] ", a);
+echo("[a04] ----- [0:3]"); for (a = [0:3]) echo ("[a04] ", a);
+echo("[a05] ----- [-3:0]"); for (a = [-3:0]) echo ("[a05] ", a);
+echo("[a06] ----- [0:-3]"); for (a = [0:-3]) echo ("[a06] ", a);
+echo("[a07] ----- [-2:2]"); for (a = [-2:2]) echo ("[a07] ", a);
+echo("[a08] ----- [2:-2]"); for (a = [2:-2]) echo ("[a08] ", a);
+
+echo("[b01] ----- [1:1:5]"); for (a = [1:1:5]) echo ("[b01] ", a);
+echo("[b02] ----- [1:2:5]"); for (a = [1:2:5]) echo ("[b02] ", a);
+echo("[b03] ----- [1:-1:5]"); for (a = [1:-1:5]) echo ("[b03] ", a);
+echo("[b04] ----- [5:1:1]"); for (a = [5:1:1]) echo ("[b04] ", a);
+echo("[b05] ----- [5:2:1]"); for (a = [5:2:1]) echo ("[b05] ", a);
+echo("[b06] ----- [5:-1:1]"); for (a = [5:-1:1]) echo ("[b06] ", a);
+echo("[b07] ----- [0:0:0]"); for (a = [0:0:0]) echo ("[b07] ", a);
+echo("[b08] ----- [1:0:1]"); for (a = [1:0:1]) echo ("[b08] ", a);
+echo("[b09] ----- [1:0:5]"); for (a = [1:0:5]) echo ("[b09] ", a);
+echo("[b10] ----- [0:1:0]"); for (a = [0:1:0]) echo ("[b10] ", a);
+echo("[b11] ----- [3:-.5:-3]"); for (a = [3:-.5:-3]) echo ("[b11] ", a);
contact: Jan Huwald // Impressum