mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-19 04:51:26 +02:00
add doc
This commit is contained in:
BIN
docs/images/lib2x-vrn2_cells_from-1.JPG
Normal file
BIN
docs/images/lib2x-vrn2_cells_from-1.JPG
Normal file
Binary file not shown.
After Width: | Height: | Size: 46 KiB |
35
docs/lib2x-vrn2_cells_from.md
Normal file
35
docs/lib2x-vrn2_cells_from.md
Normal 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);
|
||||
}
|
||||
|
||||

|
Reference in New Issue
Block a user