mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-01 12:30:33 +02:00
refactored
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
function __multiple_of_4(n) =
|
function __nearest_multiple_of_4(n) =
|
||||||
let(
|
let(
|
||||||
remain = n % 4
|
remain = n % 4
|
||||||
)
|
)
|
||||||
|
@@ -13,14 +13,10 @@
|
|||||||
|
|
||||||
include <__private__/__is_vector.scad>;
|
include <__private__/__is_vector.scad>;
|
||||||
include <__private__/__frags.scad>;
|
include <__private__/__frags.scad>;
|
||||||
|
include <__private__/__nearest_multiple_of_4.scad>;
|
||||||
|
|
||||||
module rounded_square(size, corner_r, center = false) {
|
module rounded_square(size, corner_r, center = false) {
|
||||||
frags = __frags(corner_r);
|
step_a = 360 / __nearest_multiple_of_4(__frags(corner_r));
|
||||||
|
|
||||||
remain = frags % 4;
|
|
||||||
corner_frags = (remain / 4) > 0.5 ? frags - remain + 4 : frags - remain;
|
|
||||||
|
|
||||||
step_a = 360 / corner_frags;
|
|
||||||
|
|
||||||
is_vt = __is_vector(size);
|
is_vt = __is_vector(size);
|
||||||
x = is_vt ? size[0] : size;
|
x = is_vt ? size[0] : size;
|
||||||
|
Reference in New Issue
Block a user