mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-23 14:54:12 +02:00
add doc
This commit is contained in:
@@ -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
|
||||
|
||||
----
|
||||
|
BIN
docs/images/lib2x-vrn3-from-1.JPG
Normal file
BIN
docs/images/lib2x-vrn3-from-1.JPG
Normal file
Binary file not shown.
After Width: | Height: | Size: 50 KiB |
BIN
docs/images/lib2x-vrn3-from-2.JPG
Normal file
BIN
docs/images/lib2x-vrn3-from-2.JPG
Normal file
Binary file not shown.
After Width: | Height: | Size: 54 KiB |
73
docs/lib2x-vrn3_from.md
Normal file
73
docs/lib2x-vrn3_from.md
Normal 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);
|
||||
}
|
||||
|
||||

|
||||
|
||||
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);
|
||||
}
|
||||
|
||||

|
Reference in New Issue
Block a user