From e7c38fa876d28e970e0325f9c0b2899b9b85f724 Mon Sep 17 00:00:00 2001 From: Justin Lin Date: Sat, 4 Dec 2021 11:23:04 +0800 Subject: [PATCH] dot notation indexing --- src/triangle/tri_delaunay.scad | 4 ++-- src/triangle/tri_incenter.scad | 10 +++++----- src/turtle/footprints2.scad | 2 +- src/turtle/lsystem2.scad | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/triangle/tri_delaunay.scad b/src/triangle/tri_delaunay.scad index 85c5892a..b0afa7d9 100644 --- a/src/triangle/tri_delaunay.scad +++ b/src/triangle/tri_delaunay.scad @@ -17,8 +17,8 @@ use ; function tri_delaunay(points, ret = "TRI_INDICES") = let( _indices_hash = function(indices) indices[3], - xs = [for(p = points) p[0]], - ys = [for(p = points) p[1]], + xs = [for(p = points) p.x], + ys = [for(p = points) p.y], max_x = max(xs), min_x = min(xs), max_y = max(ys), diff --git a/src/triangle/tri_incenter.scad b/src/triangle/tri_incenter.scad index c2b76918..91de127f 100644 --- a/src/triangle/tri_incenter.scad +++ b/src/triangle/tri_incenter.scad @@ -18,10 +18,10 @@ function tri_incenter(shape_pts) = c = norm(pa - pb) ) (len(pa) == 2 ? [ - (a * pa[0] + b * pb[0] + c * pc[0]), - (a * pa[1] + b * pb[1] + c * pc[1]) + (a * pa.x + b * pb.x + c * pc.x), + (a * pa.y + b * pb.y + c * pc.y) ] : [ - (a * pa[0] + b * pb[0] + c * pc[0]), - (a * pa[1] + b * pb[1] + c * pc[1]), - (a * pa[2] + b * pb[2] + c * pc[2]) + (a * pa.x + b * pb.x + c * pc.x), + (a * pa.y + b * pb.y + c * pc.y), + (a * pa.z + b * pb.z + c * pc.z) ]) / (a + b + c); \ No newline at end of file diff --git a/src/turtle/footprints2.scad b/src/turtle/footprints2.scad index b9df8e28..633ca8b7 100644 --- a/src/turtle/footprints2.scad +++ b/src/turtle/footprints2.scad @@ -13,7 +13,7 @@ use ; function footprints2(cmds, start = [0, 0]) = let( - t = turtle2d("create", start[0], start[1], 0), + t = turtle2d("create", start.x, start.y, 0), leng = len(cmds) ) concat([turtle2d("pt", t)], _footprints2(cmds, t, leng)); \ No newline at end of file diff --git a/src/turtle/lsystem2.scad b/src/turtle/lsystem2.scad index 9d5a767f..df965c5c 100644 --- a/src/turtle/lsystem2.scad +++ b/src/turtle/lsystem2.scad @@ -21,7 +21,7 @@ function lsystem2(axiom, rules, n, angle, leng = 1, heading = 0, start = [0, 0], ]) ) _lines( - turtle2d("create", start[0], start[0], heading), + turtle2d("create", start.x, start.y, heading), codes, angle, leng