diff --git a/src/crystal_ball.scad b/src/crystal_ball.scad index d37d94af..8b50bbee 100644 --- a/src/crystal_ball.scad +++ b/src/crystal_ball.scad @@ -8,12 +8,11 @@ * **/ -include <__comm__/__nearest_multiple_of_4.scad>; -include <__comm__/__frags.scad>; -include <__comm__/__ra_to_xy.scad>; -include <__comm__/__edge_r.scad>; -include <__comm__/__shape_pie.scad>; -include <__comm__/__shape_arc.scad>; +use <__comm__/__nearest_multiple_of_4.scad>; +use <__comm__/__frags.scad>; +use ; +use ; +use ; module crystal_ball(radius, theta = 360, phi = 180, thickness) { phis = is_num(phi) ? [0, phi] : phi; @@ -23,12 +22,12 @@ module crystal_ball(radius, theta = 360, phi = 180, thickness) { angle = [90 - phis[1], 90 - phis[0]]; shape_pts = is_undef(thickness) ? - __shape_pie( + shape_pie( radius, angle , $fn = __nearest_multiple_of_4(frags) ) : - __shape_arc( + shape_arc( radius, angle, width = thickness, diff --git a/test/test_crystal_ball.scad b/test/test_crystal_ball.scad index d955c388..29fc9018 100644 --- a/test/test_crystal_ball.scad +++ b/test/test_crystal_ball.scad @@ -1,89 +1,20 @@ -include ; +use ; +use ; -include ; -include ; -include ; -include ; -include ; - -module test_crystal_ball() { - module test_a_ball() { - echo("==== test_crystal_ball_a_ball ===="); - - include ; - - module test_crystal_ball_pie(shape_pts) { - - expected = [[0, 0], [0, -6], [1.8541, -5.7063], [3.5267, -4.8541], [4.8541, -3.5267], [5.7063, -1.8541], [6, 0], [5.7063, 1.8541], [4.8541, 3.5267], [3.5267, 4.8541], [1.8541, 5.7063], [0, 6]]; - - assertEqualPoints(expected, shape_pts); - } - - crystal_ball(radius = 6); - } - - module test_theta() { - echo("==== test_crystal_ball_theta ===="); - - include ; - - module test_crystal_ball_pie(shape_pts) { - - expected = [[0, 0], [0, -6], [3, -5.1962], [5.1962, -3], [6, 0], [5.1962, 3], [3, 5.1962], [0, 6]]; - - assertEqualPoints(expected, shape_pts); - } - - crystal_ball( - radius = 6, - theta = 270, - $fn = 12 - ); - } - - module test_phi() { - - include ; - - module test_crystal_ball_pie(shape_pts) { - echo("==== test_crystal_ball_phi ===="); - - expected = [[0, 0], [6, 0], [5.1962, 3], [3, 5.1962], [0, 6]]; - - assertEqualPoints(expected, shape_pts); - } - - crystal_ball( - radius = 6, - theta = 270, - phi = 90, - $fn = 12 - ); - } - - module test_theta_phi() { - echo("==== test_crystal_ball_theta_phi ===="); - - include ; - - module test_crystal_ball_pie(shape_pts) { - - expected = [[0, 0], [5.1392, 2.9671], [4.8541, 3.5267], [3.5267, 4.8541], [2.9671, 5.1392]]; - - assertEqualPoints(expected, shape_pts); - } - - crystal_ball( - radius = 6, - theta = [-30, 270], - phi = [30, 60] - ); - } - - test_a_ball(); - test_theta(); - test_phi(); - test_theta_phi(); +module test_crystal_ball_pie(shape_pts) { + expected = [[0, 0], [5.1392, 2.9671], [4.8541, 3.5267], [3.5267, 4.8541], [2.9671, 5.1392]]; + assertEqualPoints(expected, shape_pts); } -test_crystal_ball(); \ No newline at end of file +module test_theta_phi() { + echo("==== test_crystal_ball_theta_phi ===="); + + crystal_ball( + radius = 6, + theta = [-30, 270], + phi = [30, 60] + ); +} + +test_theta_phi(); +