Helper class for exchanging vectors of four float components. More...
#include <InstantIO/Vec4.h>
Public Member Functions | |
Vec4 () | |
Constructor that initializes all components of the vector with 0. | |
Vec4 (T x, T y, T z, T w) | |
Constructor that initializes the components of the vector with the given float values. | |
Vec4 (const T *vec) | |
Constructor that initializes the components of the vector with the values of a given float array. | |
Vec4 (const Vec4 &vec) | |
Constructor that initializes the components of the vector with the components taken from another vector. | |
const Vec4 & | operator= (const Vec4 &vec) |
Assigns the components of another Vec4 object to this object's components. | |
const T * | operator= (const T *vec) |
Assigns an array of floats to this object's components. | |
void | setX (T x) |
Sets the value of the x component. | |
T | getX () const |
Returns the value of the x component. | |
void | setY (T y) |
Sets the value of the y component. | |
T | getY () const |
Returns the value of the y component. | |
void | setZ (T z) |
Sets the value of the z component. | |
T | getZ () const |
Returns the value of the z component. | |
void | setW (T w) |
Sets the value of the w component. | |
T | getW () const |
Returns the value of the w component. | |
void | set (T x, T y, T z, T w) |
Sets the values of the x, y, z and w components. | |
void | set (const T *vec) |
Sets the values of the x, y, z and w components. | |
void | set (const Vec4 &vec) |
Sets the values of the x, y, z and w components. | |
void | get (T &x, T &y, T &z, T &w) const |
Returns the values of the x, y, z and w components. | |
void | get (T *vec) const |
Returns the values of the x, y, z and w components. | |
void | get (Vec4 &vec) const |
Returns the values of the x, y, z and w components. | |
const T * | get () const |
Returns the values of the x, y, z and w components. | |
T * | get () |
Returns the values of the x, y, z and w components. | |
T | operator[] (int i) const |
Returns a component of the vector specified by an index. | |
T & | operator[] (int i) |
Returns a component of the vector specified by an index. | |
operator T * () | |
Converts the Vec4 object to an array of floats. | |
operator const T * () const | |
Converts the Vec4 object to an array of floats. | |
Friends | |
bool | operator== (const Vec4 &a, const Vec4 &b) |
Checks if all components of two vectors are the same. | |
bool | operator!= (const Vec4 &a, const Vec4 &b) |
Checks if two vectors differ at least in one component. |
Helper class for exchanging vectors of four float components.
Vec4 is a basic helper class for exchanging vectors of four float components between different software components. It does not contain any means for vector arithmetics, only methods for setting and getting the components. It is not meant to be used directly by software components for vector representation. Instead, software components should use their own, appropriate classes for handling vectors. Only when sending vectors to an OutSlot, or when receiving vectors from an InSlot, the internal representation of vectors should be converted to Vec4's. This ensures the interoperability between different software components that use different internal representations for vectors.
InstantIO::Vec4< T >::Vec4 | ( | T | x, | |
T | y, | |||
T | z, | |||
T | w | |||
) | [inline] |
Constructor that initializes the components of the vector with the given float values.
x | Value of the x component of the new vector. | |
y | Value of the y component of the new vector. | |
z | Value of the z component of the new vector. | |
w | Value of the w component of the new vector. |
InstantIO::Vec4< T >::Vec4 | ( | const T * | vec | ) | [inline] |
Constructor that initializes the components of the vector with the values of a given float array.
vec | An array of at least four float values. The x component of the vector is set to the value of the first element of the array, the y component is set to the value of the second element of the array, the z component is set to the value of the third element of the array, and the w component is set to the value of the fourth element of the array. |
InstantIO::Vec4< T >::Vec4 | ( | const Vec4< T > & | vec | ) | [inline] |
Constructor that initializes the components of the vector with the components taken from another vector.
vec | The other vector used to initialize the new vector. |
const Vec4& InstantIO::Vec4< T >::operator= | ( | const Vec4< T > & | vec | ) | [inline] |
Assigns the components of another Vec4 object to this object's components.
vec | The other Vec4 object |
const T* InstantIO::Vec4< T >::operator= | ( | const T * | vec | ) | [inline] |
Assigns an array of floats to this object's components.
vec | An array of at least four float values. The x component of the vector is set to the value of the first element of the array, the y component is set to the value of the second element of the array, the z component is set to the value of the third element of the array, and the w component is set to the value of the fourth element of the array. |
void InstantIO::Vec4< T >::setX | ( | T | x | ) | [inline] |
Sets the value of the x component.
x | The new value of the x component |
T InstantIO::Vec4< T >::getX | ( | ) | const [inline] |
Returns the value of the x component.
void InstantIO::Vec4< T >::setY | ( | T | y | ) | [inline] |
Sets the value of the y component.
y | The new value of the y component |
T InstantIO::Vec4< T >::getY | ( | ) | const [inline] |
Returns the value of the y component.
void InstantIO::Vec4< T >::setZ | ( | T | z | ) | [inline] |
Sets the value of the z component.
z | The new value of the z component |
T InstantIO::Vec4< T >::getZ | ( | ) | const [inline] |
Returns the value of the z component.
void InstantIO::Vec4< T >::setW | ( | T | w | ) | [inline] |
Sets the value of the w component.
w | The new value of the w component |
T InstantIO::Vec4< T >::getW | ( | ) | const [inline] |
Returns the value of the w component.
void InstantIO::Vec4< T >::set | ( | T | x, | |
T | y, | |||
T | z, | |||
T | w | |||
) | [inline] |
Sets the values of the x, y, z and w components.
x | The new value of the x component | |
y | The new value of the y component | |
z | The new value of the z component | |
w | The new value of the w component |
void InstantIO::Vec4< T >::set | ( | const T * | vec | ) | [inline] |
Sets the values of the x, y, z and w components.
vec | An array of at least four float values. The x component of the vector is set to the value of the first element of the array, the y component is set to the value of the second element of the array, the z component is set to the value of the third element of the array, and the w component is set to the value of the fourth element of the array. |
void InstantIO::Vec4< T >::set | ( | const Vec4< T > & | vec | ) | [inline] |
Sets the values of the x, y, z and w components.
vec | The other vector used to set the components of this vector. |
void InstantIO::Vec4< T >::get | ( | T & | x, | |
T & | y, | |||
T & | z, | |||
T & | w | |||
) | const [inline] |
Returns the values of the x, y, z and w components.
x | Returns the x component of the vector | |
y | Returns the y component of the vector | |
z | Returns the z component of the vector | |
w | Returns the w component of the vector |
void InstantIO::Vec4< T >::get | ( | T * | vec | ) | const [inline] |
Returns the values of the x, y, z and w components.
vec | A float array that gets filled with the components of the vector. This array must have at least four elements. The first element of the array is set to the x component of the vector, the second element of the array is set to the y component of the vector, the third element of the array is set to the z component of the vector, and the fourth element of the array is set to the w component of the vector. |
void InstantIO::Vec4< T >::get | ( | Vec4< T > & | vec | ) | const [inline] |
Returns the values of the x, y, z and w components.
vec | The other vector whose components are set to components of this vector. |
const T* InstantIO::Vec4< T >::get | ( | ) | const [inline] |
Returns the values of the x, y, z and w components.
T* InstantIO::Vec4< T >::get | ( | ) | [inline] |
Returns the values of the x, y, z and w components.
T InstantIO::Vec4< T >::operator[] | ( | int | i | ) | const [inline] |
Returns a component of the vector specified by an index.
i | The index of the component (must be 0, 1, 2 or 3) |
T& InstantIO::Vec4< T >::operator[] | ( | int | i | ) | [inline] |
Returns a component of the vector specified by an index.
i | The index of the component (must be 0, 1, 2 or 3) |
InstantIO::Vec4< T >::operator T * | ( | ) | [inline] |
Converts the Vec4 object to an array of floats.
InstantIO::Vec4< T >::operator const T * | ( | ) | const [inline] |
Converts the Vec4 object to an array of floats.
Checks if all components of two vectors are the same.
a | The first vector | |
b | The second vector |
Checks if two vectors differ at least in one component.
a | The first vector | |
b | The second vector |