Public Member Functions | Public Attributes | List of all members
Vector2D Class Reference

2D Mathematical vector More...

#include <geometry.hpp>

Inheritance diagram for Vector2D:
Inheritance graph
[legend]
Collaboration diagram for Vector2D:
Collaboration graph
[legend]

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...
 
Vector2Doperator+= (Vector2D const &v)
 Addition. More...
 
Vector2Doperator-= (Vector2D const &v)
 Subtraction. More...
 
Vector2Doperator= (Vector2D const &v)
 Assigment operator. More...
 
Vector2Doperator*= (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...
 
- Public Member Functions inherited from Serializable
virtual ~Serializable (void)
 Class destructor.
 

Public Attributes

double x
 Component in the x direction.
 
double y
 Component in the y direction.
 

Detailed Description

2D Mathematical vector

Definition at line 15 of file geometry.hpp.

Constructor & Destructor Documentation

◆ Vector2D() [1/3]

Vector2D::Vector2D ( void  )

Null constructor.

Sets all components to 0

Definition at line 30 of file geometry.cpp.

Here is the caller graph for this function:

◆ Vector2D() [2/3]

Vector2D::Vector2D ( double  ix,
double  iy 
)

Class constructor.

Parameters
ixx Component
iyy Component

Definition at line 33 of file geometry.cpp.

◆ Vector2D() [3/3]

Vector2D::Vector2D ( const Vector2D v)

Class copy constructor.

Parameters
vOther vector

Definition at line 36 of file geometry.cpp.

Member Function Documentation

◆ distance()

double Vector2D::distance ( Vector2D const &  v1) const

Caluclates the distance from the Vector to v1.

Parameters
v1The vector whose distance from is calculated
Returns
The distance

Definition at line 13 of file geometry.cpp.

Here is the caller graph for this function:

◆ getChunkSize()

size_t Vector2D::getChunkSize ( void  ) const
virtual

Returns the size of array needed to store all data.

Returns
Size of array

Implements Serializable.

Definition at line 169 of file geometry.cpp.

Here is the caller graph for this function:

◆ operator*=()

Vector2D & Vector2D::operator*= ( double  s)

Scalar product.

Parameters
sScalar
Returns
Reference to the vector multiplied by scalar

Definition at line 54 of file geometry.cpp.

◆ operator+=()

Vector2D & Vector2D::operator+= ( Vector2D const &  v)

Addition.

Parameters
vVector to be added
Returns
Reference to sum

Definition at line 61 of file geometry.cpp.

◆ operator-=()

Vector2D & Vector2D::operator-= ( Vector2D const &  v)

Subtraction.

Parameters
vVector to be subtracted
Returns
Difference

Definition at line 68 of file geometry.cpp.

◆ operator=()

Vector2D & Vector2D::operator= ( Vector2D const &  v)

Assigment operator.

Parameters
vVector to be copied
Returns
The assigned value

Definition at line 45 of file geometry.cpp.

◆ Rotate()

void Vector2D::Rotate ( double  a)

Rotates the vector in an anticlockwise direction.

Parameters
aAngle of rotation (in radians)

Definition at line 75 of file geometry.cpp.

Here is the caller graph for this function:

◆ serialize() [1/2]

template<class Archive >
void Vector2D::serialize ( Archive &  ar,
const unsigned  int 
)
inline

Serializer.

Parameters
arArchiver
intVersion

Definition at line 88 of file geometry.hpp.

Here is the call graph for this function:

◆ serialize() [2/2]

vector< double > Vector2D::serialize ( void  ) const
virtual

Convert an object to an array of numbers.

Returns
Array of numbers

Implements Serializable.

Definition at line 174 of file geometry.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Set()

void Vector2D::Set ( double  ix,
double  iy 
)

Set vector components.

Parameters
ixx Component
iyy Component

Definition at line 39 of file geometry.cpp.

Here is the caller graph for this function:

◆ unserialize()

void Vector2D::unserialize ( const vector< double > &  data)
virtual

Convert an array of numbers to an object.

Parameters
dataList of numbers

Implements Serializable.

Definition at line 183 of file geometry.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

The documentation for this class was generated from the following files: