mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-14 10:44:48 +02:00
refactor
This commit is contained in:
@@ -8,14 +8,17 @@
|
|||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
|
|
||||||
function _midpt_smooth_sub(points, iend, i, closed = false) =
|
function _midpt_smooth_sub(points, iend, closed = false) =
|
||||||
i == iend ? (
|
concat(
|
||||||
closed ? [(points[i] + points[0]) / 2]
|
[
|
||||||
: []
|
for(i = 0; i < iend; i = i + 1)
|
||||||
) : concat([(points[i] + points[i + 1]) / 2], _midpt_smooth_sub(points, iend, i + 1, closed));
|
(points[i] + points[i + 1]) / 2
|
||||||
|
],
|
||||||
|
closed ? [(points[iend] + points[0]) / 2] : []
|
||||||
|
);
|
||||||
|
|
||||||
function midpt_smooth(points, n, closed = false) =
|
function midpt_smooth(points, n, closed = false) =
|
||||||
let(
|
let(
|
||||||
smoothed = _midpt_smooth_sub(points, len(points) - 1, 0, closed)
|
smoothed = _midpt_smooth_sub(points, len(points) - 1, closed)
|
||||||
)
|
)
|
||||||
n == 1 ? smoothed : midpt_smooth(smoothed, n - 1, closed);
|
n == 1 ? smoothed : midpt_smooth(smoothed, n - 1, closed);
|
Reference in New Issue
Block a user