mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-19 13:01:37 +02:00
change default value
This commit is contained in:
@@ -3,17 +3,11 @@ use <hull_polyline2d.scad>;
|
||||
|
||||
points = [for(i = [0:20]) rands(-100, 100, 2)];
|
||||
|
||||
drawTris(tri_delaunay(points));
|
||||
module drawTris(pointsOfTriangles) {
|
||||
#for(t = pointsOfTriangles) {
|
||||
draw([for(ti = tri_delaunay(points)) [for(i = ti) points[i]]]);
|
||||
%draw(tri_delaunay(points, ret = "TRI_SHAPES"));
|
||||
|
||||
module draw(pointsOfTriangles) {
|
||||
for(t = pointsOfTriangles) {
|
||||
hull_polyline2d(concat(t, [t[0]]));
|
||||
}
|
||||
}
|
||||
|
||||
drawTris2(points, tri_delaunay(points, ret = "TRI_INDICES"));
|
||||
module drawTris2(points, indices) {
|
||||
pointsOfTriangles = [for(i = indices) [points[i[0]], points[i[1]], points[i[2]]]];
|
||||
%for(t = pointsOfTriangles) {
|
||||
hull_polyline2d(concat(t, [t[0]]), 2);
|
||||
}
|
||||
}
|
||||
|
@@ -4,7 +4,7 @@ use <tri_delaunay_indices.scad>;
|
||||
use <tri_delaunay_voronoi.scad>;
|
||||
|
||||
// ret: "TRI_SHAPES", "TRI_INDICES", "VORONOI_CELLS", "DELAUNAY"
|
||||
function tri_delaunay(points, ret = "TRI_SHAPES") =
|
||||
function tri_delaunay(points, ret = "TRI_INDICES") =
|
||||
let(
|
||||
xs = [for(p = points) p[0]],
|
||||
ys = [for(p = points) p[1]],
|
||||
@@ -17,7 +17,7 @@ function tri_delaunay(points, ret = "TRI_SHAPES") =
|
||||
height = abs(max_y - center[1]) * 4,
|
||||
d = _tri_delaunay(delaunay_init(center, width, height), points, len(points))
|
||||
)
|
||||
ret == "TRI_INDICES" ? tri_delaunay_indices(d) :
|
||||
ret == "TRI_SHAPES" ? tri_delaunay_shapes(d) :
|
||||
ret == "TRI_INDICES" ? tri_delaunay_indices(d) :
|
||||
ret == "VORONOI_CELLS" ? tri_delaunay_voronoi(d) :
|
||||
d; // "DELAUNAY": [coords(list), triangles(hashmap), circles(hashmap)]
|
Reference in New Issue
Block a user