Template for a Euclidean vector.
More...
#include <vector.h>
|
static vec | zero () |
| Vector with all of its components set to 0. More...
|
|
static vec | one () |
| Vector with all of its components set to 1. More...
|
|
|
T | c [tdim] |
| The vector's components.
|
|
template<size_t tdim, typename T = float>
struct vn::math::vec< tdim, T >
Template for a Euclidean vector.
- Examples:
- getting_started/main.cpp, math/main.cpp, and uart_protocol/main.cpp.
template<size_t tdim, typename T = float>
Creates new vector with components initialized to val.
- Parameters
-
[in] | val | The initialization value. |
template<size_t tdim, typename T = float>
Adds a vector to this vector.
- Parameters
-
[in] | toAdd | The vector to add. |
- Returns
- The resulting vector.
template<size_t tdim, typename T = float>
The vector's dimension.
- Returns
- The vector's dimension.
template<size_t tdim, typename T = float>
Divides the vector by a scalar.
- Parameters
-
[in] | scalar | The scalar value. |
- Returns
- The divided vector.
template<size_t tdim, typename T = float>
Computes the dot product of this and the provided vector.
- Parameters
-
[in] | rhs | The right-side vector. |
- Returns
- The computed dot product.
template<size_t tdim, typename T = float>
The vector's magnitude.
- Returns
- The magnitude.
- Examples:
- math/main.cpp.
template<size_t tdim, typename T = float>
Multiplies the vector by a scalar.
- Parameters
-
[in] | scalar | The scalar value. |
- Returns
- The multiplied vector.
template<size_t tdim, typename T = float>
Negates the vector.
- Returns
- The negated vector.
template<size_t tdim, typename T = float>
Normalizes the vector.
- Returns
- The normalized vector.
- Examples:
- math/main.cpp.
template<size_t tdim, typename T = float>
Vector with all of its components set to 1.
- Returns
- The 1 vector.
template<size_t tdim, typename T = float>
Multiplies the vector by a scalar.
- Parameters
-
- Returns
- The multiplied vector.
template<size_t tdim, typename T = float>
Adds a vector to this vector.
- Parameters
-
[in] | rhs | The right-side vector. |
- Returns
- The resulting vector.
template<size_t tdim, typename T = float>
Negates the vector.
- Returns
- The negated vector.
template<size_t tdim, typename T = float>
Subtracts a vector from this vector.
- Parameters
-
[in] | rhs | The right-side vector. |
- Returns
- The resulting vector.
template<size_t tdim, typename T = float>
Divides the vector by a scalar.
- Parameters
-
- Returns
- The divided vector.
template<size_t tdim, typename T = float>
Indexing into the vector's components.
- Parameters
-
[in] | index | 0-based component index. |
- Exceptions
-
template<size_t tdim, typename T = float>
const T& vn::math::vec< tdim, T >::operator[] |
( |
size_t |
index | ) |
const |
|
inline |
Indexing into the vector's components.
- Parameters
-
[in] | index | 0-based component index. |
- Exceptions
-
template<size_t tdim, typename T = float>
Subtracts a vector from this vector.
- Parameters
-
[in] | to_sub | The vector to subtract from this. |
- Returns
- The resulting vector.
template<size_t tdim, typename T = float>
Vector with all of its components set to 0.
- Returns
- The 0 vector.
The documentation for this struct was generated from the following file: