mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-26 07:55:16 +02:00
refactor
This commit is contained in:
@@ -1,7 +1,5 @@
|
||||
function __edge_r_begin(orig_r, a, a_step, m) =
|
||||
let(leng = orig_r * cos(a_step / 2))
|
||||
leng / cos((m - 0.5) * a_step - a);
|
||||
(orig_r * cos(a_step / 2)) / cos((m - 0.5) * a_step - a);
|
||||
|
||||
function __edge_r_end(orig_r, a, a_step, n) =
|
||||
let(leng = orig_r * cos(a_step / 2))
|
||||
leng / cos((n + 0.5) * a_step - a);
|
||||
(orig_r * cos(a_step / 2)) / cos((n + 0.5) * a_step - a);
|
@@ -4,7 +4,7 @@ function __fast_fibonacci_sub(nth) =
|
||||
a = _f[0],
|
||||
b = _f[1],
|
||||
c = a * (b * 2 - a),
|
||||
d = a * a + b * b
|
||||
d = a ^ 2 + b ^ 2
|
||||
)
|
||||
nth % 2 == 0 ? [c, d] : [d, c + d];
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
function __in_line(line_pts, pt, epsilon = 0.0001) =
|
||||
let(
|
||||
pts = len(line_pts[0]) == 2 ? [for(p = line_pts) [p[0], p[1], 0]] : line_pts,
|
||||
pt3d = len(pt) == 2 ? [pt[0], pt[1], 0] : pt,
|
||||
pts = len(line_pts[0]) == 2 ? [for(p = line_pts) [each p, 0]] : line_pts,
|
||||
pt3d = len(pt) == 2 ? [each pt, 0] : pt,
|
||||
v1 = pts[0] - pt3d,
|
||||
v2 = pts[1] - pt3d
|
||||
)
|
||||
|
@@ -7,9 +7,8 @@ function _combi(n, k) =
|
||||
[1,3,3,1] // n = 3: for Cubic Bézier curves
|
||||
]
|
||||
)
|
||||
n < 4 ? bi_coef[n][k] : (
|
||||
k == 0 ? 1 : (_combi(n, k - 1) * (n - k + 1) / k)
|
||||
);
|
||||
n < 4 ? bi_coef[n][k] :
|
||||
k == 0 ? 1 : (_combi(n, k - 1) * (n - k + 1) / k);
|
||||
|
||||
function bezier_curve_coordinate(t, pn, n, i = 0) =
|
||||
i == n + 1 ? 0 :
|
||||
|
@@ -24,12 +24,8 @@ function _bijection_offset_edge(edge, dx, dy) =
|
||||
function _bijection__bijection_offset_edges(edges, d) =
|
||||
[
|
||||
for(edge = edges)
|
||||
let(
|
||||
ow_normal = _bijection_outward_edge_normal(edge),
|
||||
dx = ow_normal.x * d,
|
||||
dy = ow_normal.y * d
|
||||
)
|
||||
_bijection_offset_edge(edge, dx, dy)
|
||||
let(ow_normal_d = _bijection_outward_edge_normal(edge) * d)
|
||||
_bijection_offset_edge(edge, ow_normal_d.x, ow_normal_d.y)
|
||||
];
|
||||
|
||||
function _bijection_offset_impl(pts, d, epsilon) =
|
||||
|
@@ -8,7 +8,7 @@ function _fast_fibonacci_sub(nth) =
|
||||
a = _f[0],
|
||||
b = _f[1],
|
||||
c = a * (b * 2 - a),
|
||||
d = a * a + b * b
|
||||
d = a ^ 2 + b ^ 2
|
||||
)
|
||||
nth % 2 == 0 ? [c, d] : [d, c + d];
|
||||
|
||||
|
Reference in New Issue
Block a user