mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-01-17 14:18:13 +01:00
28 lines
3.5 KiB
OpenSCAD
28 lines
3.5 KiB
OpenSCAD
use <unittest.scad>;
|
|
use <archimedean_spiral.scad>;
|
|
|
|
module test_archimedean_spiral() {
|
|
echo("==== test_archimedean_spiral ====");
|
|
|
|
points_angles = archimedean_spiral(
|
|
arm_distance = 10,
|
|
init_angle = 180,
|
|
point_distance = 5,
|
|
num_of_points = 100
|
|
);
|
|
|
|
|
|
expected_points = [[-5, -7.44079e-15], [-3.33333, -5.7735], [1.91532, -7.65424], [6.92876, -5.61213], [9.7591, -1.10172], [9.79063, 4.16666], [7.28947, 8.75881], [3.01359, 11.7181], [-2.09016, 12.5895], [-7.09943, 11.3523], [-11.25, 8.31156], [-14.0047, 3.98014], [-15.0734, -1.03012], [-14.399, -6.09971], [-12.1214, -10.6703], [-8.53004, -14.2915], [-4.01291, -16.6467], [0.993179, -17.5619], [6.04652, -17.0006], [10.7368, -15.0487], [14.7127, -11.8924], [17.7006, -7.79258], [19.5144, -3.05828], [20.0591, 1.97935], [19.327, 6.9905], [17.3893, 11.6669], [14.3849, 15.7378], [10.5053, 18.9825], [5.98036, 21.2372], [1.06209, 22.3994], [-3.98985, 22.4281], [-8.92173, 21.3403], [-13.4975, 19.2065], [-17.5087, 16.1425], [-20.7813, 12.3015], [-23.1818, 7.86435], [-24.6194, 3.02989], [-25.0472, -1.99446], [-24.4613, -7.00176], [-22.8982, -11.7937], [-20.4307, -16.1877], [-17.1631, -20.023], [-13.2253, -23.1649], [-8.76701, -25.5086], [-3.95103, -26.9808], [1.05296, -27.5407], [6.07445, -27.1794], [10.9478, -25.9188], [15.5173, -23.809], [19.6417, -20.9254], [23.1976, -17.3653], [26.0826, -13.2435], [28.2173, -8.68828], [29.5464, -3.83699], [30.0392, 1.16831], [29.6895, 6.18511], [28.5146, 11.0744], [26.5537, 15.7043], [23.8662, 19.9532], [20.5288, 23.7126], [16.6334, 26.8895], [12.2837, 29.4079], [7.5921, 31.2101], [2.67704, 32.2573], [-2.34055, 32.5302], [-7.34003, 32.0282], [-12.204, 30.7691], [-16.8206, 28.7877], [-21.0864, 26.1345], [-24.9079, 22.8743], [-28.2035, 19.0837], [-30.9048, 14.8493], [-32.9576, 10.2658], [-34.3228, 5.43291], [-34.9764, 0.453929], [-34.9096, -4.56704], [-34.1284, -9.52705], [-32.6535, -14.3264], [-30.5185, -18.8704], [-27.7698, -23.0714], [-24.4645, -26.8499], [-20.6696, -30.1359], [-16.4601, -32.8701], [-11.9172, -35.0048], [-7.12715, -36.5039], [-2.17897, -37.3437], [2.83689, -37.513], [7.8304, -37.0126], [12.7134, -35.8551], [17.4011, -34.0645], [21.8137, -31.6752], [25.8772, -28.7315], [29.5248, -25.2861], [32.6976, -21.3993], [35.3458, -17.138], [37.4286, -12.5738], [38.9153, -7.78232], [39.7852, -2.84167], [40.0274, 2.16895], [39.6415, 7.17039]];
|
|
expected_angles = [180, 240, 284.049, 320.993, 353.559, 383.054, 410.231, 435.578, 459.427, 482.021, 503.543, 524.135, 543.91, 562.959, 581.357, 599.169, 616.447, 633.237, 649.579, 665.507, 681.051, 696.239, 711.093, 725.636, 739.885, 753.859, 767.572, 781.039, 794.273, 807.286, 820.087, 832.689, 845.098, 857.325, 869.377, 881.261, 892.984, 904.553, 915.973, 927.251, 938.391, 949.398, 960.277, 971.033, 981.669, 992.19, 1002.6, 1012.9, 1023.09, 1033.19, 1043.18, 1053.08, 1062.89, 1072.6, 1082.23, 1091.77, 1101.23, 1110.6, 1119.9, 1129.12, 1138.26, 1147.33, 1156.33, 1165.26, 1174.12, 1182.91, 1191.64, 1200.3, 1208.9, 1217.44, 1225.92, 1234.34, 1242.7, 1251.01, 1259.26, 1267.45, 1275.6, 1283.69, 1291.73, 1299.72, 1307.66, 1315.55, 1323.4, 1331.2, 1338.95, 1346.66, 1354.33, 1361.95, 1369.52, 1377.06, 1384.55, 1392.01, 1399.42, 1406.8, 1414.13, 1421.43, 1428.69, 1435.92, 1443.1, 1450.25];
|
|
|
|
actual_points = [for(pa = points_angles) pa[0]];
|
|
actual_angles = [for(pa = points_angles) pa[1]];
|
|
|
|
assertEqualPoints(expected_points, actual_points);
|
|
|
|
for(i = [0:0]) {
|
|
assertEqualNum(expected_angles[i], actual_angles[i]);
|
|
}
|
|
}
|
|
|
|
test_archimedean_spiral(); |