1
0
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:
Justin Lin
2019-05-25 14:39:43 +08:00
parent 90f860cbc7
commit 5615800a56

View File

@@ -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]];
ys = [for(p = points) abs(p[1])];
@@ -14,8 +14,14 @@ module voronoi(points, spacing = 1, r = 0, delta = 0, chamfer = false) {
v = p - pt;
translate((pt + p) / 2 - normalize(v) * offset_leng)
rotate(90 + atan2(v[1], v[0]))
if(region_type == "square") {
square(region_size, center = true);
}
else if(region_type == "circle") {
circle(region_size / 2);
}
}
}
}