diff --git a/src/experimental/_impl/_px_contour_impl.scad b/src/experimental/_impl/_vx_contour_impl.scad similarity index 67% rename from src/experimental/_impl/_px_contour_impl.scad rename to src/experimental/_impl/_vx_contour_impl.scad index 4c42ac8e..79137f3a 100644 --- a/src/experimental/_impl/_px_contour_impl.scad +++ b/src/experimental/_impl/_vx_contour_impl.scad @@ -1,6 +1,6 @@ use ; -function _px_contour_corner_value(pts, x, y) = +function _vx_contour_corner_value(pts, x, y) = let( c1 = has(pts, [x, y - 1], sorted = true) || has(pts, [x - 1, y - 1], sorted = true) ? 1 : 0, c2 = has(pts, [x - 1, y], sorted = true) || has(pts, [x - 1, y + 1], sorted = true) ? 2 : 0, @@ -9,27 +9,27 @@ function _px_contour_corner_value(pts, x, y) = ) c1 + c2 + c3 + c4; -_px_contour_dir_table = [ +_vx_contour_dir_table = [ [4, 0], [6, 0], [7, 0], // RIGHT [8, 1], [12, 1], [14, 1], // DOWN [2, 2], [3, 2], [11, 2], // UP [1, 3], [9, 3], [13, 3] // LEFT ]; -function _px_contour_dir(cr_value) = - lookup(cr_value, _px_contour_dir_table); +function _vx_contour_dir(cr_value) = + lookup(cr_value, _vx_contour_dir_table); -_px_contour_nxt_offset = [ +_vx_contour_nxt_offset = [ [1, 0], // RIGHT [0, -1], // DOWN [0, 1], // UP [-1, 0] // LEFT ]; -function _px_contour_travel(pts, p, fst) = +function _vx_contour_travel(pts, p, fst) = let( - dir_i = _px_contour_dir(_px_contour_corner_value(pts, p[0], p[1])), - nxt_p = p + _px_contour_nxt_offset[dir_i] + dir_i = _vx_contour_dir(_vx_contour_corner_value(pts, p[0], p[1])), + nxt_p = p + _vx_contour_nxt_offset[dir_i] ) nxt_p == fst ? [p] : concat( - [p], _px_contour_travel(pts, nxt_p, fst) + [p], _vx_contour_travel(pts, nxt_p, fst) ); diff --git a/src/experimental/demo/px_contour_demo.scad b/src/experimental/demo/vx_contour_demo.scad similarity index 57% rename from src/experimental/demo/px_contour_demo.scad rename to src/experimental/demo/vx_contour_demo.scad index 47657b7b..cd85804b 100644 --- a/src/experimental/demo/px_contour_demo.scad +++ b/src/experimental/demo/vx_contour_demo.scad @@ -1,27 +1,27 @@ -use ; -use ; +use ; +use ; use ; use ; -use ; +use ; -pts = px_circle(10, true); +pts = vx_circle(10, true); for(p = pts) { translate(p) square(1, center = true); } -#hull_polyline2d(px_contour(pts), width = .1); +#hull_polyline2d(vx_contour(pts), width = .1); pentagram = [ for(pt = shape_pentagram(15)) [round(pt[0]), round(pt[1])] ]; -pts2 = px_polyline(concat(pentagram, [pentagram[0]])); +pts2 = vx_polyline(concat(pentagram, [pentagram[0]])); translate([30, 0]) { for(pt = pts2) { translate(pt) linear_extrude(1, scale = 0.5) square(1, center = true); } - #hull_polyline2d(px_contour(pts2), width = .1); + #hull_polyline2d(vx_contour(pts2), width = .1); } \ No newline at end of file diff --git a/src/experimental/px_contour.scad b/src/experimental/vx_contour.scad similarity index 57% rename from src/experimental/px_contour.scad rename to src/experimental/vx_contour.scad index 6bae9188..f00d4881 100644 --- a/src/experimental/px_contour.scad +++ b/src/experimental/vx_contour.scad @@ -1,10 +1,10 @@ -use ; +use ; use ; -function px_contour(points) = +function vx_contour(points) = let( // always start from the left-bottom pt sortedXY = sort(points, by = "vt"), fst = sortedXY[0] + [-1, -1] ) - _px_contour_travel(sortedXY, fst, fst); \ No newline at end of file + _vx_contour_travel(sortedXY, fst, fst); \ No newline at end of file