mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-11 09:14:29 +02:00
prepared for supporting round-robin
This commit is contained in:
@@ -17,6 +17,17 @@ module path_extrude(shape_pts, path_pts, triangles = "RADIAL", twist = 0, scale
|
|||||||
|
|
||||||
s_pts = len(shape_pts[0]) == 3 ? shape_pts : [for(p = shape_pts) [p[0], p[1], 0]];
|
s_pts = len(shape_pts[0]) == 3 ? shape_pts : [for(p = shape_pts) [p[0], p[1], 0]];
|
||||||
|
|
||||||
|
len_path_pts = len(path_pts);
|
||||||
|
len_path_pts_minus_one = len_path_pts - 1;
|
||||||
|
|
||||||
|
scale_step_vt = len(scale) == 2 ?
|
||||||
|
[(scale[0] - 1) / len_path_pts_minus_one, (scale[1] - 1) / len_path_pts_minus_one] :
|
||||||
|
[(scale - 1) / len_path_pts_minus_one, (scale - 1) / len_path_pts_minus_one];
|
||||||
|
|
||||||
|
scale_step_x = scale_step_vt[0];
|
||||||
|
scale_step_y = scale_step_vt[1];
|
||||||
|
twist_step = twist / len_path_pts_minus_one;
|
||||||
|
|
||||||
function first_section() =
|
function first_section() =
|
||||||
let(
|
let(
|
||||||
p1 = path_pts[0],
|
p1 = path_pts[0],
|
||||||
@@ -32,17 +43,6 @@ module path_extrude(shape_pts, path_pts, triangles = "RADIAL", twist = 0, scale
|
|||||||
rotate_p(p, [0, ay, az]) + p1
|
rotate_p(p, [0, ay, az]) + p1
|
||||||
];
|
];
|
||||||
|
|
||||||
len_path_pts = len(path_pts);
|
|
||||||
len_path_pts_minus_one = len_path_pts - 1;
|
|
||||||
|
|
||||||
scale_step_vt = len(scale) == 2 ?
|
|
||||||
[(scale[0] - 1) / len_path_pts_minus_one, (scale[1] - 1) / len_path_pts_minus_one] :
|
|
||||||
[(scale - 1) / len_path_pts_minus_one, (scale - 1) / len_path_pts_minus_one];
|
|
||||||
|
|
||||||
scale_step_x = scale_step_vt[0];
|
|
||||||
scale_step_y = scale_step_vt[1];
|
|
||||||
twist_step = twist / len_path_pts_minus_one;
|
|
||||||
|
|
||||||
function section(p1, p2, i) =
|
function section(p1, p2, i) =
|
||||||
let(
|
let(
|
||||||
dx = p2[0] - p1[0],
|
dx = p2[0] - p1[0],
|
||||||
@@ -61,9 +61,6 @@ module path_extrude(shape_pts, path_pts, triangles = "RADIAL", twist = 0, scale
|
|||||||
) + p1
|
) + p1
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function path_extrude_inner(index) =
|
function path_extrude_inner(index) =
|
||||||
index == len_path_pts ? [] :
|
index == len_path_pts ? [] :
|
||||||
concat(
|
concat(
|
||||||
@@ -71,8 +68,12 @@ module path_extrude(shape_pts, path_pts, triangles = "RADIAL", twist = 0, scale
|
|||||||
path_extrude_inner(index + 1)
|
path_extrude_inner(index + 1)
|
||||||
);
|
);
|
||||||
|
|
||||||
polysections(
|
if(path_pts[0] == path_pts[len_path_pts_minus_one]) {
|
||||||
concat([first_section()], path_extrude_inner(1)),
|
|
||||||
triangles = triangles
|
} else {
|
||||||
);
|
polysections(
|
||||||
|
concat([first_section()], path_extrude_inner(1)),
|
||||||
|
triangles = triangles
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user