1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-01-29 11:58:39 +01:00

refactored

This commit is contained in:
Justin Lin 2017-05-12 15:21:45 +08:00
parent 66d0690185
commit 9743ba2790
2 changed files with 3 additions and 7 deletions

View File

@ -1,4 +1,4 @@
function __multiple_of_4(n) =
function __nearest_multiple_of_4(n) =
let(
remain = n % 4
)

View File

@ -13,14 +13,10 @@
include <__private__/__is_vector.scad>;
include <__private__/__frags.scad>;
include <__private__/__nearest_multiple_of_4.scad>;
module rounded_square(size, corner_r, center = false) {
frags = __frags(corner_r);
remain = frags % 4;
corner_frags = (remain / 4) > 0.5 ? frags - remain + 4 : frags - remain;
step_a = 360 / corner_frags;
step_a = 360 / __nearest_multiple_of_4(__frags(corner_r));
is_vt = __is_vector(size);
x = is_vt ? size[0] : size;