#include <Vector.h>
A vector can consist of elements of any primitive type, and it may have any number of components - or dimensions, whichever. The main purpose of the Vector class is to provide a convenient way of serializing and deserializing vector-type robot properties using XML.
It is possible to perform arithmetic operations on Vectors. The + and - operators are defined for Vectors and for the content type. Furthermore, the * and / operators are defined for the content type. Thus, operations like Vector<double,3> * double, Vector<double3> - Vector<double,3> are possible.
Public Methods | |
| Vector () | |
| Create an empty vector with all elements initialized to zero. | |
| Vector (T firstElement,...) | |
| Initialize a vector with the given elements. | |
| Vector (const Vector &other) | |
| The copy constructor. | |
| Vector & | operator= (const Vector &other) |
| Copy a vector. | |
| Vector & | operator= (T scalar) |
| Set all elements in a vector to a scalar. | |
| Vector & | operator+= (const Vector &other) |
| Add another vector to this vector (element-wise). | |
| Vector & | operator-= (const Vector &other) |
| Subtract another vector from this vector (element-wise). | |
| T & | operator[] (int index) |
| Get the vector element at index. | |
| const T & | operator[] (int index) const |
| Get the vector element at index (const version). | |
| Vector & | operator+= (T value) |
| Add a scalar value to each element. | |
| Vector & | operator-= (T value) |
| Subtract a scalar value from each element. | |
| Vector & | operator *= (T value) |
| Multiply each element by a scalar value. | |
| Vector & | operator/= (T value) |
| Divide each element by a scalar value. | |
Public Attributes | |
| T | componentArray [comps] |
| The components of this vector in an array. | |