mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-11 09:14:29 +02:00
add space_type parameter
This commit is contained in:
@@ -2,7 +2,7 @@ include <__private__/__angy_angz.scad>;
|
|||||||
|
|
||||||
// slow but workable
|
// slow but workable
|
||||||
|
|
||||||
module voronoi3d(points, spacing = 1) {
|
module voronoi3d(points, spacing = 1, space_type = "cube") {
|
||||||
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])];
|
||||||
zs = [for(p = points) abs(p[2])];
|
zs = [for(p = points) abs(p[2])];
|
||||||
@@ -21,8 +21,13 @@ module voronoi3d(points, spacing = 1) {
|
|||||||
|
|
||||||
translate((pt + p) / 2 - normalize(v) * offset_leng)
|
translate((pt + p) / 2 - normalize(v) * offset_leng)
|
||||||
rotate([0, -ryz[0], ryz[1]])
|
rotate([0, -ryz[0], ryz[1]])
|
||||||
|
if(space_type == "cube") {
|
||||||
cube(space_size, center = true);
|
cube(space_size, center = true);
|
||||||
}
|
}
|
||||||
|
else if(space_type == "sphere") {
|
||||||
|
cube(half_space_size);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user