|
| | Vec (const T &v=T()) |
| |
| | Vec (const T &v1, const T &v2) |
| |
| | Vec (const T &v1, const T &v2, const T &v3) |
| |
| | Vec (const T &v1, const T &v2, const T &v3, const T &v4) |
| |
| template<int N2, class T2 > |
| | Vec (const Vec< N2, T2 > &v) |
| |
| template<class Tv , class Ts > |
| | Vec (const Vec< N - 1, Tv > &v, const Ts &s) |
| |
| template<class T2 > |
| | Vec (const T2 *v, int stride=1) |
| |
|
template<class V > |
| V & | as () |
| | Get reference to self as another type.
|
| |
|
template<class V > |
| const V & | as () const |
| |
|
const T * | elems () const |
| | Get read-only pointer to elements.
|
| |
|
T * | elems () |
| | Get read-write pointer to elements.
|
| |
|
T * | begin () |
| |
|
const T * | begin () const |
| |
|
T * | end () |
| |
|
const T * | end () const |
| |
|
T & | operator[] (size_t i) |
| | Set element at index with no bounds checking.
|
| |
|
const T & | operator[] (size_t i) const |
| | Get element at index with no bounds checking.
|
| |
|
bool | operator== (const Vec &v) const |
| | Return true if objects are element-wise equal, false otherwise.
|
| |
|
bool | operator== (const T &v) const |
| | Return true if all elements are equal to value, false otherwise.
|
| |
|
bool | operator!= (const Vec &v) const |
| | Return true if objects are not element-wise equal, false otherwise.
|
| |
|
bool | operator!= (const T &v) const |
| | Return true if all elements are not equal to value, false otherwise.
|
| |
|
Vec< 2, T > | get (int i0, int i1) const |
| | Get a vector comprised of indexed elements.
|
| |
|
Vec< 3, T > | get (int i0, int i1, int i2) const |
| | Get a vector comprised of indexed elements.
|
| |
|
Vec< 4, T > | get (int i0, int i1, int i2, int i3) const |
| | Get a vector comprised of indexed elements.
|
| |
|
template<int M> |
| Vec< M, T > | sub (int begin=0) const |
| | Get a subvector.
|
| |
|
template<int M> |
| Vec< M, T > & | sub (int begin=0) |
| |
|
Vec & | operator= (const Vec &v) |
| |
|
Vec & | operator= (const T &v) |
| |
|
Vec & | operator+= (const Vec &v) |
| |
|
Vec & | operator+= (const T &v) |
| |
|
Vec & | operator-= (const Vec &v) |
| |
|
Vec & | operator-= (const T &v) |
| |
|
Vec & | operator*= (const Vec &v) |
| |
|
Vec & | operator*= (const T &v) |
| |
|
Vec & | operator/= (const Vec &v) |
| |
|
Vec & | operator/= (const T &v) |
| |
|
Vec | operator+ (const Vec &v) const |
| |
|
Vec | operator+ (const T &v) const |
| |
|
Vec | operator- (const Vec &v) const |
| |
|
Vec | operator- (const T &v) const |
| |
|
Vec | operator* (const Vec &v) const |
| |
|
Vec | operator* (const T &v) const |
| |
|
Vec | operator/ (const Vec &v) const |
| |
|
Vec | operator/ (const T &v) const |
| |
|
Vec | operator- () const |
| |
|
bool | operator> (const Vec &v) const |
| |
|
bool | operator< (const Vec &v) const |
| |
|
template<class T2 > |
| Vec & | set (const Vec< N, T2 > &v) |
| | Set elements from another vector.
|
| |
|
template<int N2, class T2 > |
| Vec & | set (const Vec< N2, T2 > &v) |
| | Set elements from another vector.
|
| |
|
template<class Tv , class Ts > |
| Vec & | set (const Vec< N - 1, Tv > &v, const Ts &s) |
| | Set elements from another vector and scalar.
|
| |
|
Vec & | set (const T &v) |
| | Set all elements to the same value.
|
| |
|
template<class T2 > |
| Vec & | set (const T2 *v) |
| | Set elements from raw C-pointer.
|
| |
|
template<class T2 > |
| Vec & | set (const T2 *v, int stride) |
| | Set elements from strided raw C-pointer.
|
| |
|
Vec & | set (const T &v1, const T &v2) |
| | Set first 2 elements.
|
| |
|
Vec & | set (const T &v1, const T &v2, const T &v3) |
| | Set first 3 elements.
|
| |
|
Vec & | set (const T &v1, const T &v2, const T &v3, const T &v4) |
| | Set first 4 elements.
|
| |
|
Vec & | set (const T &v1, const T &v2, const T &v3, const T &v4, const T &v5) |
| | Set first 5 elements.
|
| |
|
Vec & | set (const T &v1, const T &v2, const T &v3, const T &v4, const T &v5, const T &v6) |
| | Set first 6 elements.
|
| |
|
Vec & | zero () |
| | Set all elements to zero.
|
| |
| template<int Dimension> |
| Vec | by (T shift) const |
| | Returns a nearby vector along some dimension. More...
|
| |
|
Vec | byx (T shift) const |
| | Returns a nearby vector along x.
|
| |
|
Vec | byy (T shift) const |
| | Returns a nearby vector along y.
|
| |
|
Vec | byz (T shift) const |
| | Returns a nearby vector along z.
|
| |
|
template<class U > |
| T | dot (const Vec< N, U > &v) const |
| | Returns dot (inner) product between vectors.
|
| |
|
T | mag () const |
| | Returns magnitude.
|
| |
|
T | magSqr () const |
| | Returns magnitude squared.
|
| |
| T | norm (const T &p) const |
| | Returns p-norm of elements. More...
|
| |
|
T | norm1 () const |
| | Return 1-norm of elements.
|
| |
|
T | norm2 () const |
| | Return 2-norm of elements.
|
| |
|
T | product () const |
| | Returns product of elements.
|
| |
|
T | sum () const |
| | Returns sum of elements.
|
| |
|
T | sumAbs () const |
| | Returns sum of absolute value of elements.
|
| |
|
Vec & | lerp (const Vec &target, T amt) |
| | Linearly interpolate towards some target.
|
| |
|
Vec & | mag (T v) |
| | Set magnitude (preserving direction)
|
| |
|
Vec & | negate () |
| | Negates all elements.
|
| |
| Vec & | normalize (T scale=T(1)) |
| | Set magnitude to one without changing direction. More...
|
| |
| Vec | normalized (T scale=T(1)) const |
| | Return closest vector lying on unit sphere. More...
|
| |
|
Vec | projection (const Vec &u) const |
| | Get projection of vector onto a unit vector.
|
| |
| Vec | rejection (const Vec &u) const |
| | Get rejection of vector from a unit vector. More...
|
| |
|
Vec & | reflect (const Vec &u) |
| | Relect vector around a unit vector.
|
| |
| Vec & | rotate (double angle, int dim1=0, int dim2=1) |
| | Rotate vector on a global plane. More...
|
| |
|
void | print (FILE *out=stdout) const |
| | debug printing
|
| |
template<int N, class T>
class al::Vec< N, T >
Fixed-size n-vector.
This is a fixed size array to enable better loop unrolling optimizations by the compiler and to avoid an extra 'size' data member for small-sized arrays.
Definition at line 117 of file al_Vec.hpp.