Sunday, October 1, 2017

0 - 1 Remapping Functions: Multiple Smooth Steps

/* remapping functions */


for(i=[-0:1/160:1])translate([i,0])square([1/160,   (smooths(  smooth(i),3 )) ]);
    function smooths(v,steps) =smooth( smooth(mods(v,steps) ))/steps+mstep(v,steps);
    function smooth (a) =let (b = clamp(a))(b * b * (3 - 2 * b));
    function clamp(a, b = 0, c = 1) = min(max(a, b), c);
    function mstep(v,steps=3) = (floor(v*steps)/steps );
    function mods(v,steps=3) = ( (v*steps)%1);
 


No comments:

Post a Comment