1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-12 01:34:12 +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") =
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),

View File

@@ -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);

View File

@@ -13,7 +13,7 @@ use <turtle2d.scad>;
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));

View File

@@ -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