test_along_with.scad
1 use <shape_circle.scad> 2 include <along_with.scad> 3 4 module test_along_with_angles(angles, children) { 5 if(children == 1) { 6 // ==== test_along_with_default_angles ==== 7 expected_angles = [[0, 0, 97.5], [0, 0, 97.5], [0, 0, 112.5], [0, 0, 127.5], [0, 0, 142.5], [0, 0, 157.5], [0, 0, 172.5], [0, 0, -172.5], [0, 0, -157.5], [0, 0, -142.5], [0, 0, -127.5], [0, 0, -112.5], [0, 0, -97.5], [0, 0, -82.5], [0, 0, -67.5], [0, 0, -52.5], [0, 0, -37.5], [0, 0, -22.5], [0, 0, -7.5], [0, 0, 7.5], [0, 0, 22.5], [0, 0, 37.5], [0, 0, 52.5], [0, 0, 67.5]]; 8 assert($fn == len(angles)); 9 assertEqualPoints(expected_angles, angles); 10 } 11 else { 12 // ==== test_along_with_children ==== 13 expected_angles = [[0, 0, 97.5], [0, 0, 97.5], [0, 0, 112.5], [0, 0, 127.5], [0, 0, 142.5], [0, 0, 157.5], [0, 0, 172.5], [0, 0, -172.5]]; 14 assert(8 == len(angles)); 15 assertEqualPoints(expected_angles, angles); 16 } 17 } 18 19 module test_along_with_default_angles() { 20 echo("==== test_along_with_default_angles ===="); 21 22 $fn = 24; 23 points = shape_circle(radius = 50); 24 along_with(points, method = "EULER_ANGLE") 25 sphere(5); 26 } 27 28 module test_along_with_children() { 29 echo("==== test_along_with_children ===="); 30 31 $fn = 24; 32 points = shape_circle(radius = 50); 33 along_with(points, method = "EULER_ANGLE") { 34 linear_extrude(10, center = true) text("A", valign = "center", halign = "center"); 35 linear_extrude(5, center = true) circle(2); 36 sphere(1); 37 cube(5); 38 linear_extrude(10, center = true) text("A", valign = "center", halign = "center"); 39 linear_extrude(5, center = true) circle(2); 40 sphere(1); 41 cube(5); 42 } 43 } 44 45 test_along_with_default_angles(); 46 test_along_with_children();