mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-01-16 13:50:05 +01:00
32 lines
2.5 KiB
OpenSCAD
32 lines
2.5 KiB
OpenSCAD
use <unittest.scad>
|
|
use <shape_cyclicpolygon.scad>
|
|
|
|
module test_shape_cyclicpolygon() {
|
|
echo("==== test_shape_cyclicpolygon ====");
|
|
|
|
expected_all = [
|
|
[[5.5, -2.5981], [6.1213, -2.1213], [6.5981, -1.5], [6.8978, -0.7765], [7, 0], [6.8978, 0.7765], [6.5981, 1.5], [6.1213, 2.1213], [5.5, 2.5981], [-0.5, 6.0622], [-1.2235, 6.3619], [-2, 6.4641], [-2.7765, 6.3619], [-3.5, 6.0622], [-4.1213, 5.5854], [-4.5981, 4.9641], [-4.8978, 4.2406], [-5, 3.4641], [-5, -3.4641], [-4.8978, -4.2406], [-4.5981, -4.9641], [-4.1213, -5.5854], [-3.5, -6.0622], [-2.7765, -6.3619], [-2, -6.4641], [-1.2235, -6.3619], [-0.5, -6.0622]],
|
|
[[7.8787, -2.1213], [8.3554, -1.5], [8.6551, -0.7765], [8.7574, 0], [8.6551, 0.7765], [8.3554, 1.5], [7.8787, 2.1213], [2.1213, 7.8787], [1.5, 8.3554], [0.7765, 8.6551], [0, 8.7574], [-0.7765, 8.6551], [-1.5, 8.3554], [-2.1213, 7.8787], [-7.8787, 2.1213], [-8.3554, 1.5], [-8.6551, 0.7765], [-8.7574, 0], [-8.6551, -0.7765], [-8.3554, -1.5], [-7.8787, -2.1213], [-2.1213, -7.8787], [-1.5, -8.3554], [-0.7765, -8.6551], [0, -8.7574], [0.7765, -8.6551], [1.5, -8.3554], [2.1213, -7.8787]],
|
|
[[8.7188, -1.7634], [9.0925, -1.0751], [9.2754, -0.3136], [9.2549, 0.4693], [9.0324, 1.2202], [8.7188, 1.7634], [4.3713, 7.7472], [3.8322, 8.3153], [3.1645, 8.7245], [2.4136, 8.9469], [1.6307, 8.9674], [1.0172, 8.837], [-6.0172, 6.5514], [-6.7241, 6.2142], [-7.3196, 5.7056], [-7.7632, 5.0602], [-8.0246, 4.322], [-8.0902, 3.6982], [-8.0902, -3.6982], [-7.9879, -4.4747], [-7.6882, -5.1982], [-7.2115, -5.8195], [-6.5902, -6.2963], [-6.0172, -6.5514], [1.0172, -8.837], [1.7873, -8.9797], [2.568, -8.9183], [3.3062, -8.6569], [3.9517, -8.2133], [4.3713, -7.7472]],
|
|
[[9.134, -1.5], [9.4337, -0.7765], [9.5359, 0], [9.4337, 0.7765], [9.134, 1.5], [5.866, 7.1603], [5.3893, 7.7816], [4.7679, 8.2583], [4.0444, 8.558], [3.2679, 8.6603], [-3.2679, 8.6603], [-4.0444, 8.558], [-4.7679, 8.2583], [-5.3893, 7.7816], [-5.866, 7.1603], [-9.134, 1.5], [-9.4337, 0.7765], [-9.5359, 0], [-9.4337, -0.7765], [-9.134, -1.5], [-5.866, -7.1603], [-5.3893, -7.7816], [-4.7679, -8.2583], [-4.0444, -8.558], [-3.2679, -8.6603], [3.2679, -8.6603], [4.0444, -8.558], [4.7679, -8.2583], [5.3893, -7.7816], [5.866, -7.1603]]
|
|
];
|
|
|
|
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();
|
|
|