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

35 lines
718 B
Markdown
Raw Normal View History

2020-06-20 14:48:19 +08:00
# vrn2_cells_from
2020-11-04 13:15:31 +08:00
Create cell shapes of Voronoi from a list of points.
2020-06-20 14:48:19 +08:00
**Since:** 2.4
## Parameters
- `points` : Points for each cell.
## Examples
2021-12-04 10:57:29 +08:00
use <polyline_join.scad>;
2020-06-20 14:48:19 +08:00
use <voronoi/vrn2_cells_from.scad>;
2021-04-24 12:00:12 +08:00
points = [for(i = [0:50]) rands(-100, 100, 2)];
2020-06-20 14:48:19 +08:00
cells = vrn2_cells_from(points);
for(i = [0:len(points) - 1]) {
pt = points[i];
cell = cells[i];
linear_extrude(1)
polyline_join([each cell, cell[0]])
2021-12-04 10:57:29 +08:00
circle(.5);
2020-06-20 14:48:19 +08:00
color(rands(0, 1, 3))
translate(pt)
linear_extrude(2, scale = 0.8)
translate(-pt)
polygon(cell);
}
2021-02-24 21:09:54 +08:00
![vrn2_cells_from](images/lib3x-vrn2_cells_from-1.JPG)