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

26 lines
5.5 KiB
OpenSCAD
Raw Normal View History

2022-06-06 13:11:46 +08:00
use <unittest.scad>
use <ptf/ptf_rotate.scad>
2017-06-22 15:10:25 +08:00
2020-03-24 17:31:32 +08:00
module test_ptf_rotate() {
echo("==== test_ptf_rotate ====");
2017-06-20 17:47:16 +08:00
point = [20, 0, 0];
a = [0, -45, 45];
2017-06-20 17:47:16 +08:00
2020-03-24 17:31:32 +08:00
assertEqualPoint([10, 10, 14.1421], ptf_rotate(point, a));
2017-06-20 17:47:16 +08:00
radius = 40;
step_angle = 10;
z_circles = 20;
2017-06-20 17:47:16 +08:00
points2 = [for(a = [0:step_angle:90 * z_circles])
2020-03-24 17:31:32 +08:00
ptf_rotate(
[radius, 0, 0],
[0, -90 + 2 * a / z_circles, a]
)
];
2019-05-21 19:12:31 +08:00
assertEqualPoints( [[0, 0, 40], [0.6875, 0.1212, 39.9939], [1.3118, 0.4775, 39.9756], [1.813, 1.0467, 39.9452], [2.1375, 1.7935, 39.9026], [2.2409, 2.6706, 39.8478], [2.0906, 3.621, 39.7809], [1.6673, 4.5808, 39.7018], [0.9667, 5.4823, 39.6107], [0, 6.2574, 39.5075], [-1.2061, 6.8404, 39.3923], [-2.6104, 7.1721, 39.2651], [-4.1582, 7.2023, 39.1259], [-5.7838, 6.8929, 38.9748], [-7.4129, 6.2202, 38.8118], [-8.9658, 5.1764, 38.637], [-10.3606, 3.7709, 38.4505], [-11.5172, 2.0308, 38.2522], [-12.3607, 0, 38.0423], [-12.8249, -2.2614, 37.8207], [-12.8558, -4.6791, 37.5877], [-12.4142, -7.1674, 37.3432], [-11.4786, -9.6317, 37.0874], [-10.0463, -11.9727, 36.8202], [-8.1347, -14.0898, 36.5418], [-5.7818, -15.8853, 36.2523], [-3.0449, -17.2685, 35.9518], [0, -18.1596, 35.6403], [3.2609, -18.4936, 35.3179], [6.6326, -18.2229, 34.9848], [10, -17.3205, 34.641], [13.2424, -15.7817, 34.2867], [16.2377, -13.625, 33.9219], [18.8668, -10.8928, 33.5468], [21.0188, -7.6502, 33.1615], [22.5945, -3.984, 32.7661], [23.5114, 0, 32.3607], [23.7069, 4.1802, 31.9454], [23.1413, 8.4227, 31.5204], [21.8003, 12.5864, 31.0858], [19.6962, 16.527, 30.6418], [16.8683, 20.1028, 30.1884], [13.3826, 23.1794, 29.7258], [9.3303, 25.6348, 29.2541], [4.825, 27.3642, 28.7736], [0, 28.2843, 28.2843], [-4.9965, 28.3365, 27.7863], [-10.0055, 27.4899, 27.2799], [-14.8629, 25.7433, 26.7652], [-19.4047, 23.1256, 26.2424], [-23.473, 19.6962, 25.7115], [-26.9211, 15.5429, 25.1728], [-29.6195, 10.7806, 24.6265], [-31.4601, 5.5473, 24.0726], [-32.3607, 0, 23.5114], [-32.2683, -5.6898, 22.9431], [-31.1616, -11.3419, 22.3677], [-29.0524, -16.7734, 21.7856], [-25.9857, -21.8046, 21.1968], [-22.0391, -26.2651, 20.6015], [-17.3205, -30, 20], [-11.9655, -32.8749, 19.3924], [-6.1329, -34.7813, 18.7789], [0, -35.6403, 18.1596], [6.243, -35.4056, 17.5348], [12.399, -34.066, 16.9047], [18.2709, -31.6461, 16.2695], [23.6676, -28.2059, 15.6292], [28.4106, -23.8393, 14.9843], [32.3402, -18.6716, 14.3347], [35.3209, -12.8558, 13.6808], [37.2462, -6.5675, 13.0227], [38.0423, 0, 12.3607], [37.6711, 6.6424, 11.6949], [36.1316, 13.1508, 11.0255], [33.4607, 19.3185, 10.3528], [29.7316, 24.9478, 9.6769], [25.0525, 29.8564, 8.998], [19.563, 33.884, 8.3165], [13.4295, 36.8971, 7.6324], [6.8404, 38.7939, 6.9459], [0, 39.5075, 6.2574], [-6.8783, 39.0089, 5.5669], [-13.5788, 37.3075, 4.8748], [-19.8904, 34.4512, 4.1811], [-25.6137, 30.5252, 3.4862], [-30.5671, 25.6489, 2.7903], [-34.5935, 19.9726, 2.0934], [-37.5648, 13.6725, 1.396], [-39.3863, 6.9449, 0.6981], [-40, 0, 0], [-39.3863, -6.9449, -0.6981], [-37.5648, -13.6725, -1.396], [-34.5935, -19.9726, -2.0934], [-30.5671, -25.6489, -2.7903], [-25.6137, -30.5252, -3.4862], [-19.8904, -34.4512, -4.1811], [-13.5788, -37.3075, -4.8748], [-6.8783, -39.0089, -5.5669], [0, -39.5075, -6.2574], [6.8404, -38.7939, -6.9459], [13.4295, -36.8971, -7.6324], [19.563, -33.884, -8.3165], [25.0525, -29.8564, -8.998], [29.7316, -24.9478, -9.6769], [33.4607, -19.3185, -10.3528], [36.1316, -13.1508, -11.0255], [37.6711, -6.6424, -11.6949], [38.0423, 0, -12.3607], [37.2462, 6.5675, -13.0227], [35.3209, 12.8558, -13.6808], [32.3402, 18.6716, -14.3347], [28.4106, 23.8393, -14.9843], [23.6676, 28.2059, -15.6292], [18.2709, 31.6461, -16.2695], [12.399, 34.066, -16.9047], [6.243, 35.4056, -17.5348], [0, 35.6403, -18.1596], [-6.1329, 34.7813, -18.7789], [-11.9655, 32.8749, -19.3924], [-17.3205, 30, -20], [-22.0391, 26.2651, -20.6015], [-25.9857, 21.8046, -21.1968], [-29.0524, 16.7734, -21.7856], [-31.1616, 11.3419, -22.3677], [-32.2683, 5.6898, -22.9431], [-32.3607, 0, -23.5114], [-31.4601, -5.5473, -24.0726], [-29.6195, -10.7806, -24.6265], [-26.9211, -15.5429, -25.1728], [-23.473, -19.6962, -25.7115], [-19.4047, -23.1256, -26.2424], [-14.8629, -25.7433, -26.7652], [-10.0055, -27.4899, -27.2799], [-4.9965, -28.3365, -27.7863], [0, -28.2843, -28.2843], [4.825, -27.3642, -28.7736], [9.3303, -25.6348, -29.2541], [13.3826, -23.1794, -29.7258], [16.8683, -20.1028, -30.1884], [19.6962, -16.527, -30.6418], [21.8003, -12.5864, -31.0858], [23.1413, -8.4227, -31.5204], [23
}
2020-03-24 17:31:32 +08:00
test_ptf_rotate();