1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-01 04:20:27 +02:00

refactor: format

This commit is contained in:
Justin Lin
2022-04-16 17:36:59 +08:00
parent 4875aeeb98
commit b16da34c86

View File

@@ -1,20 +1,22 @@
function __outer_points_shape_star(r1, r2, n) =
let(
a = 360 / n
)
[for(i = 0; i < n; i = i + 1) [r1 * cos(90 + a * i), r1 * sin(90 + a * i)]];
let(a_step = 360 / n)
[
for(i = 0; i < n; i = i + 1)
let(a = 90 + a_step * i)
[r1 * cos(a), r1 * sin(a)]
];
function __inner_points_shape_star(r1, r2, n) =
let (
a = 360 / n,
half_a = a / 2
)
[for(i = 0; i < n; i = i + 1) [r2 * cos(90 + a * i + half_a), r2 * sin(90 + a * i + half_a)]];
let(a_step = 360 / n)
[
for(i = 0; i < n; i = i + 1)
let(a = 90 + a_step * (i + 0.5))
[r2 * cos(a), r2 * sin(a)]
];
function _shape_star_impl(r1, r2, n) =
let(
let(
outer_points = __outer_points_shape_star(r1, r2, n),
inner_points = __inner_points_shape_star(r1, r2, n),
leng = len(outer_points)
inner_points = __inner_points_shape_star(r1, r2, n)
)
[for(i = 0; i < leng; i = i + 1) each [outer_points[i], inner_points[i]]];
[for(i = [0:len(outer_points) - 1]) each [outer_points[i], inner_points[i]]];