mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-17 20:11:50 +02:00
refactor deps
This commit is contained in:
14
src/_impl/_midpt_smooth_impl.scad
Normal file
14
src/_impl/_midpt_smooth_impl.scad
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
function _midpt_smooth_sub(points, iend, closed) =
|
||||||
|
concat(
|
||||||
|
[
|
||||||
|
for(i = 0; i < iend; i = i + 1)
|
||||||
|
(points[i] + points[i + 1]) / 2
|
||||||
|
],
|
||||||
|
closed ? [(points[iend] + points[0]) / 2] : []
|
||||||
|
);
|
||||||
|
|
||||||
|
function _midpt_smooth_impl(points, n, closed) =
|
||||||
|
let(
|
||||||
|
smoothed = _midpt_smooth_sub(points, len(points) - 1, closed)
|
||||||
|
)
|
||||||
|
n == 1 ? smoothed : _midpt_smooth_impl(smoothed, n - 1, closed);
|
@@ -8,17 +8,6 @@
|
|||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
|
|
||||||
function _midpt_smooth_sub(points, iend, closed = false) =
|
use <_impl/_midpt_smooth_impl.scad>;
|
||||||
concat(
|
|
||||||
[
|
|
||||||
for(i = 0; i < iend; i = i + 1)
|
|
||||||
(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) = _midpt_smooth_impl(points, n, closed);
|
||||||
let(
|
|
||||||
smoothed = _midpt_smooth_sub(points, len(points) - 1, closed)
|
|
||||||
)
|
|
||||||
n == 1 ? smoothed : midpt_smooth(smoothed, n - 1, closed);
|
|
Reference in New Issue
Block a user