@@ -28,65 +28,68 @@ def test_extrude_along_path(self):
2828 path = [[0 , 0 , 0 ], [0 , 20 , 0 ]]
2929 # basic test
3030 actual = extrude_along_path (tri , path )
31- expected = 'polyhedron(faces = [[0, 3, 1], [1, 3, 4], [1, 4, 2], [2, 4, 5], [2, 5, 0], [0, 5, 3], [6, 0, 1], [6, 1, 2], [6, 2, 0], [7, 3, 4], [7, 4, 5], [7, 5, 3]], points = [[0.0000000000, 0.0000000000, 0.0000000000], [10.0000000000, 0.0000000000, 0.0000000000], [0.0000000000, 0.0000000000, 10.0000000000], [0.0000000000, 20.0000000000, 0.0000000000], [10.0000000000, 20.0000000000, 0.0000000000], [0.0000000000, 20.0000000000, 10.0000000000], [3.3333333333, 0.0000000000, 3.3333333333], [3.3333333333, 20.0000000000, 3.3333333333]] );'
31+ expected = 'polyhedron(faces= [[0,1,3], [1,4,3],[1,2,4], [2,5,4],[2,0,5],[0,3,5],[2,1, 0],[3,4,5]], points= [[0.0000000000,0.0000000000,0.0000000000],[10.0000000000,0.0000000000,0.0000000000],[0.0000000000,0.0000000000,10.0000000000],[0.0000000000,20.0000000000,0.0000000000],[10.0000000000,20.0000000000,0.0000000000],[0.0000000000,20.0000000000,10.0000000000]] );'
3232 self .assertEqualOpenScadObject (expected , actual )
3333
3434 def test_extrude_along_path_vertical (self ):
3535 # make sure we still look good extruding along z axis; gimbal lock can mess us up
3636 vert_path = [[0 , 0 , 0 ], [0 , 0 , 20 ]]
3737 actual = extrude_along_path (tri , vert_path )
38- expected = 'polyhedron(faces=[[0,3,1],[1,3,4 ],[1,4,2 ],[2,4,5 ],[2,5,0 ],[0,5,3 ],[6,0,1],[6,1,2 ],[6,2, 0],[7, 3,4],[7,4,5],[7,5,3]] ,points=[[0.0000000000,0.0000000000,0.0000000000],[-10.0000000000,0.0000000000,0.0000000000],[0.0000000000,10.0000000000,0.0000000000],[0.0000000000,0.0000000000,20.0000000000],[-10.0000000000,0.0000000000,20.0000000000],[0.0000000000,10.0000000000,20.0000000000],[-3.3333333333,3.3333333333,0.0000000000],[-3.3333333333,3.3333333333,20.0000000000]]); '
38+ expected = 'polyhedron(faces=[[0,1,3 ],[1,4,3 ],[1, 2,4],[2,5,4 ],[2, 0,5],[0,3,5 ],[2,1, 0],[3,4,5]] ,points=[[0.0000000000,0.0000000000,0.0000000000],[-10.0000000000,0.0000000000,0.0000000000],[0.0000000000,10.0000000000,0.0000000000],[0.0000000000,0.0000000000,20.0000000000],[-10.0000000000,0.0000000000,20.0000000000],[0.0000000000,10.0000000000,20.0000000000]]); '
3939 self .assertEqualOpenScadObject (expected , actual )
4040
4141 def test_extrude_along_path_1d_scale (self ):
4242 # verify that we can apply scalar scaling
4343 path = [[0 , 0 , 0 ], [0 , 20 , 0 ]]
4444 scales_1d = [1.5 , 0.5 ]
4545 actual = extrude_along_path (tri , path , scales = scales_1d )
46- expected = 'polyhedron(faces=[[0,3,1],[1,3,4],[1,4,2],[2,4,5],[2,5,0],[0,5,3],[6,0,1],[6,1,2],[6,2,0],[7,3,4],[7,4,5],[7,5,3]],points=[[0.0000000000,0.0000000000,0.0000000000],[15.0000000000,0.0000000000,0.0000000000],[0.0000000000,0.0000000000,15.0000000000],[0.0000000000,20.0000000000,0.0000000000],[5.0000000000,20.0000000000,0.0000000000],[0.0000000000,20.0000000000,5.0000000000],[5.0000000000,0.0000000000,5.0000000000],[1.6666666667,20.0000000000,1.6666666667]]);'
46+ expected = 'polyhedron(faces=[[0,1,3],[1,4,3],[1,2,4],[2,5,4],[2,0,5],[0,3,5],[2,1,0],[3,4,5]],points=[[0.0000000000,0.0000000000,0.0000000000],[15.0000000000,0.0000000000,0.0000000000],[0.0000000000,0.0000000000,15.0000000000],[0.0000000000,20.0000000000,0.0000000000],[5.0000000000,20.0000000000,0.0000000000],[0.0000000000,20.0000000000,5.0000000000]]);'
47+ print ('test_extrude_along_path_1d_scale' )
48+
4749 self .assertEqualOpenScadObject (expected , actual )
4850
4951 def test_extrude_along_path_2d_scale (self ):
5052 # verify that we can apply differential x & y scaling
5153 path = [[0 , 0 , 0 ], [0 , 20 , 0 ], [0 , 40 , 0 ]]
5254 scales_2d = [Point2 (1 ,1 ), Point2 (0.5 , 1.5 ), Point2 (1.5 , 0.5 ), ]
5355 actual = extrude_along_path (tri , path , scales = scales_2d )
54- expected = 'polyhedron(faces=[[0,3,1],[1,3,4 ],[1,4,2 ],[2,4,5 ],[2,5,0 ],[0,5,3 ],[3,6,4 ],[4,6,7 ],[4,7,5 ],[5,7,8 ],[5,8,3 ],[3,8,6 ],[9,0,1 ],[9 ,1,2],[9,2, 0],[10, 6,7],[10,7,8],[10,8,6]] ,points=[[0.0000000000,0.0000000000,0.0000000000],[10.0000000000,0.0000000000,0.0000000000],[0.0000000000,0.0000000000,10.0000000000],[0.0000000000,20.0000000000,0.0000000000],[5.0000000000,20.0000000000,0.0000000000],[0.0000000000,20.0000000000,15.0000000000],[0.0000000000,40.0000000000,0.0000000000],[15.0000000000,40.0000000000,0.0000000000],[0.0000000000,40.0000000000,5.0000000000],[3.3333333333,0.0000000000,3.3333333333],[5.0000000000,40.0000000000,1.6666666667 ]]);'
56+ expected = 'polyhedron(faces=[[0,1,3 ],[1,4,3 ],[1, 2,4],[2,5,4 ],[2, 0,5],[0,3,5 ],[3, 4,6],[4,7,6 ],[4, 5,7],[5,8,7 ],[5, 3,8],[3,6,8 ],[2 ,1,0],[6,7,8]] ,points=[[0.0000000000,0.0000000000,0.0000000000],[10.0000000000,0.0000000000,0.0000000000],[0.0000000000,0.0000000000,10.0000000000],[0.0000000000,20.0000000000,0.0000000000],[5.0000000000,20.0000000000,0.0000000000],[0.0000000000,20.0000000000,15.0000000000],[0.0000000000,40.0000000000,0.0000000000],[15.0000000000,40.0000000000,0.0000000000],[0.0000000000,40.0000000000,5.0000000000]]);'
5557 self .assertEqualOpenScadObject (expected , actual )
5658
5759 def test_extrude_along_path_2d_scale_list_input (self ):
5860 # verify that we can apply differential x & y scaling
5961 path = [[0 , 0 , 0 ], [0 , 20 , 0 ], [0 , 40 , 0 ]]
6062 scales_2d = [(1 ,1 ), (0.5 , 1.5 ), (1.5 , 0.5 ), ]
6163 actual = extrude_along_path (tri , path , scales = scales_2d )
62- expected = 'polyhedron(faces=[[0,3,1],[1,3,4 ],[1,4,2 ],[2,4,5 ],[2,5,0 ],[0,5,3 ],[3,6,4 ],[4,6,7 ],[4,7,5 ],[5,7,8 ],[5,8,3 ],[3,8,6 ],[9,0,1 ],[9 ,1,2],[9,2, 0],[10, 6,7],[10,7,8],[10,8,6]] ,points=[[0.0000000000,0.0000000000,0.0000000000],[10.0000000000,0.0000000000,0.0000000000],[0.0000000000,0.0000000000,10.0000000000],[0.0000000000,20.0000000000,0.0000000000],[5.0000000000,20.0000000000,0.0000000000],[0.0000000000,20.0000000000,15.0000000000],[0.0000000000,40.0000000000,0.0000000000],[15.0000000000,40.0000000000,0.0000000000],[0.0000000000,40.0000000000,5.0000000000],[3.3333333333,0.0000000000,3.3333333333],[5.0000000000,40.0000000000,1.6666666667 ]]);'
64+ expected = 'polyhedron(faces=[[0,1,3 ],[1,4,3 ],[1, 2,4],[2,5,4 ],[2, 0,5],[0,3,5 ],[3, 4,6],[4,7,6 ],[4, 5,7],[5,8,7 ],[5, 3,8],[3,6,8 ],[2 ,1,0],[6,7,8]] ,points=[[0.0000000000,0.0000000000,0.0000000000],[10.0000000000,0.0000000000,0.0000000000],[0.0000000000,0.0000000000,10.0000000000],[0.0000000000,20.0000000000,0.0000000000],[5.0000000000,20.0000000000,0.0000000000],[0.0000000000,20.0000000000,15.0000000000],[0.0000000000,40.0000000000,0.0000000000],[15.0000000000,40.0000000000,0.0000000000],[0.0000000000,40.0000000000,5.0000000000]]);'
6365 self .assertEqualOpenScadObject (expected , actual )
6466
6567 def test_extrude_along_path_end_caps (self ):
6668 path = [[0 , 0 , 0 ], [0 , 20 , 0 ]]
6769 actual = scad_render (extrude_along_path (tri , path , connect_ends = False ))
68- expected = 'polyhedron(faces = [[0, 3, 1], [1, 3, 4], [1, 4, 2], [2, 4, 5], [2, 5, 0], [0, 5, 3], [6, 0, 1], [6, 1, 2], [6, 2, 0], [7, 3, 4], [7, 4, 5], [7, 5, 3]], points = [[0.0000000000, 0.0000000000, 0.0000000000], [10.0000000000, 0.0000000000, 0.0000000000], [0.0000000000, 0.0000000000, 10.0000000000], [0.0000000000, 20.0000000000, 0.0000000000], [10.0000000000, 20.0000000000, 0.0000000000], [0.0000000000, 20.0000000000, 10.0000000000], [3.3333333333, 0.0000000000, 3.3333333333], [3.3333333333, 20.0000000000, 3.3333333333]]); '
70+ expected = 'polyhedron(faces= [[0,1,3], [1,4,3],[1,2,4], [2,5,4],[2,0,5],[0,3,5],[2,1, 0],[3,4,5]], points= [[0.0000000000,0.0000000000,0.0000000000],[10.0000000000,0.0000000000,0.0000000000],[0.0000000000,0.0000000000,10.0000000000],[0.0000000000,20.0000000000,0.0000000000],[10.0000000000,20.0000000000,0.0000000000],[0.0000000000,20.0000000000,10.0000000000]]); '
6971 self .assertEqualNoWhitespace (expected , actual )
7072
7173 def test_extrude_along_path_connect_ends (self ):
7274 path = [[0 , 0 , 0 ], [20 , 0 , 0 ], [20 ,20 ,0 ], [0 ,20 , 0 ]]
7375 actual = extrude_along_path (tri , path , connect_ends = True )
74- expected = 'polyhedron(faces=[[0,3,1],[1,3,4 ],[1,4,2 ],[2,4,5 ],[2,5,0 ],[0,5,3 ],[3,6,4 ],[4,6,7 ],[4,7,5 ],[5,7,8 ],[5,8,3 ],[3,8,6 ],[6,9,7 ],[7,9,10 ],[7,10,8 ],[8,10,11 ],[8,11,6 ],[6,11,9 ],[0 ,9,1 ],[1, 9,10],[1, 10,2 ],[2, 10,11],[2, 11,0 ],[0,11,9 ]],points=[[0.0000000000,0.0000000000,0.0000000000],[-7.0710678119,-7.0710678119,0.0000000000],[0.0000000000,0.0000000000,10.0000000000],[20.0000000000,0.0000000000,0.0000000000],[27.0710678119,-7.0710678119,0.0000000000],[20.0000000000,0.0000000000,10.0000000000],[20.0000000000,20.0000000000,0.0000000000],[27.0710678119,27.0710678119,0.0000000000],[20.0000000000,20.0000000000,10.0000000000],[0.0000000000,20.0000000000,0.0000000000],[-7.0710678119,27.0710678119,0.0000000000],[0.0000000000,20.0000000000,10.0000000000]]);'
76+ expected = 'polyhedron(faces=[[0,1,3 ],[1,4,3 ],[1, 2,4],[2,5,4 ],[2, 0,5],[0,3,5 ],[3, 4,6],[4,7,6 ],[4, 5,7],[5,8,7 ],[5, 3,8],[3,6,8 ],[6, 7,9],[7,10,9 ],[7, 8,10],[8,11,10 ],[8, 6,11],[6 ,9,11 ],[9,10,0 ],[10,1,0 ],[10,11,1 ],[11,2,1],[ 11,9,2 ],[9,0,2 ]],points=[[0.0000000000,0.0000000000,0.0000000000],[-7.0710678119,-7.0710678119,0.0000000000],[0.0000000000,0.0000000000,10.0000000000],[20.0000000000,0.0000000000,0.0000000000],[27.0710678119,-7.0710678119,0.0000000000],[20.0000000000,0.0000000000,10.0000000000],[20.0000000000,20.0000000000,0.0000000000],[27.0710678119,27.0710678119,0.0000000000],[20.0000000000,20.0000000000,10.0000000000],[0.0000000000,20.0000000000,0.0000000000],[-7.0710678119,27.0710678119,0.0000000000],[0.0000000000,20.0000000000,10.0000000000]]); '
7577 self .assertEqualOpenScadObject (expected , actual )
7678
7779 def test_extrude_along_path_rotations (self ):
80+
7881 # confirm we can rotate for each point in path
7982 path = [[0 ,0 ,0 ], [20 , 0 ,0 ]]
8083 rotations = [- 45 , 45 ]
8184 actual = extrude_along_path (tri , path , rotations = rotations )
82- expected = 'polyhedron(faces=[[0,3,1],[1,3,4 ],[1,4,2 ],[2,4,5 ],[2,5,0 ],[0,5,3 ],[6,0,1],[6,1,2 ],[6,2, 0],[7, 3,4],[7,4,5],[7,5,3]] ,points=[[0.0000000000,0.0000000000,0.0000000000],[0.0000000000,-7.0710678119,-7.0710678119],[0.0000000000,-7.0710678119,7.0710678119],[20.0000000000,0.0000000000,0.0000000000],[20.0000000000,-7.0710678119,7.0710678119],[20.0000000000,7.0710678119,7.0710678119],[0.0000000000,-4.7140452079,0.0000000000],[20.0000000000,-0.0000000000,4.7140452079]]); '
85+ expected = 'polyhedron(faces=[[0,1,3 ],[1,4,3 ],[1, 2,4],[2,5,4 ],[2, 0,5],[0,3,5 ],[2,1, 0],[3,4,5]] ,points=[[0.0000000000,0.0000000000,0.0000000000],[0.0000000000,-7.0710678119,-7.0710678119],[0.0000000000,-7.0710678119,7.0710678119],[20.0000000000,0.0000000000,0.0000000000],[20.0000000000,-7.0710678119,7.0710678119],[20.0000000000,7.0710678119,7.0710678119]]); '
8386 self .assertEqualOpenScadObject (expected , actual )
8487
8588 # confirm we can rotate with a single supplied value
8689 path = [[0 ,0 ,0 ], [20 , 0 ,0 ]]
8790 rotations = [45 ]
8891 actual = extrude_along_path (tri , path , rotations = rotations )
89- expected = 'polyhedron(faces=[[0,3,1],[1,3,4 ],[1,4,2 ],[2,4,5 ],[2,5,0 ],[0,5,3 ],[6,0,1],[6,1,2 ],[6,2, 0],[7, 3,4],[7,4,5],[7,5,3]] ,points=[[0.0000000000,0.0000000000,0.0000000000],[0.0000000000,-10.0000000000,0.0000000000],[0.0000000000,0.0000000000,10.0000000000],[20.0000000000,0.0000000000,0.0000000000],[20.0000000000,-7.0710678119,7.0710678119],[20.0000000000,7.0710678119,7.0710678119],[0.0000000000,-3.3333333333,3.3333333333],[20.0000000000,-0.0000000000,4.7140452079]]); '
92+ expected = 'polyhedron(faces=[[0,1,3 ],[1,4,3 ],[1, 2,4],[2,5,4 ],[2, 0,5],[0,3,5 ],[2,1, 0],[3,4,5]] ,points=[[0.0000000000,0.0000000000,0.0000000000],[0.0000000000,-10.0000000000,0.0000000000],[0.0000000000,0.0000000000,10.0000000000],[20.0000000000,0.0000000000,0.0000000000],[20.0000000000,-7.0710678119,7.0710678119],[20.0000000000,7.0710678119,7.0710678119]]); '
9093 self .assertEqualOpenScadObject (expected , actual )
9194
9295 def test_extrude_along_path_transforms (self ):
@@ -95,13 +98,13 @@ def test_extrude_along_path_transforms(self):
9598 # Make sure we can take a transform function for each point in path
9699 transforms = [lambda p , path , loop : 2 * p , lambda p , path , loop : 0.5 * p ]
97100 actual = extrude_along_path (tri , path , transforms = transforms )
98- expected = 'polyhedron(faces=[[0,3,1],[1,3,4 ],[1,4,2 ],[2,4,5 ],[2,5,0 ],[0,5,3 ],[6,0,1],[6,1,2 ],[6,2, 0],[7, 3,4],[7,4,5],[7,5,3]] ,points=[[0.0000000000,0.0000000000,0.0000000000],[0.0000000000,-20.0000000000,0.0000000000],[0.0000000000,0.0000000000,20.0000000000],[20.0000000000,0.0000000000,0.0000000000],[20.0000000000,-5.0000000000,0.0000000000],[20.0000000000,0.0000000000,5.0000000000],[0.0000000000,-6.6666666667,6.6666666667],[20.0000000000,-1.6666666667,1.6666666667]]); '
101+ expected = 'polyhedron(faces=[[0,1,3 ],[1,4,3 ],[1, 2,4],[2,5,4 ],[2, 0,5],[0,3,5 ],[2,1, 0],[3,4,5]] ,points=[[0.0000000000,0.0000000000,0.0000000000],[0.0000000000,-20.0000000000,0.0000000000],[0.0000000000,0.0000000000,20.0000000000],[20.0000000000,0.0000000000,0.0000000000],[20.0000000000,-5.0000000000,0.0000000000],[20.0000000000,0.0000000000,5.0000000000]]); '
99102 self .assertEqualOpenScadObject (expected , actual )
100103
101104 # Make sure we can take a single transform function for all points
102105 transforms = [lambda p , path , loop : 2 * p ]
103106 actual = extrude_along_path (tri , path , transforms = transforms )
104- expected = 'polyhedron(faces = [[0, 3, 1], [1, 3, 4], [1, 4, 2], [2, 4, 5], [2, 5, 0], [0, 5, 3], [6, 0, 1], [6, 1, 2], [6, 2, 0], [7, 3, 4], [7, 4, 5], [7, 5, 3]], points = [[0.0000000000, 0.0000000000, 0.0000000000], [0.0000000000, -20.0000000000, 0.0000000000], [0.0000000000, 0.0000000000, 20.0000000000], [20.0000000000, 0.0000000000, 0.0000000000], [20.0000000000, -20.0000000000, 0.0000000000], [20.0000000000, 0.0000000000, 20.0000000000], [0.0000000000, -6.6666666667, 6.6666666667], [20.0000000000, -6.6666666667, 6.6666666667 ]]);'
107+ expected = 'polyhedron(faces= [[0,1,3], [1,4,3],[1,2,4], [2,5,4],[2,0,5],[0,3,5],[2,1, 0],[3,4,5]], points= [[0.0000000000,0.0000000000,0.0000000000],[0.0000000000,-20.0000000000,0.0000000000],[0.0000000000,0.0000000000,20.0000000000],[20.0000000000,0.0000000000,0.0000000000],[20.0000000000,-20.0000000000,0.0000000000],[20.0000000000,0.0000000000,20.0000000000]]);'
105108 self .assertEqualOpenScadObject (expected , actual )
106109
107110 def test_extrude_along_path_numpy (self ):
0 commit comments