# Different Cam Functions

By plugging these into the rise part of each app page, the system will be able to generate a particular cam for a particular output shape.

### Modified Sine:

function Rise(t0,t1,h0,h1,x) // Modified Sine
{
var h,beta,xx,s;
h = h1 - h0;
beta = t1-t0;
xx = (x-t0)/beta;
if (xx < 0.125) return h0+h*(.43990085*xx-.0350062*Math.sin(4*Math.PI*xx));
if (xx < 0.875) return h0+h*(.28004957+.43990085*xx-.31505577*Math.cos(((4*Math.PI*xx)/(3))-(Math.PI/6)));
return h0+h*(.56009915+.43990085*xx-.0350062*Math.sin(2*Math.PI*2*xx-2*Math.PI));
}

### Modified Trapezoid:

function Rise(t0,t1,h0,h1,x) // Modified Trapezoid
{
var h,beta,xx,s;
h = h1 - h0;
beta = t1-t0;
xx = (x-t0)/beta;

if (xx < 0.125) return h0+h*(0.38898448*xx-0.0309544*Math.sin(4*Math.PI*xx));
if (xx < 0.375) return h0+h*(2.44406184*xx*xx-0.22203097*xx+0.00723407);
if (xx < 0.625) return h0+h*(1.6110154*xx-0.0309544*Math.sin(4*Math.PI*xx-Math.PI)-0.3055077);
if (xx < 0.875) return h0+h*(-2.44406184*xx*xx+4.6660917*xx-1.2292648);
return h0+h*(0.6110154+0.38898448*xx+0.0309544*Math.sin(4*Math.PI*xx-3*Math.PI));
}

### Double Harmonic

function Rise(t0,t1,h0,h1,x) // Double Harmonic
{
var h,beta,xx,s;
h = h1 - h0;
beta = t1-t0;
xx = (x-t0)/beta;
if (xx < .5) return h0+h/2*((1-Math.cos(Math.PI*xx)-.25*(1-Math.cos(2*Math.PI*xx)));
return h0+h/2*((1+Math.cos(Math.PI*xx))-.25*(1-Math.cos(2*Math.PI*xx)));
}

### 3-4-5 Polynomial

function Rise(t0,t1,h0,h1,x) // 3-4-5 Polynomial
{
var h,beta,xx,s;
h = h1 - h0;
beta = t1-t0;
xx = (x-t0)/beta;
return h0+h*(10*xx*xx*xx-15*xx*xx*xx*xx+6*xx*xx*xx*xx*xx);
}