![]() |
VectorNav C++ Library
|
Vector with 2 component specialization. More...
#include <vector.h>
Public Member Functions | |
vec () | |
Creates a new vector with uninitialized components. | |
vec (T val) | |
Creates new vector with components initialized to val. More... | |
vec (T x_val, T y_val) | |
Creates a new vector with its components inintialized to the provided values. More... | |
T & | operator[] (size_t index) |
Indexing into the vector's components. More... | |
const T & | operator[] (size_t index) const |
Indexing into the vector's components. More... | |
vec | operator- () const |
Negates the vector. More... | |
vec & | operator+= (const vec &rhs) |
Adds a vector to this vector. More... | |
vec & | operator-= (const vec &rhs) |
Subtracts a vector from this vector. More... | |
vec & | operator*= (const T &rhs) |
Multiplies the vector by a scalar. More... | |
vec & | operator/= (const T &rhs) |
Divides the vector by a scalar. More... | |
size_t | dim () const |
The vector's dimension. More... | |
vec | neg () const |
Negates the vector. More... | |
T | mag () const |
The vector's magnitude. More... | |
vec | add (const vec &toAdd) const |
Adds a vector to this vector. More... | |
vec | sub (const vec &to_sub) const |
Subtracts a vector from this vector. More... | |
vec | mult (const double &scalar) const |
Multiplies the vector by a scalar. More... | |
vec | div (const double &scalar) const |
Divides the vector by a scalar. More... | |
vec | norm () const |
Normalizes the vector. More... | |
T | dot (const vec &rhs) const |
Computes the dot product of this and the provided vector. More... | |
Static Public Member Functions | |
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... | |
static vec | unitX () |
Unit vector pointing in the X (0-component) direction. More... | |
static vec | unitY () |
Unit vector pointing in the Y (1-component) direction. More... | |
Public Attributes | |
union vn::math::vec< 2, T >:: { ... } | |
T | x |
X (0-component). | |
T | y |
Y (1-component). | |
T | c [2] |
The vector's components. | |
Vector with 2 component specialization.
|
inlineexplicit |
Creates new vector with components initialized to val.
[in] | val | The initialization value. |
|
inline |
Creates a new vector with its components inintialized to the provided values.
[in] | x_val | The x value. |
[in] | y_val | The y value. |
|
inline |
Adds a vector to this vector.
[in] | toAdd | The vector to add. |
|
inline |
The vector's dimension.
|
inline |
Divides the vector by a scalar.
[in] | scalar | The scalar value. |
|
inline |
Computes the dot product of this and the provided vector.
[in] | rhs | The right-side vector. |
|
inline |
The vector's magnitude.
|
inline |
Multiplies the vector by a scalar.
[in] | scalar | The scalar value. |
|
inline |
Negates the vector.
|
inline |
Normalizes the vector.
|
inlinestatic |
Vector with all of its components set to 1.
|
inline |
Multiplies the vector by a scalar.
[in] | rhs | The scalar. |
|
inline |
Adds a vector to this vector.
[in] | rhs | The right-side vector. |
|
inline |
Negates the vector.
|
inline |
Subtracts a vector from this vector.
[in] | rhs | The right-side vector. |
|
inline |
Divides the vector by a scalar.
[in] | rhs | The scalar. |
|
inline |
Indexing into the vector's components.
[in] | index | 0-based component index. |
dimension_error | The index exceeded the dimension of the vector. |
|
inline |
Indexing into the vector's components.
[in] | index | 0-based component index. |
dimension_error | The index exceeded the dimension of the vector. |
|
inline |
Subtracts a vector from this vector.
[in] | to_sub | The vector to subtract from this. |
|
inlinestatic |
Unit vector pointing in the X (0-component) direction.
|
inlinestatic |
Unit vector pointing in the Y (1-component) direction.
|
inlinestatic |
Vector with all of its components set to 0.