Public Member Functions |
| Vec4 () |
| Trivial constructor, the vector is NOT initialized.
|
| Vec4 (T val) |
| Constructor with one argument, e.g. Vec4f v(0);.
|
| Vec4 (T x, T y, T z, T w) |
| Constructor with three arguments, e.g. Vec4f v(1,2,3);.
|
template<typename Source > |
| Vec4 (Source *a) |
| Constructor with array argument, e.g. float a[4]; Vec4f v(a);.
|
template<typename Source > |
| Vec4 (const Tuple< 4, Source > &v) |
| Conversion constructor.
|
T & | x () |
| Reference to the component, e.g. v.x() = 4.5f;.
|
T & | y () |
T & | z () |
T & | w () |
T | x () const |
| Get the component, e.g. float f = v.y();.
|
T | y () const |
T | z () const |
T | w () const |
T * | asPointer () |
const T * | asPointer () const |
T & | operator() (int i) |
| Alternative indexed reference to the elements.
|
T | operator() (int i) const |
| Alternative indexed constant reference to the elements,.
|
Vec3< T > | getVec3 () const |
| Returns a Vec3 with the first three elements of the Vec4.
|
const Vec4< T > & | init (T x=0, T y=0, T z=0, T w=0) |
const Vec4< T > & | setZero () |
| Set "this" vector to zero.
|
template<typename Source > |
const Vec4< T > & | operator= (const Vec4< Source > &v) |
| Assignment operator.
|
bool | eq (const Vec4< T > &v, T eps=1.0e-8) const |
Vec4< T > | operator- () const |
| Negation operator, for e.g. v1 = -v2;.
|
template<typename T0 , typename T1 > |
const Vec4< T > & | add (const Vec4< T0 > &v1, const Vec4< T1 > &v2) |
template<typename T0 , typename T1 > |
const Vec4< T > & | sub (const Vec4< T0 > &v1, const Vec4< T1 > &v2) |
template<typename T0 , typename T1 > |
const Vec4< T > & | scale (T0 scale, const Vec4< T1 > &v) |
template<typename T0 , typename T1 > |
const Vec4< T > & | div (T0 scalar, const Vec4< T1 > &v) |
T | dot (const Vec4< T > &v) const |
| Dot product.
|
T | length () const |
| Length of the vector.
|
T | lengthSqr () const |
bool | normalize (T eps=1.0e-8) |
| this = normalized this
|
Vec4< T > | unit (T eps=0) const |
| return normalized this, throws if null vector
|
Vec4< T > | unit (T eps, T &len) const |
| return normalized this and length, throws if null vector
|
template<typename S > |
const Vec4< T > & | operator*= (S scalar) |
| Returns v, where for .
|
template<typename S > |
const Vec4< T > & | operator*= (const Vec4< S > &v1) |
| Returns v0, where for .
|
template<typename S > |
const Vec4< T > & | operator/= (S scalar) |
| Returns v, where for .
|
template<typename S > |
const Vec4< T > & | operator/= (const Vec4< S > &v1) |
| Returns v0, where for .
|
template<typename S > |
const Vec4< T > & | operator+= (S scalar) |
| Returns v, where for .
|
template<typename S > |
const Vec4< T > & | operator+= (const Vec4< S > &v1) |
| Returns v0, where for .
|
template<typename S > |
const Vec4< T > & | operator-= (S scalar) |
| Returns v, where for .
|
template<typename S > |
const Vec4< T > & | operator-= (const Vec4< S > &v1) |
| Returns v0, where for .
|
bool | isNan () const |
| True if a Nan is present in vector.
|
bool | isInfinite () const |
| True if an Inf is present in vector.
|
bool | isFinite () const |
| True if all no Nan or Inf values present.
|
T | operator[] (int i) const |
T & | operator[] (int i) |
std::string | str () const |
void | write (std::ostream &os) const |
void | read (std::istream &is) |
|
These are mostly for backwards compability with functions that take old-style Vs (which are just arrays).
|
void | toV (S *v) const |
| Copies this tuple into an array of a compatible type.
|
value_type * | asV () |
| Exposes the internal array. Be careful when using this function.
|
value_type const * | asV () const |
| Exposes the internal array. Be careful when using this function.
|