diff --git a/tests/test_geometry.scad b/tests/test_geometry.scad index 4706c7f..e800c19 100644 --- a/tests/test_geometry.scad +++ b/tests/test_geometry.scad @@ -842,7 +842,7 @@ module test_centroid() { // VNFs assert_approx(centroid(cube(100, center=false)), [50,50,50]); assert_approx(centroid(cube(100, center=true)), [0,0,0]); - assert_approx(centroid(cube(100, anchor=ALLPOS)), [-50,-50,-50]); + assert_approx(centroid(cube(100, anchor=[1,1,1])), [-50,-50,-50]); assert_approx(centroid(cube(100, anchor=BOT)), [0,0,50]); assert_approx(centroid(cube(100, anchor=TOP)), [0,0,-50]); assert_approx(centroid(sphere(d=100, anchor=CENTER, $fn=36)), [0,0,0]); diff --git a/tests/test_shapes2d.scad b/tests/test_shapes2d.scad index 5260810..251d902 100644 --- a/tests/test_shapes2d.scad +++ b/tests/test_shapes2d.scad @@ -28,9 +28,12 @@ test_circle(); module test_rect() { assert_equal(rect(100,anchor=CENTER), [[50,-50],[-50,-50],[-50,50],[50,50]]); - assert_equal(rect(100), [[100,0],[0,0],[0,100],[100,100]]); - assert_equal(rect([100,80]), [[100,0],[0,0],[0,80],[100,80]]); + assert_equal(rect(100), [[50,-50],[-50,-50],[-50,50],[50,50]]); + assert_equal(rect(100,center=false), [[100,0],[0,0],[0,100],[100,100]]); + assert_equal(rect([100,80],center=false), [[100,0],[0,0],[0,80],[100,80]]); assert_equal(rect([100,80],anchor=CENTER), [[50,-40],[-50,-40],[-50,40],[50,40]]); + assert_equal(rect([100,80]), [[50,-40],[-50,-40],[-50,40],[50,40]]); + assert_equal(rect([100,80],center=true), [[50,-40],[-50,-40],[-50,40],[50,40]]); assert_equal(rect([100,80],anchor=FRONT+LEFT), [[100,0],[0,0],[0,80],[100,80]]); assert_equal(rect([100,80],anchor=BACK+RIGHT), [[0,-80],[-100,-80],[-100,0],[0,0]]); assert_approx(rect([100,80],rounding=10,anchor=CENTER,$fn=12), [[50,-30],[48.6602540378,-35],[45,-38.6602540378],[40,-40],[-40,-40],[-45,-38.6602540378],[-48.6602540378,-35],[-50,-30],[-50,30],[-48.6602540378,35],[-45,38.6602540378],[-40,40],[40,40],[45,38.6602540378],[48.6602540378,35],[50,30]]); diff --git a/tests/test_shapes3d.scad b/tests/test_shapes3d.scad index c102351..33b744b 100644 --- a/tests/test_shapes3d.scad +++ b/tests/test_shapes3d.scad @@ -8,7 +8,7 @@ module test_cube() { assert_equal(cube([60,80,100],anchor=CENTER), [[[-30,-40,-50],[30,-40,-50],[30,40,-50],[-30,40,-50],[-30,-40,50],[30,-40,50],[30,40,50],[-30,40,50]],[[0,1,2],[0,2,3],[0,4,5],[0,5,1],[1,5,6],[1,6,2],[2,6,7],[2,7,3],[3,7,4],[3,4,0],[6,4,7],[6,5,4]]]); assert_equal(cube([60,80,100],center=false), [[[0,0,0],[60,0,0],[60,80,0],[0,80,0],[0,0,100],[60,0,100],[60,80,100],[0,80,100]],[[0,1,2],[0,2,3],[0,4,5],[0,5,1],[1,5,6],[1,6,2],[2,6,7],[2,7,3],[3,7,4],[3,4,0],[6,4,7],[6,5,4]]]); assert_equal(cube([60,80,100]), [[[0,0,0],[60,0,0],[60,80,0],[0,80,0],[0,0,100],[60,0,100],[60,80,100],[0,80,100]],[[0,1,2],[0,2,3],[0,4,5],[0,5,1],[1,5,6],[1,6,2],[2,6,7],[2,7,3],[3,7,4],[3,4,0],[6,4,7],[6,5,4]]]); - assert_equal(cube([60,80,100],anchor=ALLNEG), [[[0,0,0],[60,0,0],[60,80,0],[0,80,0],[0,0,100],[60,0,100],[60,80,100],[0,80,100]],[[0,1,2],[0,2,3],[0,4,5],[0,5,1],[1,5,6],[1,6,2],[2,6,7],[2,7,3],[3,7,4],[3,4,0],[6,4,7],[6,5,4]]]); + assert_equal(cube([60,80,100],anchor=-[1,1,1]), [[[0,0,0],[60,0,0],[60,80,0],[0,80,0],[0,0,100],[60,0,100],[60,80,100],[0,80,100]],[[0,1,2],[0,2,3],[0,4,5],[0,5,1],[1,5,6],[1,6,2],[2,6,7],[2,7,3],[3,7,4],[3,4,0],[6,4,7],[6,5,4]]]); assert_equal(cube([60,80,100],anchor=TOP), [[[-30,-40,-100],[30,-40,-100],[30,40,-100],[-30,40,-100],[-30,-40,0],[30,-40,0],[30,40,0],[-30,40,0]],[[0,1,2],[0,2,3],[0,4,5],[0,5,1],[1,5,6],[1,6,2],[2,6,7],[2,7,3],[3,7,4],[3,4,0],[6,4,7],[6,5,4]]]); } test_cube(); diff --git a/tests/test_utility.scad b/tests/test_utility.scad index 0ceddb0..250c082 100644 --- a/tests/test_utility.scad +++ b/tests/test_utility.scad @@ -352,12 +352,12 @@ test_all_defined(); module test_get_anchor() { - assert_equal(get_anchor(UP,true,ALLNEG,BOT),CENTER); - assert_equal(get_anchor(UP,false,ALLNEG,BOT),ALLNEG); - assert_equal(get_anchor(UP,undef,ALLNEG,BOT),UP); - assert_equal(get_anchor(undef,true,ALLNEG,BOT),CENTER); - assert_equal(get_anchor(undef,false,ALLNEG,BOT),ALLNEG); - assert_equal(get_anchor(undef,undef,ALLNEG,BOT),BOT); + assert_equal(get_anchor(UP,true,-[1,1,1],BOT),CENTER); + assert_equal(get_anchor(UP,false,-[1,1,1],BOT),-[1,1,1]); + assert_equal(get_anchor(UP,undef,-[1,1,1],BOT),UP); + assert_equal(get_anchor(undef,true,-[1,1,1],BOT),CENTER); + assert_equal(get_anchor(undef,false,-[1,1,1],BOT),-[1,1,1]); + assert_equal(get_anchor(undef,undef,-[1,1,1],BOT),BOT); } test_get_anchor();