Allolib
1.0
C++ Components For Interactive Multimedia
|
Classes | |
class | al::MinMeanMax< T > |
class | al::Polar< T > |
class | al::Complex< T > |
class | al::Frustum< T > |
Rectangular frustum. More... | |
class | al::Interval< T > |
A closed interval [min, max]. More... | |
class | al::Mat< N, T > |
Fixed-size n-by-n square matrix. More... | |
class | al::Matrix4< T > |
class | al::Plane< T > |
class | al::Quat< T > |
class | al::rnd::Random< RNG > |
class | al::Ray< T > |
class | al::SphereCoord< T > |
Spherical coordinate in terms of two complex numbers. More... | |
class | al::SphericalHarmonic< L_MAX > |
Spherical harmonic evaluator using cached coefficients. More... | |
class | al::Vec< N, T > |
Fixed-size n-vector. More... | |
Functions | |
template<class VecN , class T > | |
void | al::rotatePlane (VecN &v1, VecN &v2, const Complex< T > &a) |
template<class Vec3 , class T > | |
Vec3 | al::sterProj (const al::Complex< T > &c) |
bool | al::aeq (float a, float b, int maxULP=10) |
Return whether two floats are almost equal. More... | |
template<class T > | |
T | al::ampTodB (const T &) |
template<class T > | |
T | al::atLeast (const T &v, const T &eps) |
template<class T > | |
T | al::atan2Fast (const T &y, const T &x) |
uint32_t | al::bitsSet (uint32_t v) |
Returns number of bits set to 1. More... | |
template<class T > | |
T | al::ceil (const T &val, const T &step) |
uint32_t | al::ceilPow2 (uint32_t value) |
Returns power of two ceiling of value. More... | |
template<class T > | |
T | al::clip (const T &value, const T &hi=T(1), const T &lo=T(0)) |
template<class T > | |
T | al::clip (const T &v, int &clipFlag, const T &hi, const T &lo) |
Returns value clipped to [lo, hi] and signifies clipping behavior. More... | |
template<class T > | |
T | al::clipS (const T &value, const T &hi=T(1)) |
template<class T > | |
T | al::dBToAmp (const T &db) |
template<class T > | |
bool | al::even (const T &v) |
template<class T > | |
T | al::erf (const T &v) |
uint32_t | al::factorial (uint32_t n0to12) |
double | al::factorialSqrt (int v) |
template<class T > | |
T | al::floor (const T &val, const T &step) |
uint32_t | al::floorPow2 (uint32_t value) |
Returns power of two floor of value. More... | |
template<class T > | |
T | al::fold (const T &value, const T &hi=T(1), const T &lo=T(0)) |
Returns value folded into [lo, hi]. More... | |
template<class T > | |
T | al::foldOnce (const T &value, const T &hi=T(1), const T &lo=T(0)) |
template<class T > | |
T | al::gaussian (const T &v) |
template<class T > | |
T | al::gcd (const T &x, const T &y) |
template<class T > | |
T | al::gudermannian (const T &x) |
template<class T > | |
T | al::laguerreL (int n, int k, T x) |
Generalized Laguerre polynomial L{n,k}. More... | |
template<class T > | |
T | al::legendreP (int l, int m, T t) |
template<class T > | |
bool | al::lessAbs (const T &v, const T &eps=T(0.000001)) |
template<typename T > | |
T | al::max (const T &v1, const T &v2, const T &v3) |
template<class T > | |
T | al::mean (const T &v1, const T &v2) |
template<class T > | |
T | al::min (const T &v1, const T &v2, const T &v3) |
template<class T > | |
T | al::nearestDiv (T of, T to) |
template<class T > | |
T | al::nextAfter (const T &x, const T &y) |
template<class T > | |
T | al::nextMultiple (T val, T multiple) |
template<class T > | |
T | al::numInt (const T &v) |
template<class T > | |
bool | al::odd (const T &v) |
template<class T > | |
T | al::poly (const T &x, const T &a0, const T &a1, const T &a2) |
template<class T > | |
T | al::poly (const T &x, const T &a0, const T &a1, const T &a2, const T &a3) |
template<class T > | |
T | al::powN (T base, unsigned power) |
Returns value to a positive integer power. More... | |
unsigned char | al::prime (uint32_t n) |
template<class T > | |
T | al::round (const T &v, const T &step) |
template<class T > | |
T | al::round (const T &v, const T &step, const T &recStep) |
template<class T > | |
T | al::roundAway (const T &v) |
template<class T > | |
T | al::roundAway (const T &v, const T &step) |
template<class T > | |
T | al::sgn (const T &v, const T &norm=T(1)) |
template<class T > | |
T | al::sinc (const T &radians, const T &eps=T(0.0001)) |
template<class T > | |
T | al::slope (const T &x1, const T &y1, const T &x2, const T &y2) |
template<class T > | |
void | al::sort (T &value1, T &value2) |
template<class T > | |
T | al::sumOfSquares (T n) |
uint32_t | al::trailingZeroes (uint32_t v) |
Returns number of trailing zeros in 32-bit int. More... | |
template<class T > | |
T | al::trunc (const T &v, const T &step) |
template<class T > | |
T | al::trunc (const T &v, const T &step, const T &recStep) |
template<class T > | |
bool | al::within (const T &v, const T &lo, const T &hi) |
template<class T > | |
bool | al::within3 (const T &v1, const T &v2, const T &v3, const T &lo, const T &hi) |
template<class T > | |
bool | al::withinIE (const T &v, const T &lo, const T &hi) |
template<class T > | |
T | al::wrap (const T &value, const T &hi=T(1), const T &lo=T(0)) |
template<class T > | |
T | al::wrap (const T &value, long &numWraps, const T &hi=T(1), const T &lo=T(0)) |
Returns value wrapped in [lo, hi). More... | |
template<class T > | |
T | al::wrapAdd1 (const T &v, const T &max) |
template<class T > | |
T | al::wrapOnce (const T &value, const T &hi=T(1)) |
template<class T > | |
T | al::wrapPhase (const T &radians) |
template<class T > | |
T | al::wrapPhaseOnce (const T &radians) |
template<class Tf , class Tv > | |
Tv | al::ipl::bezier (Tf frac, const Tv &x2, const Tv &x1, const Tv &x0) |
Bezier curve, 3-point quadratic. More... | |
template<class Tf , class Tv > | |
Tv | al::ipl::bezier (Tf frac, const Tv &x3, const Tv &x2, const Tv &x1, const Tv &x0) |
Bezier curve, 4-point cubic. More... | |
template<class Tf , class Tv > | |
Tv | al::ipl::casteljau (const Tf &frac, const Tv &a, const Tv &b, const Tv &c, const Tv &d) |
de Casteljau algorithm for four point interpolation More... | |
template<class Tp , class Tv > | |
Tv | al::ipl::hermite (Tp f, const Tv &w, const Tv &x, const Tv &y, const Tv &z, Tp tension, Tp bias) |
template<class T > | |
void | al::ipl::lagrange (T *h, T delay, int order) |
Computes FIR coefficients for Waring-Lagrange interpolation. More... | |
template<class T > | |
void | al::ipl::lagrange1 (T *h, T delay) |
template<class T > | |
void | al::ipl::lagrange2 (T *h, T delay) |
template<class T > | |
void | al::ipl::lagrange3 (T *h, T delay) |
template<class Tf , class Tv > | |
void | al::ipl::cardinalSpline (Tv *w, const Tv *x, const Tf &f, double b) |
Compute weights for cubic cardinal spline. More... | |
template<class Tf , class Tv > | |
Tv | al::ipl::cubic (Tf frac, const Tv &w, const Tv &x, const Tv &y, const Tv &z) |
Cubic interpolation. More... | |
template<class Tf , class Tv > | |
Tv | al::ipl::cubic2 (Tf frac, const Tv &w, const Tv &x, const Tv &y, const Tv &z) |
Cubic interpolation. More... | |
template<class Tf , class Tv > | |
Tv | al::ipl::linear (Tf frac, const Tv &x, const Tv &y) |
template<class Tf , class Tv > | |
Tv | al::ipl::linear (Tf frac, const Tv &x, const Tv &y, const Tv &z) |
template<class Tf , class Tv > | |
Tv | al::ipl::linearCyclic (Tf frac, const Tv &x, const Tv &y, const Tv &z) |
template<class Tf , class Tv > | |
void | al::ipl::linear (Tv *dst, const Tv *xs, const Tv *xp1s, int len, const Tf &frac) |
template<class Tf , class Tv > | |
Tv | al::ipl::nearest (Tf frac, const Tv &x, const Tv &y) |
template<class Tf , class Tv > | |
Tv | al::ipl::bilinear (const Tf &fracX, const Tf &fracY, const Tv &xy, const Tv &Xy, const Tv &xY, const Tv &XY) |
template<class Tf2 , class Tv > | |
Tv | al::ipl::bilinear (const Tf2 &f, const Tv &xy, const Tv &Xy, const Tv &xY, const Tv &XY) |
template<class Tf , class Tv > | |
Tv | al::ipl::trilinear (const Tf &fracX, const Tf &fracY, const Tf &fracZ, const Tv &xyz, const Tv &Xyz, const Tv &xYz, const Tv &XYz, const Tv &xyZ, const Tv &XyZ, const Tv &xYZ, const Tv &XYZ) |
template<class Tf3 , class Tv > | |
Tv | al::ipl::trilinear (const Tf3 &f, const Tv &xyz, const Tv &Xyz, const Tv &xYz, const Tv &XYz, const Tv &xyZ, const Tv &XyZ, const Tv &xYZ, const Tv &XYZ) |
Trilinear interpolation between values on corners of a hexahedron. More... | |
|
inline |
Return whether two floats are almost equal.
[in] | a | first operand |
[in] | b | second operand |
[in] | maxULP | maximum "units in the last place" |
Algorithm from Dawson, B. "Comparing floating point numbers", http://www.cygnus-software.com/papers/comparingfloats/comparingfloats.htm
Definition at line 544 of file al_Functions.hpp.
|
inline |
Convert amplitude to decibels
Definition at line 70 of file al_Functions.hpp.
TEM T al::atan2Fast | ( | const T & | y, |
const T & | x | ||
) |
Fast approximation to atan2().
Definition at line 584 of file al_Functions.hpp.
|
inline |
Returns value clipped ouside of range [-eps, eps]
Definition at line 580 of file al_Functions.hpp.
|
inline |
Bezier curve, 3-point quadratic.
'frac' [0, 1) is the value on the curve btw x2 and x0
Definition at line 225 of file al_Interpolation.hpp.
|
inline |
Bezier curve, 4-point cubic.
'frac' [0, 1) is the value on the curve btw x3 and x0
Definition at line 242 of file al_Interpolation.hpp.
|
inline |
Bilinear interpolation between values on corners of quadrilateral
Definition at line 182 of file al_Interpolation.hpp.
|
inline |
Bilinear interpolation between values on corners of quadrilateral
Definition at line 191 of file al_Interpolation.hpp.
|
inline |
Returns number of bits set to 1.
From "Bit Twiddling Hacks", http://graphics.stanford.edu/~seander/bithacks.html#CountBitsSetParallel
Definition at line 600 of file al_Functions.hpp.
|
inline |
Compute weights for cubic cardinal spline.
[out] | w | output weights |
[in] | x | input domain values; spline in [x[1], x[2]] |
[in] | f | fraction in [0,1] |
[in] | b | smoothness parameter in [-1,1]; 1 = Catmull-Rom |
Definition at line 258 of file al_Interpolation.hpp.
Tv al::ipl::casteljau | ( | const Tf & | frac, |
const Tv & | a, | ||
const Tv & | b, | ||
const Tv & | c, | ||
const Tv & | d | ||
) |
de Casteljau algorithm for four point interpolation
frac | Interpolation factor [0, 1] |
a | First point |
b | Second point |
c | Third point |
d | Fourth point |
Definition at line 250 of file al_Interpolation.hpp.
|
inline |
Returns floating point value rounded to next highest integer.
Definition at line 606 of file al_Functions.hpp.
|
inline |
Returns power of two ceiling of value.
This uses an algorithm devised by Sean Anderson, Sep. 2001. From "Bit Twiddling Hacks", http://graphics.stanford.edu/~seander/bithacks.html.
Definition at line 611 of file al_Functions.hpp.
|
inline |
Returns value clipped to [lo, hi] and signifies clipping behavior.
clipFlag signifies if and where clipping occured. 0 means no clipping occured, -1 means clipping occured at the lower bound, and 1 means clipping at the upper bound.
Definition at line 629 of file al_Functions.hpp.
|
inline |
Returns value clipped to [lo, hi]
Definition at line 621 of file al_Functions.hpp.
|
inline |
Returns value clipped to [-hi, hi].
Definition at line 641 of file al_Functions.hpp.
|
inline |
Cubic interpolation.
This is a Cardinal spline with a tension of 0 (AKA a Catmull-Rom spline).
Definition at line 286 of file al_Interpolation.hpp.
|
inline |
Cubic interpolation.
This is a Cardinal spline with a tension of -1.
Definition at line 321 of file al_Interpolation.hpp.
|
inline |
Convert decibels to amplitude
Definition at line 143 of file al_Functions.hpp.
|
inline |
The Gauss error function or probability integral
Definition at line 646 of file al_Functions.hpp.
|
inline |
Returns whether or not an integer value is even.
Definition at line 643 of file al_Functions.hpp.
|
inline |
Returns factorial. Argument must be less than or equal to 12.
Definition at line 654 of file al_Functions.hpp.
|
inline |
Returns square root of factorial
Definition at line 656 of file al_Functions.hpp.
|
inline |
Returns floor of floating point value.
Definition at line 663 of file al_Functions.hpp.
|
inline |
Returns power of two floor of value.
This uses an algorithm devised by Sean Anderson, Sep. 2001. From "Bit Twiddling Hacks", http://graphics.stanford.edu/~seander/bithacks.html.
Definition at line 668 of file al_Functions.hpp.
|
inline |
Returns value folded into [lo, hi].
For out-of-range values, the boundaries act like mirrors reflecting the value into the range. For an even number of periods out of the range this is identical to a wrap().
Definition at line 677 of file al_Functions.hpp.
|
inline |
Returns value folded into [lo, hi] one time.
Definition at line 684 of file al_Functions.hpp.
|
inline |
Returns e^(-v*v)
Definition at line 690 of file al_Functions.hpp.
TEM T al::gcd | ( | const T & | x, |
const T & | y | ||
) |
Return greatest common divisor of two arguments
Definition at line 692 of file al_Functions.hpp.
TEM T al::gudermannian | ( | const T & | x | ) |
The Gudermannian function relates circular and hyperbolic functions without using complex numbers.
Definition at line 698 of file al_Functions.hpp.
|
inline |
Hermite interpolation
Definition at line 336 of file al_Interpolation.hpp.
void al::ipl::lagrange | ( | T * | h, |
T | delay, | ||
int | order | ||
) |
Computes FIR coefficients for Waring-Lagrange interpolation.
'h' are the FIR coefficients and should be of size ('order' + 1).
'delay' is a fractional delay in samples.
As order increases, this converges to sinc interpolation.
Definition at line 367 of file al_Interpolation.hpp.
|
inline |
Optimized lagrange() for first order.
Definition at line 382 of file al_Interpolation.hpp.
|
inline |
Optimized lagrange() for second order
Definition at line 388 of file al_Interpolation.hpp.
|
inline |
Optimized lagrange() for third order
Definition at line 395 of file al_Interpolation.hpp.
TEM T al::laguerreL | ( | int | n, |
int | k, | ||
T | x | ||
) |
Generalized Laguerre polynomial L{n,k}.
[in] | n | degree, a non-negative integer |
[in] | k | order |
[in] | x | position http://en.wikipedia.org/wiki/Laguerre_polynomials |
Definition at line 700 of file al_Functions.hpp.
TEM T al::legendreP | ( | int | l, |
int | m, | ||
T | t | ||
) |
Associated Legendre polynomial
P_l^m(cos(t)) = (-1)^{l+m} / (2^l l!) sin^m(t) (d/d cos(t))^{l+m} sin^{2l}(t)
[in] | l | degree where l >= 0 |
[in] | m | order where 0 <= m <= l |
[in] | t | angle in [0, pi] |
http://comp.cs.ehime-u.ac.jp/~ogata/nac/index.html
Definition at line 834 of file al_Functions.hpp.
|
inline |
Returns whether the absolute value is less than an epsilon.
Definition at line 838 of file al_Functions.hpp.
|
inline |
Linear interpolation. Identical to first order Lagrange.
Definition at line 417 of file al_Interpolation.hpp.
|
inline |
Linear interpolation between three elements
Definition at line 422 of file al_Interpolation.hpp.
void al::ipl::linear | ( | Tv * | dst, |
const Tv * | xs, | ||
const Tv * | xp1s, | ||
int | len, | ||
const Tf & | frac | ||
) |
Element-wise linear interpolation between two arrays of values
Definition at line 429 of file al_Interpolation.hpp.
|
inline |
Cyclic linear interpolation between three elements
Definition at line 434 of file al_Interpolation.hpp.
|
inline |
Returns maximum of three values
Definition at line 840 of file al_Functions.hpp.
|
inline |
Returns mean of two values
Definition at line 843 of file al_Functions.hpp.
|
inline |
Returns minimum of three values
Definition at line 844 of file al_Functions.hpp.
|
inline |
Nearest neighbor interpolation
Definition at line 444 of file al_Interpolation.hpp.
|
inline |
Returns nearest integer division of one value to another
Definition at line 288 of file al_Functions.hpp.
|
inline |
Returns the next representable floating-point or integer value following x in the direction of y
Definition at line 863 of file al_Functions.hpp.
|
inline |
Returns next largest value of 'val' that is a multiple of 'multiple'.
Definition at line 866 of file al_Functions.hpp.
|
inline |
Returns the number of digits in the integer portion
Definition at line 871 of file al_Functions.hpp.
|
inline |
Returns whether or not an integer value is odd.
Definition at line 873 of file al_Functions.hpp.
|
inline |
Evaluates polynomial a0 + a1 x + a2 x^2
Definition at line 875 of file al_Functions.hpp.
T al::poly | ( | const T & | x, |
const T & | a0, | ||
const T & | a1, | ||
const T & | a2, | ||
const T & | a3 | ||
) |
Evaluates polynomial a0 + a1 x + a2 x^2 + a3 x^3
|
inline |
Returns value to a positive integer power.
[in] | base | the base value to exponentiate |
[in] | power | the power to exponentiate by |
Definition at line 893 of file al_Functions.hpp.
|
inline |
Returns (n+1)th prime number up to n=53.
Definition at line 923 of file al_Functions.hpp.
void al::rotatePlane | ( | VecN & | v1, |
VecN & | v2, | ||
const Complex< T > & | a | ||
) |
Rotates two vectors by angle in plane formed from bivector v1 ^ v2
Definition at line 321 of file al_Complex.hpp.
|
inline |
Returns value rounded to nearest integer multiple of 'step' towards zero.
Definition at line 925 of file al_Functions.hpp.
|
inline |
Returns value rounded to nearest integer multiple of 'step' towards zero. Faster version to avoid 1/step divide.
Definition at line 926 of file al_Functions.hpp.
|
inline |
Returns value rounded to nearest integer away from zero.
Definition at line 929 of file al_Functions.hpp.
|
inline |
Returns value rounded to nearest to nearest integer multiple of 'step' away from zero.
Definition at line 932 of file al_Functions.hpp.
|
inline |
Signum function for real numbers
Definition at line 936 of file al_Functions.hpp.
|
inline |
Unnormalized sinc function
Definition at line 940 of file al_Functions.hpp.
|
inline |
Returns slope of line passing through two points.
Definition at line 944 of file al_Functions.hpp.
|
inline |
Sort values so that value1 <= value2.
Definition at line 948 of file al_Functions.hpp.
Vec3 al::sterProj | ( | const al::Complex< T > & | c | ) |
Stereographically project complex number onto Riemann sphere
Definition at line 331 of file al_Complex.hpp.
|
inline |
Sum of integers squared from 1 to n.
Definition at line 956 of file al_Functions.hpp.
|
inline |
Returns number of trailing zeros in 32-bit int.
This implements an algorithm from the paper "Using de Bruijn Sequences to Index 1 in a Computer Word" by Charles E. Leiserson, Harald Prokof, and Keith H. Randall.
Definition at line 962 of file al_Functions.hpp.
|
inline |
Trilinear interpolation between values on corners of a hexahedron
Definition at line 200 of file al_Interpolation.hpp.
|
inline |
Trilinear interpolation between values on corners of a hexahedron.
[in] | f | 3 element array of fractions along x, y, and z |
Definition at line 214 of file al_Interpolation.hpp.
|
inline |
Truncates floating point value to step.
Definition at line 964 of file al_Functions.hpp.
|
inline |
Truncates floating point value to step. Faster version to avoid 1/step divide.
Definition at line 965 of file al_Functions.hpp.
|
inline |
Returns whether value is in interval [lo, hi].
Definition at line 969 of file al_Functions.hpp.
|
inline |
Returns whether 3 values are in interval [lo, hi].
Definition at line 976 of file al_Functions.hpp.
|
inline |
Returns whether value is in interval [lo, hi).
Definition at line 972 of file al_Functions.hpp.
|
inline |
Returns value wrapped in [lo, hi).
Definition at line 983 of file al_Functions.hpp.
|
inline |
Returns value wrapped in [lo, hi).
'numWraps' reports how many wrappings occured where the sign, + or -, signifies above 'hi' or below 'lo', respectively.
Definition at line 1005 of file al_Functions.hpp.
T al::wrapAdd1 | ( | const T & | v, |
const T & | max | ||
) |
Returns value incremented by 1 and wrapped into interval [0, max).
Definition at line 479 of file al_Functions.hpp.
|
inline |
Like wrap(), but only adds or subtracts 'hi' once from value.
Definition at line 1033 of file al_Functions.hpp.
|
inline |
Returns value wrapped in [-pi, pi)
Definition at line 1049 of file al_Functions.hpp.
|
inline |
Like wrapPhase(), but only wraps once
Definition at line 1065 of file al_Functions.hpp.