1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-01-17 14:18:13 +01:00
dotSCAD/docs/lib3x-vrn3_from.md

71 lines
1.3 KiB
Markdown
Raw Normal View History

2020-07-07 11:31:49 +08:00
# vrn3_from
2020-11-04 13:15:31 +08:00
Create a 3D version of [Voronoi diagram](https://en.wikipedia.org/wiki/Voronoi_diagram).
2020-07-07 11:31:49 +08:00
**Since:** 2.4
## Parameters
- `points` : Points for each cell.
- `spacing` : Distance between cells. Default to 1.
## Examples
2022-06-06 13:11:46 +08:00
use <voronoi/vrn3_from.scad>
2020-07-07 11:31:49 +08:00
r = 30;
zas = rands(0, 359, 12);
yas = rands(0, 179, 12);
points = [
for(i = [0:len(zas) - 1])
[
r * cos(yas[i]) * cos(zas[i]),
r * cos(yas[i]) * sin(zas[i]),
r * sin(yas[i])
]
];
#for(pt = points) {
translate(pt) cube(1);
}
intersection() {
sphere(r);
vrn3_from(points);
}
2021-02-24 21:09:54 +08:00
![vrn3_from](images/lib3x-vrn3_from-1.JPG)
2020-07-07 11:31:49 +08:00
2022-06-06 13:11:46 +08:00
use <voronoi/vrn3_from.scad>
2020-07-07 11:31:49 +08:00
r = 30;
thickness = 2;
zas = rands(0, 359, 12);
yas = rands(0, 179, 12);
points = [
for(i = [0:len(zas) - 1])
[
r * cos(yas[i]) * cos(zas[i]),
r * cos(yas[i]) * sin(zas[i]),
r * sin(yas[i])
]
];
2022-04-06 17:44:11 +08:00
2020-07-07 11:31:49 +08:00
difference() {
sphere(r);
render()
scale(1.01)
intersection() {
sphere(r);
vrn3_from(points);
}
sphere(r - thickness);
}
2021-02-24 21:09:54 +08:00
![vrn3_from](images/lib3x-vrn3_from-2.JPG)