mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-16 19:54:29 +02:00
refactor
This commit is contained in:
@@ -26,6 +26,6 @@ function mz_hamiltonian(rows, columns, start) =
|
||||
[for(x = [0:columns * 2 - 1]) [x, 0]],
|
||||
[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);
|
@@ -4,7 +4,7 @@ use <util/sort.scad>;
|
||||
function px_surround(points) =
|
||||
let(
|
||||
// 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]
|
||||
)
|
||||
_px_surround_travel(sortedXY, fst, fst);
|
@@ -14,4 +14,4 @@ use <util/dedup.scad>;
|
||||
|
||||
function px_circle(radius, filled = false) =
|
||||
let(all = _px_circle_impl(radius, filled))
|
||||
dedup(sort(sort(all, by = "x"), by = "y"), sorted = true);
|
||||
dedup(sort(all, by = "vt"), sorted = true);
|
@@ -14,4 +14,4 @@ use <util/dedup.scad>;
|
||||
|
||||
function px_cylinder(r, h, filled = false, thickness = 1) =
|
||||
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);
|
@@ -7,7 +7,7 @@ function px_polygon(points, filled = false) =
|
||||
let(contour = px_polyline(concat(points, [points[0]])))
|
||||
!filled ? contour :
|
||||
let(
|
||||
sortedXY = sort(sort(contour, by = "x"), by = "y"),
|
||||
sortedXY = sort(contour, by = "vt"),
|
||||
ys = [for(p = sortedXY) p[1]],
|
||||
rows = [
|
||||
for(y = [min(ys):max(ys)])
|
||||
|
@@ -22,7 +22,7 @@ function px_polyline(points) =
|
||||
polyline = [for(line = __lines_from(pts)) each px_line(line[0], line[1])]
|
||||
)
|
||||
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);
|
Reference in New Issue
Block a user