2D Mathematical vector More...
#include <geometry.hpp>
Public Member Functions | |
Vector2D (void) | |
Null constructor. More... | |
Vector2D (double ix, double iy) | |
Class constructor. More... | |
Vector2D (const Vector2D &v) | |
Class copy constructor. More... | |
void | Set (double ix, double iy) |
Set vector components. More... | |
Vector2D & | operator+= (Vector2D const &v) |
Addition. More... | |
Vector2D & | operator-= (Vector2D const &v) |
Subtraction. More... | |
Vector2D & | operator= (Vector2D const &v) |
Assigment operator. More... | |
Vector2D & | operator*= (double s) |
Scalar product. More... | |
void | Rotate (double a) |
Rotates the vector in an anticlockwise direction. More... | |
double | distance (Vector2D const &v1) const |
Caluclates the distance from the Vector to v1. More... | |
template<class Archive > | |
void | serialize (Archive &ar, const unsigned int) |
Serializer. More... | |
vector< double > | serialize (void) const |
Convert an object to an array of numbers. More... | |
size_t | getChunkSize (void) const |
Returns the size of array needed to store all data. More... | |
void | unserialize (const vector< double > &data) |
Convert an array of numbers to an object. More... | |
![]() | |
virtual | ~Serializable (void) |
Class destructor. | |
Public Attributes | |
double | x |
Component in the x direction. | |
double | y |
Component in the y direction. | |
2D Mathematical vector
Definition at line 15 of file geometry.hpp.
Vector2D::Vector2D | ( | void | ) |
Null constructor.
Sets all components to 0
Definition at line 30 of file geometry.cpp.
Vector2D::Vector2D | ( | double | ix, |
double | iy | ||
) |
Class constructor.
ix | x Component |
iy | y Component |
Definition at line 33 of file geometry.cpp.
Vector2D::Vector2D | ( | const Vector2D & | v | ) |
double Vector2D::distance | ( | Vector2D const & | v1 | ) | const |
Caluclates the distance from the Vector to v1.
v1 | The vector whose distance from is calculated |
Definition at line 13 of file geometry.cpp.
|
virtual |
Returns the size of array needed to store all data.
Implements Serializable.
Definition at line 169 of file geometry.cpp.
Vector2D & Vector2D::operator*= | ( | double | s | ) |
Scalar product.
s | Scalar |
Definition at line 54 of file geometry.cpp.
Addition.
v | Vector to be added |
Definition at line 61 of file geometry.cpp.
Subtraction.
v | Vector to be subtracted |
Definition at line 68 of file geometry.cpp.
Assigment operator.
v | Vector to be copied |
Definition at line 45 of file geometry.cpp.
void Vector2D::Rotate | ( | double | a | ) |
Rotates the vector in an anticlockwise direction.
a | Angle of rotation (in radians) |
Definition at line 75 of file geometry.cpp.
|
inline |
Serializer.
ar | Archiver |
int | Version |
Definition at line 88 of file geometry.hpp.
|
virtual |
Convert an object to an array of numbers.
Implements Serializable.
Definition at line 174 of file geometry.cpp.
void Vector2D::Set | ( | double | ix, |
double | iy | ||
) |
Set vector components.
ix | x Component |
iy | y Component |
Definition at line 39 of file geometry.cpp.
|
virtual |
Convert an array of numbers to an object.
data | List of numbers |
Implements Serializable.
Definition at line 183 of file geometry.cpp.