1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-23 14:54:12 +02:00
This commit is contained in:
Justin Lin
2020-07-07 11:31:49 +08:00
parent 99056988f5
commit 5805a88284
4 changed files with 74 additions and 1 deletions

View File

@@ -238,7 +238,7 @@ See [examples](examples).
- [voronoi/vrn2_space](https://openhome.cc/eGossip/OpenSCAD/lib2x-vrn2_space.html)
- [voronoi/vrn2_cells_from](https://openhome.cc/eGossip/OpenSCAD/lib2x-vrn2_cells_from.html)
- [voronoi/vrn2_cells_space](https://openhome.cc/eGossip/OpenSCAD/lib2x-vrn2_cells_space.html)
- voronoi/vrn3_from
- [voronoi/vrn3_from](https://openhome.cc/eGossip/OpenSCAD/lib2x-vrn3_from.html)
- voronoi/vrn3_space
----

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

73
docs/lib2x-vrn3_from.md Normal file
View File

@@ -0,0 +1,73 @@
# vrn3_from
Creats a 3D version of [Voronoi diagram](https://en.wikipedia.org/wiki/Voronoi_diagram).
**Since:** 2.4
## Parameters
- `points` : Points for each cell.
- `spacing` : Distance between cells. Default to 1.
## Examples
use <voronoi/vrn3_from.scad>;
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);
}
![vrn3_from](images/lib2x-vrn3_from-1.JPG)
use <voronoi/vrn3_from.scad>;
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])
]
];
thickness = 2;
difference() {
sphere(r);
render()
scale(1.01)
intersection() {
sphere(r);
vrn3_from(points);
}
sphere(r - thickness);
}
![vrn3_from](images/lib2x-vrn3_from-2.JPG)