mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-01-16 13:50:05 +01:00
1.2 KiB
1.2 KiB
tri_delaunay
Join a set of points to make a Delaunay triangulation.
Since: 3.0
Parameters
points
: A list of points.ret
: The type of returned data. Default to"TRI_INDICES"
which returns the indices of thepoints
."TRI_SHAPES"
returns triangle shapes."VORONOI_CELLS"
returns voronoi cells."DELAUNAY"
returns a delaunay object which can be processed bytri_delaunay_indices
,tri_delaunay_shapes
andtri_delaunay_voronoi
.
Examples
use <triangle/tri_delaunay.scad>
use <polyline_join.scad>
points = [for(i = [0:20]) rands(-100, 100, 2)];
tris = [for(ti = tri_delaunay(points)) [for(i = ti) points[i]]];
linear_extrude(1)
for(t = tris) {
polygon(t);
}
color("black")
linear_extrude(2)
for(t = tri_delaunay(points, ret = "TRI_SHAPES")) {
offset(-1)
polygon(t);
}
color("red")
linear_extrude(3)
for(t = tri_delaunay(points, ret = "VORONOI_CELLS")) {
polyline_join([each t, t[0]])
circle(1);
}