summaryrefslogtreecommitdiff
path: root/testdata
diff options
context:
space:
mode:
authorMarius Kintel <marius@kintel.net>2013-05-22 01:26:51 (GMT)
committerMarius Kintel <marius@kintel.net>2013-05-22 01:26:51 (GMT)
commit71ab237aada8db602045063f0f1c6082ef06972a (patch)
treeb946aee64d9a253d79bdceb8b74c930a1876dca5 /testdata
parentfab07bafdaacf931314673e396111a9670dccc0e (diff)
Added tests for linear extrude with scale. Should mostly fix #273
Diffstat (limited to 'testdata')
-rw-r--r--testdata/scad/features/linear_extrude-scale-tests.scad17
-rw-r--r--testdata/scad/features/linear_extrude-scale-zero-tests.scad56
-rw-r--r--testdata/scad/features/linear_extrude-tests.scad11
3 files changed, 66 insertions, 18 deletions
diff --git a/testdata/scad/features/linear_extrude-scale-tests.scad b/testdata/scad/features/linear_extrude-scale-tests.scad
deleted file mode 100644
index 9a82c9d..0000000
--- a/testdata/scad/features/linear_extrude-scale-tests.scad
+++ /dev/null
@@ -1,17 +0,0 @@
-difference() {
- linear_extrude(height=40, scale=[0, 0]) {
- square(10, center=true);
- translate([10,0]) circle(10);
- }
- translate([0,0,35]) sphere(10);
-}
-
-/*
-Test case ideas:
-o off-center starting point
-o Concave polygon
-o Disjoint polygons
-o multi-rotation twist
-o zero scales, zero scales in only one axis (for the above cases)
-o boolean operations on scaled extrusion (including zero scale)
-*/
diff --git a/testdata/scad/features/linear_extrude-scale-zero-tests.scad b/testdata/scad/features/linear_extrude-scale-zero-tests.scad
new file mode 100644
index 0000000..8a85203
--- /dev/null
+++ b/testdata/scad/features/linear_extrude-scale-zero-tests.scad
@@ -0,0 +1,56 @@
+// test cases for linear extrude with scale
+// by TakeItAndRun 2013
+
+// syntax: linear_extrude(height=a, slices=b, twist=c, scale=[x,y])
+
+a=3;
+b=20;
+c=0;
+x=1;
+y=1;
+
+module linear_extrudes_of_different_shapes(a=a,b=b,c=c,x=x,y=y) {
+ translate(00*[4,0,0])
+ // linear_extrude of shape with hole
+ linear_extrude(height=a, slices=b, twist=c, scale=[x,y])
+ difference() {
+ square(2,true); square(1,true);
+ }
+
+ translate(01*[4,0,0])
+ // linear_extrude of disjoint polygons shapes
+ linear_extrude(height=a, slices=b, twist=c, scale=[x,y]) {
+ translate([1,0,0]) square(1,true);
+ translate([-1,0,0]) square(1,true);
+ }
+
+ translate(02*[4,0,0])
+ // linear_extrude with a coplanar face
+ linear_extrude(height=a, slices=b, twist=c, scale=[x,y]) {
+ translate([.5,0,0])square();
+ translate([-.5,0,0])square();
+ }
+
+ translate(03*[4,0,0])
+ // linear_extrude with internal hole and one coplanar edge
+ linear_extrude(height=a, slices=b, twist=c, scale=[x,y])
+ difference() {
+ square(2,true);
+ translate([-0.5,0,0]) square(1,true);
+ }
+}
+
+
+// Test varying parameters
+translate(00*[0,3,0])
+linear_extrudes_of_different_shapes(c=0,x=0,y=y);
+translate(01*[0,3,0])
+linear_extrudes_of_different_shapes(c=0,x=x,y=0);
+translate(02*[0,3,0])
+linear_extrudes_of_different_shapes(c=0,x=0,y=0);
+translate(03*[0,3,0])
+linear_extrudes_of_different_shapes(c=180,x=0,y=y);
+translate(04*[0,3,0])
+linear_extrudes_of_different_shapes(c=180,x=x,y=0);
+translate(05*[0,3,0])
+linear_extrudes_of_different_shapes(c=180,x=0,y=0);
diff --git a/testdata/scad/features/linear_extrude-tests.scad b/testdata/scad/features/linear_extrude-tests.scad
index 67d892f..528eea2 100644
--- a/testdata/scad/features/linear_extrude-tests.scad
+++ b/testdata/scad/features/linear_extrude-tests.scad
@@ -12,4 +12,13 @@ translate([31.5,2.5,0]) linear_extrude(height=10, twist=-45) polygon(points = [[
translate([0,20,0]) linear_extrude(height=20, twist=45, slices=2) square([10,10]);
translate([19,20,0]) linear_extrude(height=20, twist=45, slices=10) square([10,10]);
-translate([-15,0,0]) linear_extrude(5) square([10,10]);
+translate([0,-15,0]) linear_extrude(5) square([10,10]);
+
+// scale given as a scalar
+translate([-25,-10,0]) linear_extrude(height=10, scale=2) square(5, center=true);
+// scale given as a 3-dim vector
+translate([-15,20,0]) linear_extrude(height=20, scale=[4,5,6]) square(10);
+// scale is negative
+translate([-10,5,0]) linear_extrude(height=15, scale=-2) square(10, center=true);
+// scale given as undefined
+translate([-15,-15,0]) linear_extrude(height=10, scale=var_undef) square(10);
contact: Jan Huwald // Impressum