1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-01-17 14:18:13 +01:00
dotSCAD/test/test_along_with.scad

46 lines
1.8 KiB
OpenSCAD
Raw Normal View History

2022-06-06 13:11:46 +08:00
use <shape_circle.scad>
include <along_with.scad>
2019-06-17 07:36:17 +08:00
2020-01-27 08:55:23 +08:00
module test_along_with_angles(angles, children) {
if(children == 1) {
// ==== test_along_with_default_angles ====
2019-06-17 07:36:17 +08:00
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);
}
2020-01-27 08:55:23 +08:00
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);
}
}
2019-06-17 07:36:17 +08:00
2020-01-27 08:55:23 +08:00
module test_along_with_default_angles() {
echo("==== test_along_with_default_angles ====");
$fn = 24;
2020-03-17 14:23:18 +08:00
points = shape_circle(radius = 50);
2019-06-17 08:18:54 +08:00
along_with(points, method = "EULER_ANGLE")
2019-06-17 07:36:17 +08:00
sphere(5);
}
module test_along_with_children() {
echo("==== test_along_with_children ====");
2019-06-23 09:02:53 +08:00
2019-06-17 07:36:17 +08:00
$fn = 24;
2020-03-17 14:23:18 +08:00
points = shape_circle(radius = 50);
2019-06-17 08:18:54 +08:00
along_with(points, method = "EULER_ANGLE") {
2019-06-17 07:36:17 +08:00
linear_extrude(10, center = true) text("A", valign = "center", halign = "center");
linear_extrude(5, center = true) circle(2);
sphere(1);
cube(5);
linear_extrude(10, center = true) text("A", valign = "center", halign = "center");
linear_extrude(5, center = true) circle(2);
sphere(1);
cube(5);
}
}
test_along_with_default_angles();
test_along_with_children();