mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-07-30 19:40:24 +02:00
add voronoi_bracelet
This commit is contained in:
40
examples/voronoi_bracelet.scad
Normal file
40
examples/voronoi_bracelet.scad
Normal file
@@ -0,0 +1,40 @@
|
||||
include <hollow_out.scad>;
|
||||
include <voronoi2d.scad>;
|
||||
include <bend_extrude.scad>;
|
||||
|
||||
r = 35;
|
||||
height = 35;
|
||||
thickness = 2.5;
|
||||
n = 25;
|
||||
frags = 24;
|
||||
offset_r = 0.5;
|
||||
region_type = "square"; // [square, circle]
|
||||
|
||||
module voronoi_bracelet(r, height, thickness, n, frags, offset_r, region_type) {
|
||||
$fn = 12;
|
||||
|
||||
x = 2 * PI * r - thickness;
|
||||
y = height;
|
||||
|
||||
xs = rands(0, x, n);
|
||||
ys = rands(0, y, n);
|
||||
|
||||
points = [for(i = [0: len(xs) - 1]) [xs[i], ys[i]]];
|
||||
|
||||
bend_extrude(
|
||||
size = [x, y],
|
||||
thickness = thickness,
|
||||
angle = 360 * (1 - thickness / (2 * PI * r)),
|
||||
frags = frags
|
||||
)
|
||||
{
|
||||
difference() {
|
||||
square([x, y]);
|
||||
voronoi2d(points, spacing = thickness, r = offset_r, region_type = region_type);
|
||||
}
|
||||
hollow_out(thickness * 1.5)
|
||||
square([x, y]);
|
||||
}
|
||||
}
|
||||
|
||||
voronoi_bracelet(r, height, thickness, n, frags, offset_r, region_type);
|
Reference in New Issue
Block a user