1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-10 00:36:40 +02:00

add space_type parameter

This commit is contained in:
Justin Lin
2019-06-02 09:16:28 +08:00
parent b66c36fc55
commit 309a2086a3

View File

@@ -2,7 +2,7 @@ include <__private__/__angy_angz.scad>;
// slow but workable
module voronoi3d(points, spacing = 1) {
module voronoi3d(points, spacing = 1, space_type = "cube") {
xs = [for(p = points) p[0]];
ys = [for(p = points) abs(p[1])];
zs = [for(p = points) abs(p[2])];
@@ -21,7 +21,12 @@ module voronoi3d(points, spacing = 1) {
translate((pt + p) / 2 - normalize(v) * offset_leng)
rotate([0, -ryz[0], ryz[1]])
if(space_type == "cube") {
cube(space_size, center = true);
}
else if(space_type == "sphere") {
cube(half_space_size);
}
}
}
}