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

36 lines
35 KiB
OpenSCAD
Raw Normal View History

2022-06-06 13:11:46 +08:00
use <unittest.scad>
use <helix_extrude.scad>
2017-06-30 16:23:36 +08:00
module test_helix_extrude_same_radius() {
echo("==== test_helix_extrude_same_radius ====");
module test_helix_extrude(sections) {
2019-06-12 08:17:50 +08:00
expected = [[[45, 0.0795146, -1.99842], [45, -0.0795146, 1.99842], [44, -0.0795146, 1.99842], [44, 0, 0], [36, 0, 0], [36, -0.0795146, 1.99842], [35, -0.0795146, 1.99842], [35, 0.0795146, -1.99842]], [[44.0001, 9.4338, -1.66509], [44.0332, 9.27825, 2.33175], [43.055, 9.07034, 2.33175], [43.0385, 9.14811, 0.333333], [35.2133, 7.48482, 0.333333], [35.2298, 7.40704, 2.33175], [34.2517, 7.19913, 2.33175], [34.2186, 7.35469, -1.66509]], [[41.0772, 18.3758, -1.33175], [41.1419, 18.2305, 2.66509], [40.2283, 17.8238, 2.66509], [40.196, 17.8964, 0.666667], [32.8876, 14.6425, 0.666667], [32.92, 14.5699, 2.66509], [32.0064, 14.1631, 2.66509], [31.9417, 14.3084, -1.33175]], [[36.359, 26.5147, -0.998419], [36.4525, 26.386, 2.99842], [35.6435, 25.7982, 2.99842], [35.5967, 25.8626, 1], [29.1246, 21.1603, 1], [29.1713, 21.0959, 2.99842], [28.3623, 20.5082, 2.99842], [28.2689, 20.6368, -0.998419]], [[30.0518, 33.4947, -0.665085], [30.17, 33.3883, 3.33175], [29.5008, 32.6452, 3.33175], [29.4417, 32.6984, 1.33333], [24.0887, 26.7532, 1.33333], [24.1478, 26.7, 3.33175], [23.4787, 25.9569, 3.33175], [23.3605, 26.0633, -0.665085]], [[22.4311, 39.0109, -0.331752], [22.5689, 38.9314, 3.66509], [22.0689, 38.0654, 3.66509], [22, 38.1051, 1.66667], [18, 31.1769, 1.66667], [18.0689, 31.1372, 3.66509], [17.5689, 30.2711, 3.66509], [17.4311, 30.3506, -0.331752]], [[13.8301, 42.8221, 0.00158127], [13.9814, 42.773, 3.99842], [13.6724, 41.8219, 3.99842], [13.5967, 41.8465, 2], [11.1246, 34.238, 2], [11.2002, 34.2135, 3.99842], [10.8912, 33.2624, 3.99842], [10.74, 33.3115, 0.00158127]], [[4.6247, 44.7618, 0.334915], [4.78286, 44.7452, 4.33175], [4.67833, 43.7507, 4.33175], [4.59925, 43.759, 2.33333], [3.76302, 35.8028, 2.33333], [3.8421, 35.7945, 4.33175], [3.73758, 34.8, 4.33175], [3.57942, 34.8166, 0.334915]], [[-4.78286, 44.7452, 0.668248], [-4.6247, 44.7618, 4.66509], [-4.52017, 43.7673, 4.66509], [-4.59925, 43.759, 2.66667], [-3.76302, 35.8028, 2.66667], [-3.68395, 35.8111, 4.66509], [-3.57942, 34.8166, 4.66509], [-3.73758, 34.8, 0.668248]], [[-13.9814, 42.773, 1.00158], [-13.8301, 42.8221, 4.99842], [-13.5211, 41.8711, 4.99842], [-13.5967, 41.8465, 3], [-11.1246, 34.238, 3], [-11.049, 34.2626, 4.99842], [-10.74, 33.3115, 4.99842], [-10.8912, 33.2624, 1.00158]], [[-22.5689, 38.9314, 1.33491], [-22.4311, 39.0109, 5.33175], [-21.9311, 38.1449, 5.33175], [-22, 38.1051, 3.33333], [-18, 31.1769, 3.33333], [-17.9311, 31.2167, 5.33175], [-17.4311, 30.3506, 5.33175], [-17.5689, 30.2711, 1.33491]], [[-30.17, 33.3883, 1.66825], [-30.0518, 33.4947, 5.66509], [-29.3827, 32.7516, 5.66509], [-29.4417, 32.6984, 3.66667], [-24.0887, 26.7532, 3.66667], [-24.0296, 26.8064, 5.66509], [-23.3605, 26.0633, 5.66509], [-23.4787, 25.9569, 1.66825]], [[-36.4525, 26.386, 2.00158], [-36.359, 26.5147, 5.99842], [-35.55, 25.9269, 5.99842], [-35.5967, 25.8626, 4], [-29.1246, 21.1603, 4], [-29.0779, 21.2246, 5.99842], [-28.2689, 20.6368, 5.99842], [-28.3623, 20.5082, 2.00158]], [[-41.1419, 18.2305, 2.33491], [-41.0772, 18.3758, 6.33175], [-40.1637, 17.9691, 6.33175], [-40.196, 17.8964, 4.33333], [-32.8876, 14.6425, 4.33333], [-32.8553, 14.7152, 6.33175], [-31.9417, 14.3084, 6.33175], [-32.0064, 14.1631, 2.33491]], [[-44.0332, 9.27825, 2.66825], [-44.0001, 9.4338, 6.66509], [-43.022, 9.22589, 6.66509], [-43.0385, 9.14811, 4.66667], [-35.2133, 7.48482, 4.66667], [-35.1968, 7.5626, 6.66509], [-34.2186, 7.35469, 6.66509], [-34.2517, 7.19913, 2.66825]], [[-45, -0.0795146, 3.00158], [-45, 0.0795146, 6.99842], [-44, 0.0795146, 6.99842], [-44, 0, 5], [-36, 0, 5], [-36, 0.0795146, 6.99842], [-35, 0.0795146, 6.99842], [-35, -0.0795146, 3.00158]], [[-44.0001, -9.4338, 3.33491], [-44.0332, -9.27825, 7.33175], [-43.055, -9.07034, 7.33175], [-43.0385, -9.14811, 5.33333], [-35.2133, -7.48482, 5.33333], [-35.2298, -7.40704, 7.33175], [-34.2517, -7.19913, 7.33175], [-34.2186, -7.35469, 3.33491]], [[-41.0772, -18.3758, 3.66825], [-41.1419, -18.2305, 7.66509], [-40.2283, -17.8238, 7.66509], [-40.196, -17.8964, 5.66667], [-32.8876, -14.6425, 5.66667], [-32.92, -14.5699, 7.66509], [-32.0064,
2017-06-30 16:23:36 +08:00
for(i = [0:len(expected) - 1]) {
2019-06-12 08:17:50 +08:00
assertEqualPoints(expected[i], sections[i]);
2017-06-30 16:23:36 +08:00
}
}
shape_pts = [
[5, -2],
[5, 2],
[4, 2],
[4, 0],
[-4, 0],
[-4, 2],
[-5, 2],
[-5, -2]
];
helix_extrude(shape_pts,
radius = 40,
levels = 5,
level_dist = 10,
vt_dir = "SPI_UP"
);
}
2020-01-27 14:49:33 +08:00
test_helix_extrude_same_radius();