mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-07 07:16:36 +02:00
update demo
This commit is contained in:
@@ -1,11 +1,28 @@
|
|||||||
use <experimental/_impl/_convex_hull_impl.scad>;
|
use <hull_polyline2d.scad>;
|
||||||
|
use <experimental/voronoi_lines.scad>;
|
||||||
|
use <experimental/convex_hull.scad>;
|
||||||
|
|
||||||
function convex_hull(points) =
|
pt_nums = 50;
|
||||||
let(
|
width = 1;
|
||||||
sorted = _convex_hull_sort_by_xy(points),
|
points = [for(i = [0:pt_nums - 1]) rands(-50, 50, 2)];
|
||||||
leng = len(sorted),
|
|
||||||
lwr_ch = _convex_hull_lower_chain(sorted, leng, [], 0, 0),
|
intersection() {
|
||||||
leng_lwr_ch = len(lwr_ch),
|
for(line = voronoi_lines(points)) {
|
||||||
chain = _convex_hull_upper_chain(sorted, lwr_ch, leng_lwr_ch, leng_lwr_ch + 1, leng - 2)
|
hull_polyline2d(
|
||||||
)
|
line,
|
||||||
[for(i = [0:len(chain) - 2]) chain[i]];
|
width = width,
|
||||||
|
$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