1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-31 10:11:53 +02:00

shapt_pts accepts [[x, y], ...] format

This commit is contained in:
Justin Lin
2017-05-03 07:38:10 +08:00
parent c8673c2bfa
commit 376e2da117

View File

@@ -14,6 +14,9 @@
**/
module path_extrude(shape_pts, path_pts, triangles = "RADIAL", twist = 0, scale = 1.0) {
s_pts = len(shape_pts[0]) == 3 ? shape_pts : [for(p = shape_pts) [p[0], p[1], 0]];
function first_section() =
let(
p1 = path_pts[0],
@@ -25,7 +28,7 @@ module path_extrude(shape_pts, path_pts, triangles = "RADIAL", twist = 0, scale
az = atan2(dy, dx)
)
[
for(p = shape_pts)
for(p = s_pts)
rotate_p(p, [0, ay, az]) + p1
];
@@ -50,7 +53,7 @@ module path_extrude(shape_pts, path_pts, triangles = "RADIAL", twist = 0, scale
az = atan2(dy, dx)
)
[
for(p = shape_pts)
for(p = s_pts)
let(scaled_p = [p[0] * (1 + scale_step_x * i), p[1] * (1 + scale_step_y * i), p[2]])
rotate_p(
rotate_p(scaled_p, twist_step * i) + [0, 0, length],