mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-11 01:04:07 +02:00
support scale
This commit is contained in:
@@ -13,7 +13,7 @@
|
|||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
|
|
||||||
module path_extend(stroke_pts, path_pts) {
|
module path_extend(stroke_pts, path_pts, scale = 1.0) {
|
||||||
function length(p1, p2) =
|
function length(p1, p2) =
|
||||||
let(
|
let(
|
||||||
x1 = p1[0],
|
x1 = p1[0],
|
||||||
@@ -32,6 +32,10 @@ module path_extend(stroke_pts, path_pts) {
|
|||||||
|
|
||||||
leng_path_pts = len(path_pts);
|
leng_path_pts = len(path_pts);
|
||||||
|
|
||||||
|
scale_step = (scale - 1) / (leng_path_pts - 1);
|
||||||
|
|
||||||
|
echo(scale_step);
|
||||||
|
|
||||||
function first_stroke() =
|
function first_stroke() =
|
||||||
let(
|
let(
|
||||||
p1 = path_pts[0],
|
p1 = path_pts[0],
|
||||||
@@ -43,20 +47,20 @@ module path_extend(stroke_pts, path_pts) {
|
|||||||
rotate_p(p, a) + p1
|
rotate_p(p, a) + p1
|
||||||
];
|
];
|
||||||
|
|
||||||
function stroke(p1, p2) =
|
function stroke(p1, p2, i) =
|
||||||
let(
|
let(
|
||||||
leng = length(p1, p2),
|
leng = length(p1, p2),
|
||||||
a = az(p1, p2)
|
a = az(p1, p2)
|
||||||
)
|
)
|
||||||
[
|
[
|
||||||
for(p = stroke_pts)
|
for(p = stroke_pts)
|
||||||
rotate_p(p + [0, leng], a) + p1
|
rotate_p(p * (1 + scale_step * i) + [0, leng], a) + p1
|
||||||
];
|
];
|
||||||
|
|
||||||
function path_extend_inner(index) =
|
function path_extend_inner(index) =
|
||||||
index == leng_path_pts ? [] :
|
index == leng_path_pts ? [] :
|
||||||
concat(
|
concat(
|
||||||
[stroke(path_pts[index - 1], path_pts[index])],
|
[stroke(path_pts[index - 1], path_pts[index], index)],
|
||||||
path_extend_inner(index + 1)
|
path_extend_inner(index + 1)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user