From 31d8782ceca9669ff43f83325531d2e2ae90c0a1 Mon Sep 17 00:00:00 2001 From: Justin Lin Date: Mon, 27 Jan 2020 08:55:23 +0800 Subject: [PATCH] reduce deps --- src/along_with.scad | 10 +++++----- test/test_along_with.scad | 41 ++++++++++++++++----------------------- 2 files changed, 22 insertions(+), 29 deletions(-) diff --git a/src/along_with.scad b/src/along_with.scad index b1dde004..9360bc04 100644 --- a/src/along_with.scad +++ b/src/along_with.scad @@ -8,9 +8,9 @@ * **/ -include <__comm__/__angy_angz.scad>; -include <__comm__/__to3d.scad>; -include ; +use <__comm__/__angy_angz.scad>; +use <__comm__/__to3d.scad>; +use ; module along_with(points, angles, twist = 0, scale = 1.0, method = "AXIS_ANGLE") { leng_points = len(points); @@ -190,10 +190,10 @@ module along_with(points, angles, twist = 0, scale = 1.0, method = "AXIS_ANGLE") } } - test_along_with_angles(angs); + test_along_with_angles(angs, $children); } } -module test_along_with_angles(angles) { +module test_along_with_angles(angles, children) { } \ No newline at end of file diff --git a/test/test_along_with.scad b/test/test_along_with.scad index 7812c347..c9b7c5fc 100644 --- a/test/test_along_with.scad +++ b/test/test_along_with.scad @@ -1,42 +1,36 @@ include ; include ; +include ; -module test_along_with_default_angles() { - echo("==== test_along_with_default_angles ===="); - - include ; - - $fn = 24; - - points = circle_path(radius = 50); - - module test_along_with_angles(angles) { +module test_along_with_angles(angles, children) { + if(children == 1) { + // ==== test_along_with_default_angles ==== 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]]; assert($fn == len(angles)); assertEqualPoints(expected_angles, angles); } + else { + // ==== test_along_with_children ==== + 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]]; + assert(8 == len(angles)); + assertEqualPoints(expected_angles, angles); + } +} +module test_along_with_default_angles() { + echo("==== test_along_with_default_angles ===="); + + $fn = 24; + points = circle_path(radius = 50); along_with(points, method = "EULER_ANGLE") sphere(5); - } module test_along_with_children() { echo("==== test_along_with_children ===="); - - include ; $fn = 24; - - points = circle_path(radius = 50); - - module test_along_with_angles(angles) { - 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]]; - - assert(8 == len(angles)); - assertEqualPoints(expected_angles, angles); - } - + points = circle_path(radius = 50); along_with(points, method = "EULER_ANGLE") { linear_extrude(10, center = true) text("A", valign = "center", halign = "center"); linear_extrude(5, center = true) circle(2); @@ -47,7 +41,6 @@ module test_along_with_children() { sphere(1); cube(5); } - } test_along_with_default_angles();