Friday, September 29, 2017

0 - 1 Remapping Functions: Inverse Cosine-Wave

/* remapping functions */


for(i=[-0:1/160:1])translate([i,0])square([1/160,    (icosw(  (i))) ]);
     function icosw(i)=-cos(i*360)/2+0.5+i;
 

 

Monday, September 25, 2017

0 - 1 Remapping Functions: Cosine-Wave

/* remapping functions */


for(i=[-0:1/160:1])translate([i ,  min(0,cosw(i))])
                 square([1/160,   abs(cosw(  (i))) ]);
    function cosw(i)=cos(i*360)/2 -0.5+i;
 

 

Saturday, September 23, 2017

0 - 1 Remapping Functions: Inverse Sine-Wave

/* remapping functions */


for(i=[-0:1/160:1])translate([i,  min(0,isinw(i))])
                square([1/160,   abs(isinw(  (i))) ]);
    function isinw(i)=gauss(i)-sin(i*360)/2;
 
    function gauss(x) =       x + (x - smooth(x));
    function smooth (a) =let (b = clamp(a))(b * b * (3 - 2 * b));
    function clamp(a, b = 0, c = 1) = min(max(a, b), c);

 

Thursday, September 21, 2017

0 - 1 Remapping Functions: Sine-Wave

/* remapping functions */


for(i=[-0:1/160:1])translate([i,0])square([1/160,    (sinw(  (i))) ]);
    function sinw(i)=sin(i*360)/2+smooth(i);
    function gauss(x) =       x + (x - smooth(x));
    function smooth (a) =let (b = clamp(a))(b * b * (3 - 2 * b));
    function clamp(a, b = 0, c = 1) = min(max(a, b), c);

 

Tuesday, September 19, 2017

0 - 1 Remapping Functions: Multiple Arcs 2

/* remapping functions */

for(i=[-0:1/160:1])translate([i,0])square([1/160,   (arcs2(  (i),3)) ]);
    function arc1 (x,n=0) = let(a= n>0? arc1(x,(n-1)):x) clamp(sqrt(1-(1-a)*(1-a)));
    function arc2 (x,n=0) =let(a= n>0? arc2(x,(n-1)):x) clamp( 1-sqrt(1-(a)*(a)));
    function arcs1(v,steps=3) = arc1(mods(v,steps),1)/steps+mstep(v,steps);
    function arcs2(v,steps=3) = arc2(mods(v,steps),1)/steps+mstep(v,steps);
    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);
 


0 - 1 Remapping Functions: Multiple Arcs 1

/* remapping functions */

for(i=[-0:1/160:1])translate([i,0])square([1/160,   (arcs2(  (i),3)) ]);
    function arc1 (x,n=0) = let(a= n>0? arc1(x,(n-1)):x) clamp(sqrt(1-(1-a)*(1-a)));
    function arc2 (x,n=0) =let(a= n>0? arc2(x,(n-1)):x) clamp( 1-sqrt(1-(a)*(a)));
    function arcs1(v,steps=3) = arc1(mods(v,steps),1)/steps+mstep(v,steps);
    function arcs2(v,steps=3) = arc2(mods(v,steps),1)/steps+mstep(v,steps);
    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);
 

Sunday, September 17, 2017

0 - 1 Remapping Functions: Gauss

/* remapping functions */


for(i=[-0:1/160:1])translate([i,0])square([1/160,   (gauss(  (i))) ]);
    function gauss(x) =       x + (x - smooth(x));
    function smooth (a) =let (b = clamp(a))(b * b * (3 - 2 * b));
    function clamp(a, b = 0, c = 1) = min(max(a, b), c)
 

Friday, September 15, 2017

0 - 1 Remapping Functions: Step Ramp

/* remapping functions */

for(i=[-0:1/160:1])translate([i,0])square([1/160,   ( (  stepramp(i,bi1=1/5,bi2=4/5,start=1/3, end=2/3) )) ]);

function stepramp(v,bi1=1/5,bi2=4/5,start=1/3, end=2/3) = 
let(b1=min(bi1,bi2),b2=max(bi1,bi2))
v<=b1?ramp(v,0,b1,0,start):v<=b2?lerp(start,end,(v-b1)/(b2-b1))    :ramp(v,b2,1,end,1);

function ramp(v,bi1=1/3,bi2=2/3,start=1/3, end=2/3) = 
let(b1=min(bi1,bi2),b2=max(bi1,bi2))
v<=b1?start:v<=b2?lerp(start,end,(v-b1)/(b2-b1))    :end;


function lerp(start, end, bias) = (end * bias + start * (1 - bias));

 

Wednesday, September 13, 2017

0 - 1 Remapping Functions: Ramp

/* remapping functions */


for(i=[-0:1/160:1])translate([i,0])
        square([1/160, (ramp( (i),1/3,2/3,0.1)) ]);
function ramp(v,bi1=1/3,bi2=2/3,start=1/3, end=2/3) = 
        let(b1=min(bi1,bi2),b2=max(bi1,bi2))
        v<=b1?start:v<=b2?lerp(start,end,(v-b1)/(b2-b1))    :end;
function lerp(start, end, bias) = (end * bias + start * (1 - bias));
 

Monday, September 11, 2017

0 - 1 Remapping Functions: Arc 2

/* remapping functions */

for(i=[-0:1/160:1])translate([i,0])square([1/160,  (arc2(  (i)))]);
function arc2 (x,n=0) =
     let(a= n>0? arc2(x,(n-1)):x) clamp( 1-sqrt(1-(a)*(a)));    
function clamp(a, b = 0, c = 1) = min(max(a, b), c);
 

Saturday, September 9, 2017

0 - 1 Remapping Functions: Arc 1

/* remapping functions */


 for(i=[-0:1/160:1])translate([i,0])square([1/160,  (arc1(  (i)))]);
 function arc1 (x,n=0) = let(a= n>0? arc1(x,(n-1)):x) clamp(sqrt(1-(1-a)*(1-a)));
 function clamp(a, b = 0, c = 1) = min(max(a, b), c);
 

Thursday, September 7, 2017

0 - 1 Remapping Functions: Smooth Step

/* remapping functions */


for(i=[-0:1/160:1])translate([i,0])square([1/160, (smooth( (i),2/3,0.1))]);
    function smooth (a) =let (b = clamp(a))(b * b * (3 - 2 * b));
    function clamp(a, b = 0, c = 1) = min(max(a, b), c)
 

Tuesday, September 5, 2017

0 - 1 Remapping Functions: Modulus

/* remapping functions */

for(i=[-0:1/160:1])translate([i,0])square([1/160, (mods(  (i),5))]);
    function mods(v,steps=3) = ( (v*steps)%1);
 

Sunday, September 3, 2017

0 - 1 Remapping Functions: Multi Step

/* remapping functions */


for(i=[-0:1/160:1])translate([i,0])square([1/160, (mstep( i,5))]);
    function mstep(v,steps=3) = (floor(v*steps)/steps );
 

Friday, September 1, 2017

0 - 1 Remapping Functions: Step

/* remapping functions */


for(i=[-0:1/160:1])translate([i,0])square([1/160, (step( (i),2/3,0.1))]);
    function step(v,bias,start=0, end=1) = v>=bias?end:start;