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

37 lines
23 KiB
OpenSCAD
Raw Normal View History

2022-06-06 13:11:46 +08:00
use <unittest.scad>
include <archimedean_spiral_extrude.scad>
2020-01-27 09:53:06 +08:00
module test_archimedean_spiral_extrude(sections) {
2022-04-16 17:07:49 +08:00
expected = [[[-12.5, -1.8602e-14, 0], [-12.5, -1.8602e-14, 4], [-11.5, -1.71138e-14, 4], [-11.5, -1.71138e-14, 2], [-3.5, -5.20855e-15, 2], [-3.5, -5.20855e-15, 4], [-2.5, -3.72039e-15, 4], [-2.5, -3.72039e-15, 0]], [[-10.9842, -8.87661, 0], [-10.9842, -8.87661, 4.16162], [-10.2065, -8.24807, 4.16162], [-10.2065, -8.24807, 2.08081], [-3.98425, -3.21976, 2.08081], [-3.98425, -3.21976, 4.16162], [-3.20647, -2.59122, 4.16162], [-3.20647, -2.59122, 0]], [[-5.0924, -14.5845, 0], [-5.0924, -14.5845, 4.32323], [-4.76276, -13.6404, 4.32323], [-4.76276, -13.6404, 2.16162], [-2.12558, -6.08761, 2.16162], [-2.12558, -6.08761, 4.32323], [-1.79593, -5.1435, 4.32323], [-1.79593, -5.1435, 0]], [[2.43688, -16.4219, 0], [2.43688, -16.4219, 4.48485], [2.2901, -15.4327, 4.48485], [2.2901, -15.4327, 2.24242], [1.11582, -7.51936, 2.24242], [1.11582, -7.51936, 4.48485], [0.969032, -6.53019, 4.48485], [0.969032, -6.53019, 0]], [[9.69144, -14.7377, 0], [9.69144, -14.7377, 4.64646], [9.142, -13.9022, 4.64646], [9.142, -13.9022, 2.32323], [4.74646, -7.21791, 2.32323], [4.74646, -7.21791, 4.64646], [4.19702, -6.38238, 4.64646], [4.19702, -6.38238, 0]], [[15.4378, -10.3558, 0], [15.4378, -10.3558, 4.80808], [14.6073, -9.79868, 4.80808], [14.6073, -9.79868, 2.40404], [7.96363, -5.34206, 2.40404], [7.96363, -5.34206, 4.80808], [7.13317, -4.78498, 4.80808], [7.13317, -4.78498, 0]], [[19, -4.26518, 0], [19, -4.26518, 4.9697], [18.0243, -4.04614, 4.9697], [18.0243, -4.04614, 2.48485], [10.2185, -2.29389, 2.48485], [10.2185, -2.29389, 4.9697], [9.2428, -2.07485, 4.9697], [9.2428, -2.07485, 0]], [[20.1398, 2.55919, 0], [20.1398, 2.55919, 5.13131], [19.1478, 2.43314, 5.13131], [19.1478, 2.43314, 2.56566], [11.2116, 1.42467, 2.56566], [11.2116, 1.42467, 5.13131], [10.2196, 1.29862, 5.13131], [10.2196, 1.29862, 0]], [[18.9436, 9.25912, 0], [18.9436, 9.25912, 5.29293], [18.0452, 8.82, 5.29293], [18.0452, 8.82, 2.64646], [10.8578, 5.30699, 2.64646], [10.8578, 5.30699, 5.29293], [9.95935, 4.86786, 5.29293], [9.95935, 4.86786, 0]], [[15.7219, 15.1457, 0], [15.7219, 15.1457, 5.45455], [15.0017, 14.4519, 5.45455], [15.0017, 14.4519, 2.72727], [9.24024, 8.90158, 2.72727], [9.24024, 8.90158, 5.45455], [8.52006, 8.2078, 5.45455], [8.52006, 8.2078, 0]], [[10.9235, 19.7189, 0], [10.9235, 19.7189, 5.61616], [10.4389, 18.8441, 5.61616], [10.4389, 18.8441, 2.80808], [6.56228, 11.8461, 2.80808], [6.56228, 11.8461, 5.61616], [6.07771, 10.9714, 5.61616], [6.07771, 10.9714, 0]], [[5.06568, 22.6659, 0], [5.06568, 22.6659, 5.77778], [4.84757, 21.69, 5.77778], [4.84757, 21.69, 2.88889], [3.10267, 13.8826, 2.88889], [3.10267, 13.8826, 5.77778], [2.88456, 12.9067, 5.77778], [2.88456, 12.9067, 0]], [[-1.32084, 23.8455, 0], [-1.32084, 23.8455, 5.93939], [-1.26553, 22.8471, 5.93939], [-1.26553, 22.8471, 2.9697], [-0.82308, 14.8593, 2.9697], [-0.82308, 14.8593, 5.93939], [-0.767774, 13.8609, 5.93939], [-0.767774, 13.8609, 0]], [[-7.73326, 23.2645, 0], [-7.73326, 23.2645, 6.10101], [-7.41783, 22.3156, 6.10101], [-7.41783, 22.3156, 3.05051], [-4.89434, 14.724, 3.05051], [-4.89434, 14.724, 6.10101], [-4.57891, 13.775, 6.10101], [-4.57891, 13.775, 0]], [[-13.7257, 21.0498, 0], [-13.7257, 21.0498, 6.26263], [-13.1795, 20.2122, 6.26263], [-13.1795, 20.2122, 3.13131], [-8.80989, 13.5109, 3.13131], [-8.80989, 13.5109, 6.26263], [-8.26369, 12.6733, 6.26263], [-8.26369, 12.6733, 0]], [[-18.9278, 17.4201, 0], [-18.9278, 17.4201, 6.42424], [-18.192, 16.7429, 6.42424], [-18.192, 16.7429, 3.21212], [-12.3056, 11.3254, 3.21212], [-12.3056, 11.3254, 6.42424], [-11.5698, 10.6482, 6.42424], [-11.5698, 10.6482, 0]], [[-23.0553, 12.6576, 0], [-23.0553, 12.6576, 6.58586], [-22.1787, 12.1764, 6.58586], [-22.1787, 12.1764, 3.29293], [-15.166, 8.32636, 3.29293], [-15.166, 8.32636, 6.58586], [-14.2895, 7.8451, 6.58586], [-14.2895, 7.8451, 0]], [[-25.9125, 7.08275, 0], [-25.9125, 7.08275, 6.74747], [-24.9479, 6.81909, 6.74747], [-24.9479, 6.81909, 3.37374], [-17.2309, 4.7098, 3.37374], [-17.2309, 4.7098, 6.74747], [-16.2663, 4.44613, 6.74747], [-16.2663, 4.44613, 0]], [[-27.3908, 1.03088, 0], [-27.3908, 1
2020-01-27 09:53:06 +08:00
for(i = [0:len(expected) - 1]) {
assertEqualPoints(expected[i], sections[i]);
}
}
2020-01-27 09:53:06 +08:00
module test_archimedean_spiral_extrude_slide() {
echo("==== test_archimedean_spiral_extrude_slide ====");
shape_pts = [
[5, 0],
[5, 4],
[4, 4],
[4, 2],
[-4, 2],
[-4, 4],
[-5, 4],
[-5, 0]
];
archimedean_spiral_extrude(
shape_pts,
arm_distance = 15,
init_angle = 180,
point_distance = 5,
num_of_points = 100,
scale = [1, 5]
);
}
test_archimedean_spiral_extrude_slide();