Common base class for vectors. More...
#include </home/chochlik/devel/oglplus/include/oglplus/math/vector.hpp>
Public Member Functions | |
T * | Data (void) |
Pointer to the components of this vector. | |
const T * | Data (void) const |
Pointer to the components of this vector. | |
T | At (std::size_t i) const |
Access to the i-th component of this vector. More... | |
T | At (std::size_t i, T fallback) const |
Access to the i-th component of this vector with a fallback. More... | |
T & | operator[] (std::size_t i) |
Access to the i-th component of this vector. More... | |
const T & | operator[] (std::size_t i) const |
Const access to the i-th component of this vector. More... | |
void | Add (const VectorBase &v) |
Adds v to this vector. | |
void | Subtract (const VectorBase &v) |
Subtracts v from this vector. | |
void | Multiply (T v) |
Multiplies this vector by a scalar value. | |
void | Multiply (const VectorBase &that) |
Multiplies the elements of this and that vector. | |
void | Divide (T v) |
Divides this vector by a scalar value. | |
void | Divide (const VectorBase &that) |
Divides the elements of this and that vector. | |
T | Length (void) const |
Returns the lenght of this vector. | |
bool | IsNormal (T eps=T(0)) const |
Returns true if the vector is normal. | |
void | Normalize (void) |
Normalizes this vector. | |
Static Public Member Functions | |
static std::size_t | Size (void) |
The size (the number of components) of this vector. | |
static T | DotProduct (const VectorBase &a, const VectorBase &b) |
Computes the dot product of vectors a and b . | |
Friends | |
bool | Equal (const VectorBase &a, const VectorBase &b) |
Equality comparison. | |
Common base class for vectors.
T oglplus::VectorBase< T, N >::At | ( | std::size_t | i | ) | const |
Access to the i-th component of this vector.
T oglplus::VectorBase< T, N >::At | ( | std::size_t | i, |
T | fallback | ||
) | const |
Access to the i-th component of this vector with a fallback.
Similar to At(i), but returns fallback
if i
is greater than or equal to Size().
T& oglplus::VectorBase< T, N >::operator[] | ( | std::size_t | i | ) |
Access to the i-th component of this vector.
const T& oglplus::VectorBase< T, N >::operator[] | ( | std::size_t | i | ) | const |
Const access to the i-th component of this vector.