|
template<typename T > |
bool | rack::math::isEven (T x) |
| Returns true if x is odd.
|
|
template<typename T > |
bool | rack::math::isOdd (T x) |
| Returns true if x is odd.
|
|
int | rack::math::clamp (int x, int a, int b) |
| Limits x between a and b .
|
|
int | rack::math::clampSafe (int x, int a, int b) |
| Limits x between a and b .
|
|
int | rack::math::eucMod (int a, int b) |
| Euclidean modulus.
|
|
int | rack::math::eucDiv (int a, int b) |
| Euclidean division.
|
|
void | rack::math::eucDivMod (int a, int b, int *div, int *mod) |
|
int | rack::math::log2 (int n) |
| Returns floor(log_2(n)) , or 0 if n == 1 .
|
|
template<typename T > |
bool | rack::math::isPow2 (T n) |
| Returns whether n is a power of 2.
|
|
template<typename T > |
T | rack::math::sgn (T x) |
| Returns 1 for positive numbers, -1 for negative numbers, and 0 for zero.
|
|
float | rack::math::clamp (float x, float a=0.f, float b=1.f) |
| Limits x between a and b .
|
|
float | rack::math::clampSafe (float x, float a=0.f, float b=1.f) |
| Limits x between a and b .
|
|
| rack::math::__attribute__ ((optimize("signed-zeros"))) inline float normalizeZero(float x) |
| Converts -0.f to 0.f.
|
|
float | rack::math::eucMod (float a, float b) |
| Euclidean modulus.
|
|
bool | rack::math::isNear (float a, float b, float epsilon=1e-6f) |
| Returns whether a is within epsilon distance from b .
|
|
float | rack::math::chop (float x, float epsilon=1e-6f) |
| If the magnitude of x if less than epsilon, return 0.
|
|
float | rack::math::rescale (float x, float xMin, float xMax, float yMin, float yMax) |
| Rescales x from the range [xMin, xMax] to [yMin, yMax] .
|
|
float | rack::math::crossfade (float a, float b, float p) |
| Linearly interpolates between a and b , from p = 0 to p = 1 .
|
|
float | rack::math::interpolateLinear (const float *p, float x) |
| Linearly interpolates an array p with index x .
|
|
void | rack::math::complexMult (float ar, float ai, float br, float bi, float *cr, float *ci) |
| Complex multiplication c = a * b .
|
|
Vec | rack::math::operator+ (const Vec &a) |
|
Vec | rack::math::operator- (const Vec &a) |
|
Vec | rack::math::operator+ (const Vec &a, const Vec &b) |
|
Vec | rack::math::operator- (const Vec &a, const Vec &b) |
|
Vec | rack::math::operator* (const Vec &a, const Vec &b) |
|
Vec | rack::math::operator* (const Vec &a, const float &b) |
|
Vec | rack::math::operator* (const float &a, const Vec &b) |
|
Vec | rack::math::operator/ (const Vec &a, const Vec &b) |
|
Vec | rack::math::operator/ (const Vec &a, const float &b) |
|
Vec | rack::math::operator+= (Vec &a, const Vec &b) |
|
Vec | rack::math::operator-= (Vec &a, const Vec &b) |
|
Vec | rack::math::operator*= (Vec &a, const Vec &b) |
|
Vec | rack::math::operator*= (Vec &a, const float &b) |
|
Vec | rack::math::operator/= (Vec &a, const Vec &b) |
|
Vec | rack::math::operator/= (Vec &a, const float &b) |
|
bool | rack::math::operator== (const Vec &a, const Vec &b) |
|
bool | rack::math::operator!= (const Vec &a, const Vec &b) |
|
bool | rack::math::operator== (const Rect &a, const Rect &b) |
|
bool | rack::math::operator!= (const Rect &a, const Rect &b) |
|
Value:
Expands a Vec and Rect into a comma-separated list.
Useful for print debugging.
printf("(%f %f) (%f %f %f %f)", VEC_ARGS(v), RECT_ARGS(r));
Or passing the values to a C function.
nvgRect(vg, RECT_ARGS(r));