Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Mathematical Functions in VEX

From kunz
Revision as of 22:56, 11 October 2021 by Admin (talk | contribs)

[File:basic_functions.png]

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
Mathematical Constants

The following constants are defined in math.h and automatically included in all VEX wrangle snippets.

// $HFS/houdini/vex/include/math.h
M_E         2.7182818    // sometimes called the natural number, or Euler's number
LN10        2.3025850    // natural logarithm of 10
LN2         0.6931471    // natural logarithm of 2
LOG10E      0.4342944
LOG2E       1.4426950
PI          3.1415926    // 180° in radians, the ratio of the circumference to diameter of a circle
M_TWO_PI    6.2831852    // 360° in radians, the circumference of a unit circle, 2 * PI
PI_2   	    1.5707963    // 90° in radians, 1/4th of the circumference of a unit circle, PI / 2
PI_4	    0.7853981    // 45° in radians, 1/8th of the circumference of a unit circle, PI / 4
SQRT1_2	    0.7071067
SQRT2	    1.4142135
TOLERANCE   0.0001


  1. math #vex