1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-01-17 14:18:13 +01:00
dotSCAD/test/test_trim_shape.scad
2020-01-27 16:34:09 +08:00

18 lines
3.5 KiB
OpenSCAD

use <unittest.scad>;
use <trim_shape.scad>;
use <shape_taiwan.scad>;
use <bijection_offset.scad>;
module test_trim_shape() {
echo("==== test_trim_shape ====");
taiwan = shape_taiwan(50);
offseted = bijection_offset(taiwan, -2);
expected = [[11.8215, 18.752], [10.6338, 19.2796], [10.0046, 20.2443], [9.90826, 20.5883], [8.70107, 20.8781], [7.92074, 21.1601], [7.86725, 21.2196], [7.27987, 21.0324], [7.09336, 21.4286], [6.37935, 19.021], [4.68179, 20.5971], [4.5527, 20.5497], [2.93485, 20.2511], [2.81634, 20.2087], [2.73817, 20.1409], [2.18145, 19.775], [1.37773, 19.5192], [1.2485, 19.3686], [0.910901, 18.828], [0.76564, 17.6214], [0.347453, 17.4878], [0.384341, 17.2143], [-0.098055, 16.5572], [-0.218527, 16.3137], [-0.405555, 15.5988], [-0.698227, 15.3605], [-0.7087, 15.33], [-0.320271, 13.0644], [-2.60331, 13.5214], [-2.98653, 13.1043], [-3.10016, 12.8995], [-3.142, 12.5466], [-3.51015, 11.7766], [-4.57544, 10.6037], [-4.70456, 10.1567], [-5.14938, 9.39273], [-5.2474, 8.94799], [-5.59061, 7.97586], [-5.62525, 7.94754], [-5.62269, 7.96175], [-6.33, 7.144], [-6.34104, 6.89284], [-6.7609, 5.93534], [-6.87067, 5.84916], [-6.91022, 5.65005], [-7.61745, 5.02019], [-7.82187, 4.44883], [-8.03107, 4.06493], [-8.21974, 3.51881], [-8.61249, 3.00185], [-8.69757, 2.91941], [-8.73113, 2.77248], [-9.10025, 2.07081], [-9.3238, 1.86887], [-9.30876, 1.91017], [-9.59926, 1.52971], [-9.69857, 1.16721], [-10.0582, 0.403593], [-10.3384, -0.0369127], [-10.3854, -0.132622], [-10.3951, -0.194325], [-10.2707, -0.739663], [-10.249, -0.964726], [-10.2079, -1.03632], [-9.93828, -2.07816], [-10.1738, -2.69596], [-9.679, -2.94903], [-10.1969, -5.13922], [-10.45, -5.40183], [-10.7508, -6.14493], [-10.6782, -6.47661], [-10.715, -6.55157], [-10.0504, -6.65196], [-9.57877, -8.84089], [-10.2006, -8.19261], [-9.81559, -8.91674], [-9.65581, -9.94319], [-9.12163, -10.7459], [-9.22681, -11.5141], [-9.01465, -11.8442], [-8.73247, -12.4252], [-8.48376, -13.4262], [-8.48489, -13.4305], [-8.0699, -13.8936], [-7.7349, -14.5209], [-7.41546, -14.6692], [-7.0645, -14.8905], [-6.80517, -15.1143], [-6.79263, -15.1225], [-6.16377, -15.4209], [-5.49479, -15.9866], [-5.4225, -16.0949], [-5.53602, -16.0266], [-4.80354, -16.6014], [-4.40453, -17.1464], [-4.19976, -17.6117], [-4.00409, -17.8586], [-3.97777, -17.9015], [-3.83889, -17.3565], [-3.33584, -16.4856], [-3.19723, -15.9876], [-3.05908, -15.1064], [-2.63023, -14.3537], [-2.24981, -13.8734], [-1.91247, -13.0155], [-1.33334, -12.2667], [-1.12254, -12.1685], [-0.675112, -11.6726], [0.101845, -11.1595], [0.270335, -10.2843], [0.880024, -9.55879], [1.38186, -9.13658], [1.33812, -9.23203], [1.80844, -8.5697], [1.98972, -7.7937], [2.26128, -7.29646], [2.33773, -7.04836], [2.59675, -6.51487], [3.01217, -6.07782], [3.00479, -5.62291], [3.13547, -4.69461], [3.35489, -4.05881], [3.63333, -3.5265], [3.8947, -3.17889], [4.68681, 1.37928], [4.94669, 1.90737], [5.34344, 3.84582], [5.66428, 4.72607], [5.77584, 5.26262], [5.79433, 5.62233], [5.88933, 6.02115], [5.79416, 6.3079], [5.7619, 7.19402], [6.03794, 8.02087], [6.36442, 8.50081], [6.47507, 8.97173], [6.74051, 9.5319], [6.76126, 9.47511], [7.6015, 10.6679], [7.85706, 10.8721], [7.92577, 10.9651], [7.92595, 10.9508], [7.96742, 11.5364], [8.08626, 11.9958], [8.08561, 12.006], [8.1501, 12.7625], [10.5031, 12.7536], [9.26392, 13.5338], [8.58567, 14.7305], [8.55847, 16.0185], [8.5956, 16.121], [8.48033, 16.6489], [8.46518, 17.3066], [8.50618, 17.927], [8.63904, 18.5685], [8.86699, 19.2643]];
actual = trim_shape(offseted, 3, len(offseted) - 6);
assertEqualPoints(expected, actual);
}
test_trim_shape();