diff --git a/README.md b/README.md index e576a451..b61c4c2d 100644 --- a/README.md +++ b/README.md @@ -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 ---- diff --git a/docs/images/lib2x-vrn3-from-1.JPG b/docs/images/lib2x-vrn3-from-1.JPG new file mode 100644 index 00000000..2557f9cc Binary files /dev/null and b/docs/images/lib2x-vrn3-from-1.JPG differ diff --git a/docs/images/lib2x-vrn3-from-2.JPG b/docs/images/lib2x-vrn3-from-2.JPG new file mode 100644 index 00000000..ed780011 Binary files /dev/null and b/docs/images/lib2x-vrn3-from-2.JPG differ diff --git a/docs/lib2x-vrn3_from.md b/docs/lib2x-vrn3_from.md new file mode 100644 index 00000000..f33a6c65 --- /dev/null +++ b/docs/lib2x-vrn3_from.md @@ -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 ; + + 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 ; + + 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) \ No newline at end of file