mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-11 09:14:29 +02:00
refactor deps
This commit is contained in:
20
src/_impl/_shape_starburst_impl.scad
Normal file
20
src/_impl/_shape_starburst_impl.scad
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
function __outer_points_shape_starburst(r1, r2, n) =
|
||||||
|
let(
|
||||||
|
a = 360 / n
|
||||||
|
)
|
||||||
|
[for(i = 0; i < n; i = i + 1) [r1 * cos(a * i), r1 * sin(a * i)]];
|
||||||
|
|
||||||
|
function __inner_points_shape_starburst(r1, r2, n) =
|
||||||
|
let (
|
||||||
|
a = 360 / n,
|
||||||
|
half_a = a / 2
|
||||||
|
)
|
||||||
|
[for(i = 0; i < n; i = i + 1) [r2 * cos(a * i + half_a), r2 * sin(a * i + half_a)]];
|
||||||
|
|
||||||
|
function _shape_starburst_impl(r1, r2, n) =
|
||||||
|
let(
|
||||||
|
outer_points = __outer_points_shape_starburst(r1, r2, n),
|
||||||
|
inner_points = __inner_points_shape_starburst(r1, r2, n),
|
||||||
|
leng = len(outer_points)
|
||||||
|
)
|
||||||
|
[for(i = 0; i < leng; i = i + 1) each [outer_points[i], inner_points[i]]];
|
@@ -8,23 +8,7 @@
|
|||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
|
|
||||||
function __outer_points_shape_starburst(r1, r2, n) =
|
use <_impl/_shape_starburst_impl.scad>;
|
||||||
let(
|
|
||||||
a = 360 / n
|
|
||||||
)
|
|
||||||
[for(i = 0; i < n; i = i + 1) [r1 * cos(a * i), r1 * sin(a * i)]];
|
|
||||||
|
|
||||||
function __inner_points_shape_starburst(r1, r2, n) =
|
|
||||||
let (
|
|
||||||
a = 360 / n,
|
|
||||||
half_a = a / 2
|
|
||||||
)
|
|
||||||
[for(i = 0; i < n; i = i + 1) [r2 * cos(a * i + half_a), r2 * sin(a * i + half_a)]];
|
|
||||||
|
|
||||||
function shape_starburst(r1, r2, n) =
|
function shape_starburst(r1, r2, n) =
|
||||||
let(
|
_shape_starburst_impl(r1, r2, n);
|
||||||
outer_points = __outer_points_shape_starburst(r1, r2, n),
|
|
||||||
inner_points = __inner_points_shape_starburst(r1, r2, n),
|
|
||||||
leng = len(outer_points)
|
|
||||||
)
|
|
||||||
[for(i = 0; i < leng; i = i + 1) each [outer_points[i], inner_points[i]]];
|
|
@@ -1,5 +1,5 @@
|
|||||||
include <unittest.scad>;
|
use <unittest.scad>;
|
||||||
include <shape_starburst.scad>;
|
use <shape_starburst.scad>;
|
||||||
|
|
||||||
module test_shape_starburst() {
|
module test_shape_starburst() {
|
||||||
echo("==== test_shape_starburst ====");
|
echo("==== test_shape_starburst ====");
|
||||||
|
Reference in New Issue
Block a user