1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-01-17 14:18:13 +01:00
dotSCAD/test/test_shape_cyclicpolygon.scad
2017-05-25 14:05:19 +08:00

35 lines
2.7 KiB
OpenSCAD

include <unittest.scad>;
include <shape_cyclicpolygon.scad>;
module test_shape_cyclicpolygon() {
echo("==== test_shape_cyclicpolygon ====");
expected_all = [
[[5.5, -2.59808], [6.12132, -2.12132], [6.59808, -1.5], [6.89778, -0.776457], [7, 0], [6.89778, 0.776457], [6.59808, 1.5], [6.12132, 2.12132], [5.5, 2.59808], [-0.5, 6.06218], [-1.22354, 6.36188], [-2, 6.4641], [-2.77646, 6.36188], [-3.5, 6.06218], [-4.12132, 5.58542], [-4.59808, 4.9641], [-4.89778, 4.24056], [-5, 3.4641], [-5, -3.4641], [-4.89778, -4.24056], [-4.59808, -4.9641], [-4.12132, -5.58542], [-3.5, -6.06218], [-2.77646, -6.36188], [-2, -6.4641], [-1.22354, -6.36188], [-0.5, -6.06218]],
[[7.87868, -2.12132], [8.35544, -1.5], [8.65514, -0.776457], [8.75736, 0], [8.65514, 0.776457], [8.35544, 1.5], [7.87868, 2.12132], [2.12132, 7.87868], [1.5, 8.35544], [0.776457, 8.65514], [0, 8.75736], [-0.776457, 8.65514], [-1.5, 8.35544], [-2.12132, 7.87868], [-7.87868, 2.12132], [-8.35544, 1.5], [-8.65514, 0.776457], [-8.75736, 0], [-8.65514, -0.776457], [-8.35544, -1.5], [-7.87868, -2.12132], [-2.12132, -7.87868], [-1.5, -8.35544], [-0.776457, -8.65514], [0, -8.75736], [0.776457, -8.65514], [1.5, -8.35544], [2.12132, -7.87868]],
[[8.71885, -1.76336], [9.09254, -1.0751], [9.27536, -0.313585], [9.25486, 0.469303], [9.03243, 1.22021], [8.71885, 1.76336], [4.37132, 7.74721], [3.83223, 8.31529], [3.16448, 8.72449], [2.41358, 8.94692], [1.63069, 8.96742], [1.01722, 8.83702], [-6.01722, 6.55139], [-6.72409, 6.21424], [-7.3196, 5.70562], [-7.76319, 5.0602], [-8.02461, 4.32196], [-8.09017, 3.69822], [-8.09017, -3.69822], [-7.98795, -4.47468], [-7.68825, -5.19822], [-7.21149, -5.81955], [-6.59017, -6.2963], [-6.01722, -6.55139], [1.01722, -8.83702], [1.78726, -8.97974], [2.56801, -8.9183], [3.30624, -8.65687], [3.95166, -8.21329], [4.37132, -7.74721]],
[[9.13397, -1.5], [9.43368, -0.776457], [9.5359, 0], [9.43368, 0.776457], [9.13397, 1.5], [5.86603, 7.16025], [5.38927, 7.78157], [4.76795, 8.25833], [4.04441, 8.55803], [3.26795, 8.66025], [-3.26795, 8.66025], [-4.04441, 8.55803], [-4.76795, 8.25833], [-5.38927, 7.78157], [-5.86603, 7.16025], [-9.13397, 1.5], [-9.43368, 0.776457], [-9.5359, 0], [-9.43368, -0.776457], [-9.13397, -1.5], [-5.86603, -7.16025], [-5.38927, -7.78157], [-4.76795, -8.25833], [-4.04441, -8.55803], [-3.26795, -8.66025], [3.26795, -8.66025], [4.04441, -8.55803], [4.76795, -8.25833], [5.38927, -7.78157], [5.86603, -7.16025]]
];
circle_r = 10;
corner_r = 3;
$fn = 24;
for(i = [0:3]) {
actual = shape_cyclicpolygon(
sides = 3 + i,
circle_r = circle_r,
corner_r = corner_r
);
assertEqualPoints(expected_all[i], actual);
}
}
test_shape_cyclicpolygon();