1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-09 08:16:50 +02:00
This commit is contained in:
Justin Lin
2022-03-18 16:19:27 +08:00
parent 3d24874d6d
commit f97366ccdf
3 changed files with 10 additions and 4 deletions

View File

@@ -8,11 +8,13 @@
*
**/
use <../__comm__/_pt2_hash.scad>;
use <_impl/_mz_wang_tiles_impl.scad>;
use <mz_square_cells.scad>;
use <mz_square_get.scad>;
use <../util/sort.scad>;
use <../util/dedup.scad>;
use <../util/set/hashset.scad>;
use <../util/set/hashset_elems.scad>;
function mz_wang_tiles(rows, columns, start = [0, 0], init_cells, seed) =
let(
@@ -37,7 +39,7 @@ function mz_wang_tiles(rows, columns, start = [0, 0], init_cells, seed) =
[for(x = [0:columns - 1]) [x * 2 + 1, 0]],
[for(y = [0:rows - 1]) [0, y * 2 + 1]]
),
dot_pts = dedup(sort(all, by = "vt"))
dot_pts = sort(hashset_elems(hashset(all, hash = function(p) _pt2_hash(p))), by = "vt")
)
[
for(y = [0:rows - 1], x = [0:columns - 1])

View File

@@ -8,6 +8,8 @@
*
**/
use <../__comm__/_pt2_hash.scad>;
use <../__comm__/_pt3_hash.scad>;
use <../__comm__/__to2d.scad>;
use <../__comm__/__to3d.scad>;
use <_impl/_vx_bezier_impl.scad>;
@@ -18,6 +20,6 @@ function vx_bezier(p1, p2, p3, p4) =
is2d = len(p1) == 2,
pts = is2d ? _vx_bezier2(__to3d(p1), __to3d(p2), __to3d(p3), __to3d(p4), []) :
_vx_bezier3(p1, p2, p3, p4, []),
deduped = dedup(pts)
deduped = dedup(pts, hash = is2d ? function(p) _pt2_hash(p) : function(p) _pt3_hash(p))
)
is2d ? [for(p = deduped) __to2d(p)] : deduped;

View File

@@ -8,6 +8,8 @@
*
**/
use <../__comm__/_pt2_hash.scad>;
use <../__comm__/_pt3_hash.scad>;
use <_impl/_vx_curve_impl.scad>;
use <../util/dedup.scad>;
@@ -22,4 +24,4 @@ function vx_curve(points, tightness = 0) =
for(i = [0:len(pts) - 2]) pts[i]
],
points[leng - 2]
]);
], hash = len(points[0]) == 2 ? function(p) _pt2_hash(p) : function(p) _pt3_hash(p));