1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-01-29 11:58:39 +01:00
This commit is contained in:
Justin Lin 2020-06-20 14:48:19 +08:00
parent fcbcdf2043
commit 42e989b055
4 changed files with 47 additions and 1 deletions

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

View File

@ -0,0 +1,35 @@
# vrn2_cells_from
Creats Voronoi shapes from a list of points.
**Since:** 2.4
## Parameters
- `points` : Points for each cell.
## Examples
use <hull_polyline2d.scad>;
use <voronoi/vrn2_cells_from.scad>;
xs1 = rands(-20, 20, 15);
ys1 = rands(-20, 20, 15);
points = [for(i = [0:len(xs1) - 1]) [xs1[i], ys1[i]]];
cells = vrn2_cells_from(points);
for(i = [0:len(points) - 1]) {
pt = points[i];
cell = cells[i];
linear_extrude(1)
hull_polyline2d(concat(cell, [cell[0]]), width = 1);
color(rands(0, 1, 3))
translate(pt)
linear_extrude(2, scale = 0.8)
translate(-pt)
polygon(cell);
}
![vrn2_cells_from](images/lib2x-vrn2_cells_from-1.JPG)

View File

@ -1,3 +1,14 @@
/**
* vrn2_cells_from.scad
*
* @copyright Justin Lin, 2020
* @license https://opensource.org/licenses/lgpl-3.0.html
*
* @see https://openhome.cc/eGossip/OpenSCAD/lib2x-vrn2_cells_from.html
*
**/
use <_impl/_vrn2_cells_from_impl.scad>;
use <_impl/_convex_intersection_for.scad>;
use <../shape_square.scad>;