kunz Difference between revisions of "Mathematical Functions in VEX"

Difference between revisions of "Mathematical Functions in VEX"

From kunz
Line 35: Line 35:
// $HFS/houdini/vex/include/math.h
// $HFS/houdini/vex/include/math.h


M_E 2.7182818
M_E         2.7182818
LN10 2.3025850
LN10       2.3025850
LN2 0.6931471
LN2         0.6931471
LOG10E 0.4342944
LOG10E     0.4342944
LOG2E 1.4426950
LOG2E       1.4426950
PI     3.1415926
PI         3.1415926
M_TWO_PI    6.2831852
M_TWO_PI    6.2831852
PI_2      1.5707963
PI_2      1.5707963

Revision as of 21:03, 2 October 2021

y = 0;            // Constant (value remains the same at all points in time)
y = x;            // Linear (value changes at a constant rate over time)
y = pow(x,2);     // Quadratic, same as: y = x*x;
y = pow(x,3);     // Cubic, same as: y = x*x*x;
y = pow(2,x);     // Exponential, these functions grow very rapidly. y = pow(M_E, x); y = exp(x);
y = 1.0/x;        // Reciprocal, with x in the denominator this will produce asymptotes at the axis
y = pow(x,0.5);   // Square Root, same as: y = sqrt(x);
y = log(x);       // Logarithmic, rate of growth diminishes over time


// $HFS/houdini/vex/include/math.h

M_E         2.7182818
LN10        2.3025850
LN2         0.6931471
LOG10E      0.4342944
LOG2E       1.4426950
PI          3.1415926
M_TWO_PI    6.2831852
PI_2   	    1.5707963
PI_4	    0.7853981
SQRT1_2	    0.7071067
SQRT2	    1.4142135
TOLERANCE   0.0001