mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-20 13:31:30 +02:00
wrong commit
This commit is contained in:
@@ -1,28 +1,11 @@
|
|||||||
use <hull_polyline2d.scad>;
|
use <experimental/_impl/_convex_hull_impl.scad>;
|
||||||
use <experimental/voronoi_lines.scad>;
|
|
||||||
use <experimental/convex_hull.scad>;
|
|
||||||
|
|
||||||
pt_nums = 50;
|
function convex_hull(points) =
|
||||||
width = 1;
|
let(
|
||||||
points = [for(i = [0:pt_nums - 1]) rands(-50, 50, 2)];
|
sorted = _convex_hull_sort_by_xy(points),
|
||||||
|
leng = len(sorted),
|
||||||
intersection() {
|
lwr_ch = _convex_hull_lower_chain(sorted, leng, [], 0, 0),
|
||||||
for(line = voronoi_lines(points)) {
|
leng_lwr_ch = len(lwr_ch),
|
||||||
hull_polyline2d(
|
chain = _convex_hull_upper_chain(sorted, lwr_ch, leng_lwr_ch, leng_lwr_ch + 1, leng - 2)
|
||||||
line,
|
)
|
||||||
width = width,
|
[for(i = [0:len(chain) - 2]) chain[i]];
|
||||||
$fn = 4
|
|
||||||
);
|
|
||||||
}
|
|
||||||
hull()
|
|
||||||
#for(p = points) {
|
|
||||||
translate(p)
|
|
||||||
circle(.5);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
hull_pts = convex_hull(points);
|
|
||||||
hull_polyline2d(
|
|
||||||
concat(hull_pts, [hull_pts[0]]),
|
|
||||||
width = width, $fn = 4
|
|
||||||
);
|
|
Reference in New Issue
Block a user