1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-17 20:11:50 +02:00
This commit is contained in:
Justin Lin
2020-03-13 12:57:13 +08:00
parent 4b12e00759
commit 711c9b902d
6 changed files with 7 additions and 7 deletions

View File

@@ -26,6 +26,6 @@ function mz_hamiltonian(rows, columns, start) =
[for(x = [0:columns * 2 - 1]) [x, 0]], [for(x = [0:columns * 2 - 1]) [x, 0]],
[for(y = [0:rows * 2 - 1]) [0, y]] [for(y = [0:rows * 2 - 1]) [0, y]]
), ),
dot_pts = dedup(sort(sort(all, by = "x"), by = "y"), sorted = true) dot_pts = dedup(sort(all, by = "vt"), sorted = true)
) )
_mz_hamiltonian_travel(dot_pts, start, rows * columns * 4); _mz_hamiltonian_travel(dot_pts, start, rows * columns * 4);

View File

@@ -4,7 +4,7 @@ use <util/sort.scad>;
function px_surround(points) = function px_surround(points) =
let( let(
// always start from the left-bottom pt // always start from the left-bottom pt
sortedXY = sort(sort(points, by = "x"), by = "y"), sortedXY = sort(points, by = "vt"),
fst = sortedXY[0] + [-1, -1] fst = sortedXY[0] + [-1, -1]
) )
_px_surround_travel(sortedXY, fst, fst); _px_surround_travel(sortedXY, fst, fst);

View File

@@ -14,4 +14,4 @@ use <util/dedup.scad>;
function px_circle(radius, filled = false) = function px_circle(radius, filled = false) =
let(all = _px_circle_impl(radius, filled)) let(all = _px_circle_impl(radius, filled))
dedup(sort(sort(all, by = "x"), by = "y"), sorted = true); dedup(sort(all, by = "vt"), sorted = true);

View File

@@ -14,4 +14,4 @@ use <util/dedup.scad>;
function px_cylinder(r, h, filled = false, thickness = 1) = function px_cylinder(r, h, filled = false, thickness = 1) =
let(all = _px_cylinder_impl(r, h, filled, thickness)) let(all = _px_cylinder_impl(r, h, filled, thickness))
dedup(sort(sort(sort(all, by = "x"), by = "y"), by = "z"), sorted = true); dedup(sort(all, by = "vt"), sorted = true);

View File

@@ -7,7 +7,7 @@ function px_polygon(points, filled = false) =
let(contour = px_polyline(concat(points, [points[0]]))) let(contour = px_polyline(concat(points, [points[0]])))
!filled ? contour : !filled ? contour :
let( let(
sortedXY = sort(sort(contour, by = "x"), by = "y"), sortedXY = sort(contour, by = "vt"),
ys = [for(p = sortedXY) p[1]], ys = [for(p = sortedXY) p[1]],
rows = [ rows = [
for(y = [min(ys):max(ys)]) for(y = [min(ys):max(ys)])

View File

@@ -22,7 +22,7 @@ function px_polyline(points) =
polyline = [for(line = __lines_from(pts)) each px_line(line[0], line[1])] polyline = [for(line = __lines_from(pts)) each px_line(line[0], line[1])]
) )
dedup(is_2d ? dedup(is_2d ?
sort(sort([for(pt = polyline) __to2d(pt)], by = "x"), by = "y") sort([for(pt = polyline) __to2d(pt)], by = "vt")
: :
sort(sort(sort(polyline, by = "x"), by = "y"), by = "z") sort(polyline, by = "vt")
, sorted = true); , sorted = true);