1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-01-17 14:18:13 +01:00
dotSCAD/test/voxel/test_vx_polygon.scad
2022-06-06 13:11:46 +08:00

17 lines
2.2 KiB
OpenSCAD

use <voxel/vx_polygon.scad>
module test_vx_polygon() {
echo("==== test_vx_polygon ====");
expected = [[5, 10], [4, 10], [3, 9], [2, 9], [1, 9], [0, 8], [-1, 8], [-2, 8], [-3, 7], [-4, 7], [-5, 7], [-6, 6], [-7, 6], [-8, 6], [-9, 5], [-10, 5], [-10, 4], [-9, 3], [-9, 2], [-9, 1], [-8, 0], [-8, -1], [-8, -2], [-7, -3], [-7, -4], [-7, -5], [-6, -6], [-6, -7], [-6, -8], [-5, -9], [-5, -10], [-4, -9], [-4, -8], [-3, -7], [-3, -6], [-2, -5], [-2, -4], [-1, -3], [-1, -2], [0, -1], [0, 0], [1, 1], [1, 2], [2, 3], [2, 4], [3, 5], [3, 6], [4, 7], [4, 8], [5, 9]];
actual = vx_polygon([[5, 10], [-10, 5], [-5, -10]], false);
assert(expected == actual);
expected2 = [[-8, 0], [0, 0], [0, 8], [-4, -7], [-4, -6], [-3, 1], [0, 2], [-5, 3], [0, 4], [-7, 5], [0, 6], [-8, -1], [-1, 8], [0, -1], [-5, -4], [-3, -2], [-1, 2], [-1, 4], [-1, 6], [-7, 6], [-5, -10], [1, 2], [-5, -7], [-5, -6], [-1, 0], [-8, 1], [-3, 2], [-5, 4], [1, 4], [1, 6], [1, 8], [-8, -2], [-2, 8], [-5, -5], [-3, -3], [-1, -1], [-2, 2], [-2, 4], [-2, 6], [-10, 4], [-9, 1], [-6, -7], [-2, -5], [-2, -4], [2, 4], [-6, 0], [0, 1], [-8, 2], [0, 3], [0, 5], [2, 6], [0, 7], [2, 8], [-6, -1], [-1, 1], [-1, 3], [-3, 4], [-1, 5], [-3, 6], [-1, 7], [-10, 5], [-9, 2], [1, 9], [3, 6], [-3, -5], [-3, -4], [-7, 0], [-6, 1], [-8, 3], [1, 3], [1, 5], [1, 7], [3, 8], [-6, -2], [-7, -1], [-2, 3], [-4, 4], [-2, 5], [-4, 6], [-2, 7], [-9, 3], [-4, -9], [-4, -8], [1, 1], [2, 3], [2, 9], [4, 8], [4, 10], [-4, -5], [-4, 0], [-7, 1], [-6, 2], [-8, 4], [2, 5], [2, 7], [-3, 7], [-6, -3], [-7, -2], [-4, -1], [-3, 3], [-3, 5], [-5, 6], [-5, -9], [-1, -3], [-1, -2], [3, 5], [3, 9], [5, 10], [-5, -8], [-5, 0], [-4, 1], [-7, 2], [-6, 3], [-9, 4], [-8, 5], [3, 7], [-7, -3], [-6, 6], [-4, 7], [-6, -4], [-4, -2], [-5, -1], [-4, 5], [-9, 5], [-8, 6], [-6, -8], [4, 7], [-2, -3], [-2, 0], [-5, 1], [-4, 2], [-7, 3], [-6, 4], [4, 9], [-7, -4], [-5, 7], [-6, -5], [-4, -3], [-5, -2], [-2, -1], [-5, 5], [-3, -7], [-3, -6], [5, 9], [-3, 0], [-2, 1], [-5, 2], [-4, 3], [-7, 4], [-6, 5], [-7, -5], [-6, -6], [-4, -4], [-5, -3], [-2, -2], [-3, -1]];
actual2 = vx_polygon([[5, 10], [-10, 5], [-5, -10]], true);
assert(expected2 == actual2);
}
test_vx_polygon();