|
| template<typename T> |
| bool | isEven (T x) |
| | Returns true if x is odd.
|
| template<typename T> |
| bool | isOdd (T x) |
| | Returns true if x is odd.
|
| int | clamp (int x, int a, int b) |
| | Limits x between a and b.
|
| int | clampSafe (int x, int a, int b) |
| | Limits x between a and b.
|
| int | eucMod (int a, int b) |
| | Euclidean modulus.
|
| int | eucDiv (int a, int b) |
| | Euclidean division.
|
| void | eucDivMod (int a, int b, int *div, int *mod) |
| int | log2 (int n) |
| | Returns floor(log_2(n)), or 0 if n == 1.
|
| template<typename T> |
| bool | isPow2 (T n) |
| | Returns whether n is a power of 2.
|
| template<typename T> |
| T | sgn (T x) |
| | Returns 1 for positive numbers, -1 for negative numbers, and 0 for zero.
|
| float | clamp (float x, float a=0.f, float b=1.f) |
| | Limits x between a and b.
|
| float | clampSafe (float x, float a=0.f, float b=1.f) |
| | Limits x between a and b.
|
| | __attribute__ ((optimize("signed-zeros"))) inline float normalizeZero(float x) |
| | Converts -0.f to 0.f.
|
| float | eucMod (float a, float b) |
| | Euclidean modulus.
|
| bool | isNear (float a, float b, float epsilon=1e-6f) |
| | Returns whether a is within epsilon distance from b.
|
| float | chop (float x, float epsilon=1e-6f) |
| | If the magnitude of x if less than epsilon, return 0.
|
| float | rescale (float x, float xMin, float xMax, float yMin, float yMax) |
| | Rescales x from the range [xMin, xMax] to [yMin, yMax].
|
| float | crossfade (float a, float b, float p) |
| | Linearly interpolates between a and b, from p = 0 to p = 1.
|
| float | interpolateLinear (const float *p, float x) |
| | Linearly interpolates an array p with index x.
|
| void | complexMult (float ar, float ai, float br, float bi, float *cr, float *ci) |
| | Complex multiplication c = a * b.
|
| Vec | operator+ (const Vec &a) |
| Vec | operator- (const Vec &a) |
| Vec | operator+ (const Vec &a, const Vec &b) |
| Vec | operator- (const Vec &a, const Vec &b) |
| Vec | operator* (const Vec &a, const Vec &b) |
| Vec | operator* (const Vec &a, const float &b) |
| Vec | operator* (const float &a, const Vec &b) |
| Vec | operator/ (const Vec &a, const Vec &b) |
| Vec | operator/ (const Vec &a, const float &b) |
| Vec | operator+= (Vec &a, const Vec &b) |
| Vec | operator-= (Vec &a, const Vec &b) |
| Vec | operator*= (Vec &a, const Vec &b) |
| Vec | operator*= (Vec &a, const float &b) |
| Vec | operator/= (Vec &a, const Vec &b) |
| Vec | operator/= (Vec &a, const float &b) |
| bool | operator== (const Vec &a, const Vec &b) |
| bool | operator!= (const Vec &a, const Vec &b) |
| bool | operator== (const Rect &a, const Rect &b) |
| bool | operator!= (const Rect &a, const Rect &b) |
Extends <cmath> with extra functions and types.