1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-11 17:24:20 +02:00

dot notation indexing

This commit is contained in:
Justin Lin
2021-12-04 11:23:04 +08:00
parent bd8f755a6c
commit e7c38fa876
4 changed files with 9 additions and 9 deletions

View File

@@ -17,8 +17,8 @@ use <tri_delaunay_voronoi.scad>;
function tri_delaunay(points, ret = "TRI_INDICES") = function tri_delaunay(points, ret = "TRI_INDICES") =
let( let(
_indices_hash = function(indices) indices[3], _indices_hash = function(indices) indices[3],
xs = [for(p = points) p[0]], xs = [for(p = points) p.x],
ys = [for(p = points) p[1]], ys = [for(p = points) p.y],
max_x = max(xs), max_x = max(xs),
min_x = min(xs), min_x = min(xs),
max_y = max(ys), max_y = max(ys),

View File

@@ -18,10 +18,10 @@ function tri_incenter(shape_pts) =
c = norm(pa - pb) c = norm(pa - pb)
) )
(len(pa) == 2 ? [ (len(pa) == 2 ? [
(a * pa[0] + b * pb[0] + c * pc[0]), (a * pa.x + b * pb.x + c * pc.x),
(a * pa[1] + b * pb[1] + c * pc[1]) (a * pa.y + b * pb.y + c * pc.y)
] : [ ] : [
(a * pa[0] + b * pb[0] + c * pc[0]), (a * pa.x + b * pb.x + c * pc.x),
(a * pa[1] + b * pb[1] + c * pc[1]), (a * pa.y + b * pb.y + c * pc.y),
(a * pa[2] + b * pb[2] + c * pc[2]) (a * pa.z + b * pb.z + c * pc.z)
]) / (a + b + c); ]) / (a + b + c);

View File

@@ -13,7 +13,7 @@ use <turtle2d.scad>;
function footprints2(cmds, start = [0, 0]) = function footprints2(cmds, start = [0, 0]) =
let( let(
t = turtle2d("create", start[0], start[1], 0), t = turtle2d("create", start.x, start.y, 0),
leng = len(cmds) leng = len(cmds)
) )
concat([turtle2d("pt", t)], _footprints2(cmds, t, leng)); concat([turtle2d("pt", t)], _footprints2(cmds, t, leng));

View File

@@ -21,7 +21,7 @@ function lsystem2(axiom, rules, n, angle, leng = 1, heading = 0, start = [0, 0],
]) ])
) )
_lines( _lines(
turtle2d("create", start[0], start[0], heading), turtle2d("create", start.x, start.y, heading),
codes, codes,
angle, angle,
leng leng