This is my notepad where i collect the useful snippets of OpenSCAD code that i use over and over. Some better curated than others, some formatted for clarity some for efficiency.
Friday, May 12, 2017
Smooth and Gaussian Curve
Takes a linear 0-1 value and apply an S-function.
Gauss is the inverse of that S-function.
function smooth_curve(a) =
let (b = clamp(a))(b * b * (3 - 2 * b));
function clamp(a, b = 0, c = 1) = min(max(a, b), c);
function gauss(x) =
x + (x - smooth_curve(x));
No comments:
Post a Comment