fix tests to agree with code

This commit is contained in:
Adrian Mariano 2023-03-25 01:09:55 -04:00
parent af53674c4e
commit 83b09c259f

View file

@ -34,12 +34,12 @@ test_sphere();
module test_prismoid() {
$fn=24;
assert_approx(prismoid([100,80],[50,40],h=50), [[[25,20,50],[25,-20,50],[-25,-20,50],[-25,20,50],[50,40,0],[50,-40,0],[-50,-40,0],[-50,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],[4,7,6],[4,6,5]]]);
assert_approx(prismoid([100,80],[50,40],h=50,anchor=BOT), [[[25,20,50],[25,-20,50],[-25,-20,50],[-25,20,50],[50,40,0],[50,-40,0],[-50,-40,0],[-50,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],[4,7,6],[4,6,5]]]);
assert_approx(prismoid([100,80],[0,0],h=50,anchor=BOT), [[[0.000030517578125,0.000030517578125,50],[0.000030517578125,-0.000030517578125,50],[-0.000030517578125,-0.000030517578125,50],[-0.000030517578125,0.000030517578125,50],[50,40,0],[50,-40,0],[-50,-40,0],[-50,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],[4,7,6],[4,6,5]]]);
assert_approx(prismoid([100,80],[40,50],h=50,anchor=BOT), [[[20,25,50],[20,-25,50],[-20,-25,50],[-20,25,50],[50,40,0],[50,-40,0],[-50,-40,0],[-50,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],[4,7,6],[4,6,5]]]);
assert_approx(prismoid([100,80],[40,50],h=50,anchor=TOP+RIGHT), [[[0,25,0],[0,-25,0],[-40,-25,0],[-40,25,0],[30,40,-50],[30,-40,-50],[-70,-40,-50],[-70,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],[4,7,6],[4,6,5]]]);
assert_approx(prismoid([100,80],[40,50],h=50,shift=[10,5]), [[[30,30,50],[30,-20,50],[-10,-20,50],[-10,30,50],[50,40,0],[50,-40,0],[-50,-40,0],[-50,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],[4,7,6],[4,6,5]]]);
assert_approx(prismoid([100,80],[50,40],h=50),[[[50,-40,0],[-50,-40,0],[-50,40,0],[50,40,0],[25,-20,50],[-25,-20,50],[-25,20,50],[25,20,50]],[[3,4,7],[4,6,7],[6,3,7],[4,5,6],[5,2,6],[2,3,6],[4,1,5],[1,2,5],[4,0,1],[0,2,1],[0,3,2],[4,3,0]]]);
assert_approx(prismoid([100,80],[50,40],h=50,anchor=BOT),[[[50, -40, 0], [-50, -40, 0], [-50, 40, 0], [50, 40, 0], [25, -20, 50], [-25, -20, 50], [-25, 20, 50], [25, 20, 50]], [[3, 4, 7], [4, 6, 7], [6, 3, 7], [4, 5, 6], [5, 2, 6], [2, 3, 6], [4, 1, 5], [1, 2, 5], [4, 0, 1], [0, 2, 1], [0, 3, 2], [4, 3, 0]]]);
assert_approx(prismoid([100,80],[0,0],h=50,anchor=BOT),[[[50, -40, 0], [-50, -40, 0], [-50, 40, 0], [50, 40, 0], [0, 0, 50], [0, 0, 50], [0, 0, 50], [0, 0, 50]], [[2, 4, 1], [4, 0, 1], [0, 2, 1], [0, 3, 2], [4, 3, 0], [3, 4, 2]]]);
assert_approx(prismoid([100,80],[40,50],h=50,anchor=BOT),[[[50, -40, 0], [-50, -40, 0], [-50, 40, 0], [50, 40, 0], [20, -25, 50], [-20, -25, 50], [-20, 25, 50], [20, 25, 50]], [[3, 4, 7], [4, 6, 7], [6, 3, 7], [4, 5, 6], [5, 2, 6], [2, 3, 6], [4, 1, 5], [1, 2, 5], [4, 0, 1], [0, 2, 1], [0, 3, 2], [4, 3, 0]]]);
assert_approx(prismoid([100,80],[40,50],h=50,anchor=TOP+RIGHT), [[[30, -40, -50], [-70, -40, -50], [-70, 40, -50], [30, 40, -50], [0, -25, 0], [-40, -25, 0], [-40, 25, 0], [0, 25, 0]], [[3, 4, 7], [4, 6, 7], [6, 3, 7], [4, 5, 6], [5, 2, 6], [2, 3, 6], [4, 1, 5], [1, 2, 5], [4, 0, 1], [0, 2, 1], [0, 3, 2], [4, 3, 0]]]);
assert_approx(prismoid([100,80],[40,50],h=50,shift=[10,5]), [[[50, -40, 0], [-50, -40, 0], [-50, 40, 0], [50, 40, 0], [30, -20, 50], [-10, -20, 50], [-10, 30, 50], [30, 30, 50]], [[2, 7, 6], [7, 5, 6], [5, 2, 6], [7, 4, 5], [4, 1, 5], [1, 2, 5], [7, 0, 4], [0, 1, 4], [0, 7, 3], [7, 2, 3], [2, 0, 3], [2, 1, 0]]]);
assert_approx(prismoid([100,80],[40,50],h=50,shift=[10,5],chamfer=5), [[[50,-35,0],[45,-40,0],[-45,-40,0],[-50,-35,0],[-50,35,0],[-45,40,0],[45,40,0],[50,35,0],[30,-15,50],[25,-20,50],[-5,-20,50],[-10,-15,50],[-10,25,50],[-5,30,50],[25,30,50],[30,25,50]],[[14,7,15],[7,8,15],[8,14,15],[5,14,13],[14,12,13],[12,5,13],[14,11,12],[11,4,12],[4,5,12],[14,10,11],[3,4,11],[10,3,11],[2,3,10],[9,2,10],[14,9,10],[14,8,9],[1,2,9],[8,1,9],[7,0,8],[0,1,8],[14,6,7],[6,0,7],[14,5,6],[5,0,6],[4,0,5],[2,4,3],[1,4,2],[4,1,0]]]);
assert_approx(prismoid([100,80],[40,50],h=50,shift=[10,5],chamfer1=5), [[[50,-35,0],[45,-40,0],[-45,-40,0],[-50,-35,0],[-50,35,0],[-45,40,0],[45,40,0],[50,35,0],[30,-20,50],[-10,-20,50],[-10,30,50],[30,30,50]],[[11,9,10],[9,4,10],[4,5,10],[5,11,10],[2,3,9],[8,2,9],[11,8,9],[3,4,9],[1,2,8],[11,0,8],[0,1,8],[0,11,7],[11,6,7],[6,0,7],[11,5,6],[5,0,6],[4,0,5],[2,4,3],[1,4,2],[4,1,0]]]);
assert_approx(prismoid([100,80],[40,50],h=50,shift=[10,5],chamfer2=5), [[[50,-40,0],[-50,-40,0],[-50,40,0],[50,40,0],[30,-15,50],[25,-20,50],[-5,-20,50],[-10,-15,50],[-10,25,50],[-5,30,50],[25,30,50],[30,25,50]],[[10,3,11],[3,4,11],[4,10,11],[2,10,9],[10,8,9],[8,2,9],[10,7,8],[7,2,8],[1,2,7],[6,1,7],[10,6,7],[10,5,6],[5,1,6],[10,4,5],[0,1,5],[4,0,5],[3,0,4],[10,2,3],[2,0,3],[2,1,0]]]);