mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-17 20:11:50 +02:00
add region_type
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
module voronoi(points, spacing = 1, r = 0, delta = 0, chamfer = false) {
|
module voronoi(points, spacing = 1, r = 0, delta = 0, chamfer = false, region_type = "square") {
|
||||||
xs = [for(p = points) p[0]];
|
xs = [for(p = points) p[0]];
|
||||||
ys = [for(p = points) abs(p[1])];
|
ys = [for(p = points) abs(p[1])];
|
||||||
|
|
||||||
@@ -14,7 +14,13 @@ module voronoi(points, spacing = 1, r = 0, delta = 0, chamfer = false) {
|
|||||||
v = p - pt;
|
v = p - pt;
|
||||||
translate((pt + p) / 2 - normalize(v) * offset_leng)
|
translate((pt + p) / 2 - normalize(v) * offset_leng)
|
||||||
rotate(90 + atan2(v[1], v[0]))
|
rotate(90 + atan2(v[1], v[0]))
|
||||||
|
if(region_type == "square") {
|
||||||
square(region_size, center = true);
|
square(region_size, center = true);
|
||||||
|
}
|
||||||
|
else if(region_type == "circle") {
|
||||||
|
circle(region_size / 2);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user