1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-26 07:55:16 +02:00
This commit is contained in:
Justin Lin
2022-03-03 23:08:24 +08:00
parent 96ec1e0c26
commit b0f8f5c4f4
6 changed files with 10 additions and 17 deletions

View File

@@ -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);

View File

@@ -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];

View File

@@ -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
)

View File

@@ -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 :

View File

@@ -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) =

View File

@@ -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];