diff --git a/src/_impl/_bezier_curve_impl.scad b/src/_impl/_bezier_curve_impl.scad index 6a08f369..e062b3c5 100644 --- a/src/_impl/_bezier_curve_impl.scad +++ b/src/_impl/_bezier_curve_impl.scad @@ -1,5 +1,3 @@ -use <../__comm__/__to2d.scad>; - function _combi(n, k) = let( bi_coef = [ diff --git a/src/collection/__comm__/_str_hash.scad b/src/collection/__comm__/_str_hash.scad deleted file mode 100644 index ab9fc52b..00000000 --- a/src/collection/__comm__/_str_hash.scad +++ /dev/null @@ -1,11 +0,0 @@ -use <../../util/sum.scad>; - -function _str_hash(value) = - let( - s = str(value), - leng = len(s) - ) - sum([ - for(i = [0:leng - 1]) - ord(s[i]) * pow(31, leng - 1 - i) - ]); \ No newline at end of file diff --git a/src/maze/mz_hamiltonian.scad b/src/maze/mz_hamiltonian.scad index 23453b92..393ab45a 100644 --- a/src/maze/mz_hamiltonian.scad +++ b/src/maze/mz_hamiltonian.scad @@ -36,6 +36,6 @@ function mz_hamiltonian(rows, columns, start = [0, 0], seed) = [for(x = [0:columns * 2 - 1]) [x, 0]], [for(y = [0:rows * 2 - 1]) [0, y]] ), - dot_pts = dedup(sort(all, by = "vt"), sorted = true) + dot_pts = dedup(sort(all, by = "vt")) ) _mz_hamiltonian_travel(dot_pts, start, rows * columns * 4); \ No newline at end of file diff --git a/src/voxel/vx_bezier.scad b/src/voxel/vx_bezier.scad index 9262cf28..22d86252 100644 --- a/src/voxel/vx_bezier.scad +++ b/src/voxel/vx_bezier.scad @@ -8,17 +8,16 @@ * **/ -use <__comm__/__to2d.scad>; -use <__comm__/__to3d.scad>; +use <../__comm__/__to2d.scad>; +use <../__comm__/__to3d.scad>; use <_impl/_vx_bezier_impl.scad>; -use ; -use ; +use <../util/dedup.scad>; function vx_bezier(p1, p2, p3, p4) = let( is2d = len(p1) == 2, pts = is2d ? _vx_bezier2(__to3d(p1), __to3d(p2), __to3d(p3), __to3d(p4), []) : _vx_bezier3(p1, p2, p3, p4, []), - deduped = hashset_list(hashset(pts)) + deduped = dedup(pts) ) is2d ? [for(p = deduped) __to2d(p)] : deduped; \ No newline at end of file diff --git a/src/voxel/vx_circle.scad b/src/voxel/vx_circle.scad index 00e73311..ce6092bc 100644 --- a/src/voxel/vx_circle.scad +++ b/src/voxel/vx_circle.scad @@ -9,11 +9,8 @@ **/ use <_impl/_vx_circle_impl.scad>; -use ; -use ; +use <../util/dedup.scad>; function vx_circle(radius, filled = false) = let(all = _vx_circle_impl(radius, filled)) - hashset_list( - hashset(all) - ); \ No newline at end of file + dedup(all); \ No newline at end of file diff --git a/src/voxel/vx_curve.scad b/src/voxel/vx_curve.scad index 66d5c843..f315b763 100644 --- a/src/voxel/vx_curve.scad +++ b/src/voxel/vx_curve.scad @@ -9,7 +9,6 @@ **/ use <_impl/_vx_curve_impl.scad>; -use <../util/sort.scad>; use <../util/dedup.scad>; function vx_curve(points, tightness = 0) = @@ -26,4 +25,4 @@ function vx_curve(points, tightness = 0) = [points[leng - 2]] ) ) - dedup(sort(pts, by = "vt"), sorted = true); \ No newline at end of file + dedup(pts); \ No newline at end of file diff --git a/src/voxel/vx_polygon.scad b/src/voxel/vx_polygon.scad index 3ff58869..361985bc 100644 --- a/src/voxel/vx_polygon.scad +++ b/src/voxel/vx_polygon.scad @@ -1,8 +1,7 @@ use <../in_shape.scad>; use <../util/sort.scad>; +use <../util/dedup.scad>; use ; -use ; -use ; function vx_polygon(points, filled = false) = let(contour = vx_polyline(concat(points, [points[0]]))) @@ -29,4 +28,4 @@ function vx_polygon(points, filled = false) = ] ) ) - hashset_list(hashset(all)); \ No newline at end of file + dedup(all); \ No newline at end of file diff --git a/src/voxel/vx_polyline.scad b/src/voxel/vx_polyline.scad index a13bd8b3..68ce6b10 100644 --- a/src/voxel/vx_polyline.scad +++ b/src/voxel/vx_polyline.scad @@ -11,7 +11,6 @@ use <../__comm__/__to3d.scad>; use <../__comm__/__to2d.scad>; use <../__comm__/__lines_from.scad>; -use <../util/sort.scad>; use <../util/dedup.scad>; use ; @@ -22,7 +21,6 @@ function vx_polyline(points) = polyline = [for(line = __lines_from(pts)) each vx_line(line[0], line[1])] ) dedup(is_2d ? - sort([for(pt = polyline) __to2d(pt)], by = "vt") - : - sort(polyline, by = "vt") - , sorted = true); \ No newline at end of file + [for(pt = polyline) __to2d(pt)] : + polyline + ); \ No newline at end of file diff --git a/src/voxel/vx_union.scad b/src/voxel/vx_union.scad index d5f2ca46..34363212 100644 --- a/src/voxel/vx_union.scad +++ b/src/voxel/vx_union.scad @@ -8,10 +8,6 @@ * **/ -use ; -use ; +use <../util/dedup.scad>; -function vx_union(points1, points2) = - hashset_list( - hashset(concat(points1, points2)) - ); \ No newline at end of file +function vx_union(points1, points2) = dedup(concat(points1, points2)); \ No newline at end of file diff --git a/test/util/test_dedup.scad b/test/util/test_dedup.scad index 798c6811..1fd62f19 100644 --- a/test/util/test_dedup.scad +++ b/test/util/test_dedup.scad @@ -1,5 +1,4 @@ use ; -use ; module test_dedup() { echo("==== test_dedup ===="); @@ -16,16 +15,6 @@ module test_dedup() { dedup([[1, 1, 2], [3, 4, 2], [7, 2, 2], [3, 4, 2], [1, 2, 3]], eq = eq) == [[1, 1, 2], [3, 4, 2], [7, 2, 2], [1, 2, 3]] ); - - sorted = sort([[1, 1, 2], [3, 4, 2], [7, 2, 2], [3, 4, 2], [1, 2, 3]]); - - assert( - dedup(sorted, sorted = true) == [[1, 1, 2], [1, 2, 3], [3, 4, 2], [7, 2, 2]] - ); - - assert( - dedup(sorted, sorted = true, eq = eq) == [[1, 1, 2], [1, 2, 3], [3, 4, 2], [7, 2, 2]] - ); } test_dedup(); \ No newline at end of file diff --git a/test/voxel/test_vx_circle.scad b/test/voxel/test_vx_circle.scad index 06f1ba27..78ddc340 100644 --- a/test/voxel/test_vx_circle.scad +++ b/test/voxel/test_vx_circle.scad @@ -4,8 +4,9 @@ use ; module test_vx_circle() { echo("==== test_vx_circle ===="); - expected = [[0, -10], [0, -1], [6, 1], [5, -2], [-5, 2], [-1, -3], [1, 3], [-6, -4], [9, 4], [-8, 5], [-5, -8], [4, -6], [4, 6], [-3, 7], [-5, 0], [1, -10], [-1, -1], [1, 1], [-6, -2], [9, 2], [-8, 3], [4, -4], [4, 4], [2, 9], [9, -5], [-3, 5], [3, -8], [-5, -6], [-6, 8], [7, 7], [9, 0], [-8, 1], [2, -10], [4, -2], [4, 2], [9, -3], [-3, 3], [-5, -4], [7, 5], [-4, -8], [3, -6], [-6, 6], [-1, 8], [2, 7], [4, 0], [9, -1], [-3, 1], [-5, -2], [3, -10], [7, 3], [10, 3], [3, -4], [-6, 4], [-4, 9], [8, -5], [2, 5], [2, -8], [-4, -6], [-1, 6], [5, 8], [7, 1], [10, 1], [3, -2], [-6, 2], [8, -3], [2, 3], [-4, -4], [-1, 4], [-9, -5], [-9, 5], [-3, -8], [2, -6], [5, 6], [0, 8], [7, -7], [-4, 7], [-6, 0], [8, -1], [2, 1], [-10, -2], [-4, -2], [-1, 2], [-9, -3], [-9, 3], [2, -4], [5, 4], [3, 9], [7, -5], [-4, 5], [1, -8], [-3, -6], [0, 6], [-1, 0], [-9, -1], [-9, 1], [2, -2], [5, 2], [7, -3], [10, -3], [-10, 3], [-4, 3], [3, 10], [-3, -4], [0, 4], [-8, -5], [8, 5], [-2, -8], [1, -6], [-7, 6], [-2, 8], [6, -7], [3, 7], [5, 0], [7, -1], [10, -1], [-10, 1], [-4, 1], [-3, -2], [0, 2], [-8, -3], [8, 3], [1, -4], [-7, 4], [5, -9], [6, -5], [3, 5], [-5, 9], [0, -8], [-2, -6], [-2, 6], [6, 8], [-7, -7], [0, 0], [-8, -1], [8, 1], [1, -2], [-7, 2], [2, 10], [6, -3], [3, 3], [-2, -4], [-2, 4], [-7, -5], [-1, -8], [0, -6], [6, 6], [1, 8], [5, -7], [-5, 7], [-7, 0], [6, -1], [3, 1], [-2, -2], [-2, 2], [-7, -3], [-3, 10], [4, -9], [0, -4], [6, 4], [4, 9], [5, -5], [-5, 5], [-1, -6], [1, 6], [-6, -7], [-2, 0], [-1, -10], [-7, -1], [1, 10], [0, -2], [6, 2], [5, -3], [-5, 3], [-1, -4], [1, 4], [-5, -9], [-6, -5], [9, 5], [-8, 6], [-3, 8], [4, -7], [4, 7], [6, 0], [5, -1], [-5, 1], [-2, -10], [-1, -2], [1, 2], [-2, 10], [-6, -3], [9, 3], [3, -9], [-8, 4], [4, -5], [4, 5], [-3, 6], [-5, -7], [0, 10], [1, 0], [-6, -1], [9, 1], [-8, 2], [-3, -10], [4, -3], [4, 3], [-4, -9], [9, -4], [-3, 4], [-1, 9], [-5, -5], [7, 6], [2, 8], [3, -7], [-6, 7], [-8, 0], [4, -1], [4, 1], [-1, 10], [9, -2], [-3, 2], [-5, -3], [2, -9], [7, 4], [3, -5], [-6, 5], [5, 9], [8, -6], [2, 6], [-4, -7], [-1, 7], [-3, 0], [-5, -1], [7, 2], [10, 2], [3, -3], [-6, 3], [-3, -9], [8, -4], [2, 4], [0, 9], [-4, -5], [-1, 5], [-4, 8], [2, -7], [5, 7], [7, 0], [10, 0], [3, -1], [-6, 1], [8, -2], [2, 2], [-10, -3], [-4, -3], [-1, 3], [1, -9], [-9, -4], [-9, 4], [2, -5], [5, 5], [7, -6], [-4, 6], [-3, -7], [0, 7], [2, 0], [-10, -1], [-4, -1], [-1, 1], [-9, -2], [-9, 2], [2, -3], [5, 3], [-2, -9], [7, -4], [-4, 4], [-2, 9], [-3, -5], [0, 5], [6, -8], [-8, -6], [8, 6], [3, 8], [1, -7], [-7, 7], [-9, 0], [2, -1], [5, 1], [7, -2], [10, -2], [-10, 2], [-4, 2], [-3, -3], [0, 3], [0, -9], [-8, -4], [8, 4], [1, -5], [-7, 5], [6, -6], [3, 6], [-2, -7], [-2, 7], [-10, 0], [-4, 0], [-3, -1], [0, 1], [-8, -2], [8, 2], [1, -3], [-7, 3], [-1, -9], [6, -4], [3, 4], [1, 9], [-2, -5], [-2, 5], [5, -8], [-7, -6], [-5, 8], [0, -7], [6, 7], [8, 0], [1, -1], [-7, 1], [6, -2], [3, 2], [-2, -3], [-2, 3], [-7, -4], [0, -5], [6, 5], [-6, -8], [5, -6], [-5, 6], [-1, -7], [1, 7], [3, 0], [-2, -1], [-2, 1], [-7, -2], [0, -3], [6, 3], [5, -4], [-5, 4], [-3, 9], [-1, -5], [1, 5], [4, -8], [-6, -6], [4, 8]]; + expected = [[0, 10], [0, -10], [-10, 0], [-9, 0], [-8, 0], [-7, 0], [-6, 0], [-5, 0], [-4, 0], [-3, 0], [-2, 0], [-1, 0], [0, 0], [1, 0], [2, 0], [3, 0], [4, 0], [5, 0], [6, 0], [7, 0], [8, 0], [9, 0], [10, 0], [-1, -10], [1, -10], [-10, -1], [-9, -1], [-8, -1], [-7, -1], [-6, -1], [-5, -1], [-4, -1], [-3, -1], [-2, -1], [-1, -1], [0, -1], [1, -1], [2, -1], [3, -1], [4, -1], [5, -1], [6, -1], [7, -1], [8, -1], [9, -1], [10, -1], [-10, 1], [-9, 1], [-8, 1], [-7, 1], [-6, 1], [-5, 1], [-4, 1], [-3, 1], [-2, 1], [-1, 1], [0, 1], [1, 1], [2, 1], [3, 1], [4, 1], [5, 1], [6, 1], [7, 1], [8, 1], [9, 1], [10, 1], [-1, 10], [1, 10], [-2, -10], [2, -10], [-10, -2], [-9, -2], [-8, -2], [-7, -2], [-6, -2], [-5, -2], [-4, -2], [-3, -2], [-2, -2], [-1, -2], [0, -2], [1, -2], [2, -2], [3, -2], [4, -2], [5, -2], [6, -2], [7, -2], [8, -2], [9, -2], [10, -2], [-10, 2], [-9, 2], [-8, 2], [-7, 2], [-6, 2], [-5, 2], [-4, 2], [-3, 2], [-2, 2], [-1, 2], [0, 2], [1, 2], [2, 2], [3, 2], [4, 2], [5, 2], [6, 2], [7, 2], [8, 2], [9, 2], [10, 2], [-2, 10], [2, 10], [-3, -10], [3, -10], [-10, -3], [-9, -3], [-8, -3], [-7, -3], [-6, -3], [-5, -3], [-4, -3], [-3, -3], [-2, -3], [-1, -3], [0, -3], [1, -3], [2, -3], [3, -3], [4, -3], [5, -3], [6, -3], [7, -3], [8, -3], [9, -3], [10, -3], [-10, 3], [-9, 3], [-8, 3], [-7, 3], [-6, 3], [-5, 3], [-4, 3], [-3, 3], [-2, 3], [-1, 3], [0, 3], [1, 3], [2, 3], [3, 3], [4, 3], [5, 3], [6, 3], [7, 3], [8, 3], [9, 3], [10, 3], [-3, 10], [3, 10], [-4, -9], [-3, -9], [-2, -9], [-1, -9], [0, -9], [1, -9], [2, -9], [3, -9], [4, -9], [-9, -4], [-8, -4], [-7, -4], [-6, -4], [-5, -4], [-4, -4], [-3, -4], [-2, -4], [-1, -4], [0, -4], [1, -4], [2, -4], [3, -4], [4, -4], [5, -4], [6, -4], [7, -4], [8, -4], [9, -4], [-9, 4], [-8, 4], [-7, 4], [-6, 4], [-5, 4], [-4, 4], [-3, 4], [-2, 4], [-1, 4], [0, 4], [1, 4], [2, 4], [3, 4], [4, 4], [5, 4], [6, 4], [7, 4], [8, 4], [9, 4], [-4, 9], [-3, 9], [-2, 9], [-1, 9], [0, 9], [1, 9], [2, 9], [3, 9], [4, 9], [-5, -9], [5, -9], [-9, -5], [-8, -5], [-7, -5], [-6, -5], [-5, -5], [-4, -5], [-3, -5], [-2, -5], [-1, -5], [0, -5], [1, -5], [2, -5], [3, -5], [4, -5], [5, -5], [6, -5], [7, -5], [8, -5], [9, -5], [-9, 5], [-8, 5], [-7, 5], [-6, 5], [-5, 5], [-4, 5], [-3, 5], [-2, 5], [-1, 5], [0, 5], [1, 5], [2, 5], [3, 5], [4, 5], [5, 5], [6, 5], [7, 5], [8, 5], [9, 5], [-5, 9], [5, 9], [-6, -8], [-5, -8], [-4, -8], [-3, -8], [-2, -8], [-1, -8], [0, -8], [1, -8], [2, -8], [3, -8], [4, -8], [5, -8], [6, -8], [-8, -6], [-7, -6], [-6, -6], [-5, -6], [-4, -6], [-3, -6], [-2, -6], [-1, -6], [0, -6], [1, -6], [2, -6], [3, -6], [4, -6], [5, -6], [6, -6], [7, -6], [8, -6], [-8, 6], [-7, 6], [-6, 6], [-5, 6], [-4, 6], [-3, 6], [-2, 6], [-1, 6], [0, 6], [1, 6], [2, 6], [3, 6], [4, 6], [5, 6], [6, 6], [7, 6], [8, 6], [-6, 8], [-5, 8], [-4, 8], [-3, 8], [-2, 8], [-1, 8], [0, 8], [1, 8], [2, 8], [3, 8], [4, 8], [5, 8], [6, 8], [-7, -7], [-6, -7], [-5, -7], [-4, -7], [-3, -7], [-2, -7], [-1, -7], [0, -7], [1, -7], [2, -7], [3, -7], [4, -7], [5, -7], [6, -7], [7, -7], [-7, 7], [-6, 7], [-5, 7], [-4, 7], [-3, 7], [-2, 7], [-1, 7], [0, 7], [1, 7], [2, 7], [3, 7], [4, 7], [5, 7], [6, 7], [7, 7]]; actual = vx_circle(10, true); + assertEqualPoints(expected, actual); } diff --git a/test/voxel/test_vx_polygon.scad b/test/voxel/test_vx_polygon.scad index f3026809..c1ba2a86 100644 --- a/test/voxel/test_vx_polygon.scad +++ b/test/voxel/test_vx_polygon.scad @@ -4,11 +4,11 @@ use ; module test_vx_polygon() { echo("==== test_vx_polygon ===="); - expected = [[-5, -10], [-5, -9], [-4, -9], [-6, -8], [-4, -8], [-6, -7], [-3, -7], [-6, -6], [-3, -6], [-7, -5], [-2, -5], [-7, -4], [-2, -4], [-7, -3], [-1, -3], [-8, -2], [-1, -2], [-8, -1], [0, -1], [-8, 0], [0, 0], [-9, 1], [1, 1], [-9, 2], [1, 2], [-9, 3], [2, 3], [-10, 4], [2, 4], [-10, 5], [-9, 5], [3, 5], [-8, 6], [-7, 6], [-6, 6], [3, 6], [-5, 7], [-4, 7], [-3, 7], [4, 7], [-2, 8], [-1, 8], [0, 8], [4, 8], [1, 9], [2, 9], [3, 9], [5, 9], [4, 10], [5, 10]]; + 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); assertEqualPoints(expected, actual); - expected2 = [[-6, 6], [0, 8], [-1, -1], [-5, 1], [-8, 3], [-3, 4], [2, 5], [-1, 7], [-3, -7], [-7, -3], [-8, -2], [0, -1], [-9, 3], [3, 5], [-7, 6], [-4, -6], [-5, -5], [-6, -4], [-6, 1], [-1, 2], [0, 3], [-4, 4], [-2, 7], [1, 8], [-8, 6], [-3, 7], [-2, -3], [-3, -2], [-4, -1], [-7, 1], [-2, 2], [1, 3], [-5, 4], [2, 8], [-4, -9], [-6, -7], [2, 3], [-10, 5], [-4, 7], [-5, -8], [-8, 1], [-3, 2], [-6, 4], [-1, 5], [0, 6], [3, 8], [-9, 1], [-5, 7], [4, 8], [5, 10], [-3, -5], [-4, -4], [-5, -3], [-6, -2], [-7, -1], [-1, 0], [0, 1], [-4, 2], [-7, 4], [-2, 5], [1, 6], [-1, -2], [1, 1], [-1, 8], [-2, -1], [-2, 0], [-5, 2], [-8, 4], [-3, 5], [2, 6], [-7, -4], [3, 6], [-2, 8], [1, 9], [-4, -7], [-5, -6], [-6, -5], [-3, 0], [-6, 2], [-1, 3], [-9, 4], [0, 4], [-4, 5], [-5, -10], [-2, -4], [2, 9], [-3, -3], [-4, -2], [-5, -1], [-4, 0], [-7, 2], [-2, 3], [1, 4], [-5, 5], [-5, -9], [-6, -8], [2, 4], [3, 9], [-5, 0], [-8, 2], [-3, 3], [-6, 5], [-1, 6], [0, 7], [-3, -6], [-8, -1], [-9, 2], [-4, -5], [-5, -4], [-6, -3], [-7, -2], [-6, 0], [-1, 1], [0, 2], [-4, 3], [-7, 5], [-2, 6], [1, 7], [4, 9], [-1, -3], [1, 2], [5, 9], [-2, -2], [-3, -1], [-7, 0], [-2, 1], [-5, 3], [-8, 5], [-3, 6], [2, 7], [-4, -8], [-6, -6], [-7, -5], [-8, 0], [-10, 4], [-9, 5], [-5, -7], [-3, 1], [-6, 3], [-1, 4], [0, 5], [-4, 6], [3, 7], [-2, -5], [0, 0], [4, 7], [4, 10], [-3, -4], [-4, -3], [-5, -2], [-6, -1], [-4, 1], [-7, 3], [-2, 4], [1, 5], [-5, 6]]; + expected2 = [[-5, -10], [-5, -9], [-4, -9], [-6, -8], [-4, -8], [-6, -7], [-3, -7], [-6, -6], [-3, -6], [-7, -5], [-2, -5], [-7, -4], [-2, -4], [-7, -3], [-1, -3], [-8, -2], [-1, -2], [-8, -1], [0, -1], [-8, 0], [0, 0], [-9, 1], [1, 1], [-9, 2], [1, 2], [-9, 3], [2, 3], [-10, 4], [2, 4], [-10, 5], [-9, 5], [3, 5], [-8, 6], [-7, 6], [-6, 6], [3, 6], [-5, 7], [-4, 7], [-3, 7], [4, 7], [-2, 8], [-1, 8], [0, 8], [4, 8], [1, 9], [2, 9], [3, 9], [5, 9], [4, 10], [5, 10], [-5, -8], [-5, -7], [-4, -7], [-5, -6], [-4, -6], [-6, -5], [-5, -5], [-4, -5], [-3, -5], [-6, -4], [-5, -4], [-4, -4], [-3, -4], [-6, -3], [-5, -3], [-4, -3], [-3, -3], [-2, -3], [-7, -2], [-6, -2], [-5, -2], [-4, -2], [-3, -2], [-2, -2], [-7, -1], [-6, -1], [-5, -1], [-4, -1], [-3, -1], [-2, -1], [-1, -1], [-7, 0], [-6, 0], [-5, 0], [-4, 0], [-3, 0], [-2, 0], [-1, 0], [-8, 1], [-7, 1], [-6, 1], [-5, 1], [-4, 1], [-3, 1], [-2, 1], [-1, 1], [0, 1], [-8, 2], [-7, 2], [-6, 2], [-5, 2], [-4, 2], [-3, 2], [-2, 2], [-1, 2], [0, 2], [-8, 3], [-7, 3], [-6, 3], [-5, 3], [-4, 3], [-3, 3], [-2, 3], [-1, 3], [0, 3], [1, 3], [-9, 4], [-8, 4], [-7, 4], [-6, 4], [-5, 4], [-4, 4], [-3, 4], [-2, 4], [-1, 4], [0, 4], [1, 4], [-8, 5], [-7, 5], [-6, 5], [-5, 5], [-4, 5], [-3, 5], [-2, 5], [-1, 5], [0, 5], [1, 5], [2, 5], [-5, 6], [-4, 6], [-3, 6], [-2, 6], [-1, 6], [0, 6], [1, 6], [2, 6], [-2, 7], [-1, 7], [0, 7], [1, 7], [2, 7], [3, 7], [1, 8], [2, 8], [3, 8], [4, 9]]; actual2 = vx_polygon([[5, 10], [-10, 5], [-5, -10]], true); assertEqualPoints(expected2, actual2); } diff --git a/test/voxel/test_vx_polyline.scad b/test/voxel/test_vx_polyline.scad index 387b49b4..11a4c288 100644 --- a/test/voxel/test_vx_polyline.scad +++ b/test/voxel/test_vx_polyline.scad @@ -4,7 +4,7 @@ use ; module test_vx_polyline() { echo("==== test_vx_polyline ===="); - expected = [[3, 8, 5], [4, 9, 5], [5, 10, 5], [-3, 2, 6], [-2, 3, 6], [-1, 4, 6], [0, 5, 6], [1, 6, 6], [2, 7, 6], [-9, -4, 7], [-8, -3, 7], [-7, -2, 7], [-6, -1, 7], [-5, 0, 7], [-4, 1, 7], [-15, -10, 8], [-14, -9, 8], [-13, -8, 8], [-12, -7, 8], [-11, -6, 8], [-10, -5, 8], [-21, -16, 9], [-20, -15, 9], [-19, -14, 9], [-18, -13, 9], [-17, -12, 9], [-16, -11, 9], [-25, -20, 10], [-25, -19, 10], [-24, -19, 10], [-25, -18, 10], [-23, -18, 10], [-25, -17, 10], [-22, -17, 10], [-25, -16, 11], [-25, -15, 11], [-25, -14, 11], [-25, -13, 11], [-25, -12, 11], [-25, -11, 11], [-25, -10, 11], [-25, -9, 12], [-25, -8, 12], [-25, -7, 12], [-25, -6, 12], [-25, -5, 12], [-25, -4, 12], [-25, -3, 12], [-25, -2, 13], [-25, -1, 13], [-25, 0, 13], [-25, 1, 13], [-25, 2, 13], [-25, 3, 13], [-25, 4, 13], [-25, 5, 14], [-25, 6, 14], [-25, 7, 14], [-25, 8, 14], [-25, 9, 14], [-25, 10, 14], [-25, 11, 14], [-25, 12, 15], [-25, 13, 15], [-25, 14, 15], [-25, 15, 15], [-24, 15, 15], [-23, 15, 15], [-22, 16, 15], [-21, 16, 15], [-20, 16, 16], [-19, 16, 16], [-18, 16, 16], [-17, 17, 16], [-16, 17, 16], [-15, 17, 16], [-14, 17, 16], [-13, 17, 16], [-12, 18, 16], [-11, 18, 16], [-10, 18, 17], [-9, 18, 17], [-8, 18, 17], [-7, 19, 17], [-6, 19, 17], [-5, 19, 17], [-4, 19, 17], [-3, 19, 17], [-2, 20, 17], [-1, 20, 17], [0, 20, 18], [1, 20, 18], [2, 20, 18], [3, 21, 18], [4, 21, 18], [5, 21, 18], [6, 21, 18], [7, 21, 18], [8, 22, 18], [9, 22, 18], [10, 22, 19], [11, 22, 19], [12, 22, 19], [13, 23, 19], [14, 23, 19], [15, 23, 19], [16, 23, 19], [17, 23, 19], [18, 24, 19], [19, 24, 19], [20, 24, 20], [21, 24, 20], [22, 24, 20], [23, 25, 20], [24, 25, 20]]; + expected = [[5, 10, 5], [4, 9, 5], [3, 8, 5], [2, 7, 6], [1, 6, 6], [0, 5, 6], [-1, 4, 6], [-2, 3, 6], [-3, 2, 6], [-4, 1, 7], [-5, 0, 7], [-6, -1, 7], [-7, -2, 7], [-8, -3, 7], [-9, -4, 7], [-10, -5, 8], [-11, -6, 8], [-12, -7, 8], [-13, -8, 8], [-14, -9, 8], [-15, -10, 8], [-16, -11, 9], [-17, -12, 9], [-18, -13, 9], [-19, -14, 9], [-20, -15, 9], [-21, -16, 9], [-22, -17, 10], [-23, -18, 10], [-24, -19, 10], [-25, -20, 10], [-25, -19, 10], [-25, -18, 10], [-25, -17, 10], [-25, -16, 11], [-25, -15, 11], [-25, -14, 11], [-25, -13, 11], [-25, -12, 11], [-25, -11, 11], [-25, -10, 11], [-25, -9, 12], [-25, -8, 12], [-25, -7, 12], [-25, -6, 12], [-25, -5, 12], [-25, -4, 12], [-25, -3, 12], [-25, -2, 13], [-25, -1, 13], [-25, 0, 13], [-25, 1, 13], [-25, 2, 13], [-25, 3, 13], [-25, 4, 13], [-25, 5, 14], [-25, 6, 14], [-25, 7, 14], [-25, 8, 14], [-25, 9, 14], [-25, 10, 14], [-25, 11, 14], [-25, 12, 15], [-25, 13, 15], [-25, 14, 15], [-25, 15, 15], [-24, 15, 15], [-23, 15, 15], [-22, 16, 15], [-21, 16, 15], [-20, 16, 16], [-19, 16, 16], [-18, 16, 16], [-17, 17, 16], [-16, 17, 16], [-15, 17, 16], [-14, 17, 16], [-13, 17, 16], [-12, 18, 16], [-11, 18, 16], [-10, 18, 17], [-9, 18, 17], [-8, 18, 17], [-7, 19, 17], [-6, 19, 17], [-5, 19, 17], [-4, 19, 17], [-3, 19, 17], [-2, 20, 17], [-1, 20, 17], [0, 20, 18], [1, 20, 18], [2, 20, 18], [3, 21, 18], [4, 21, 18], [5, 21, 18], [6, 21, 18], [7, 21, 18], [8, 22, 18], [9, 22, 18], [10, 22, 19], [11, 22, 19], [12, 22, 19], [13, 23, 19], [14, 23, 19], [15, 23, 19], [16, 23, 19], [17, 23, 19], [18, 24, 19], [19, 24, 19], [20, 24, 20], [21, 24, 20], [22, 24, 20], [23, 25, 20], [24, 25, 20]]; actual = vx_polyline([[5, 10, 5], [-25, -20, 10], [-25, 15, 15], [25, 25, 20]]); assertEqualPoints(expected, actual);