Robotcode
1.0
|
class that implements mathematical operations for a 2x1 vector More...
#include <Vector2d.h>
Public Member Functions | |
Vector2D (double=0, double=0) | |
Create empty. | |
Vector2D (const Vector2D &) | |
Create by memberwise copy. | |
Vector2D | operator+ (const Vector2D &) const |
Add two vectors. | |
Vector2D | operator- (const Vector2D &) const |
Subtract two vectors. | |
Vector2D | operator* (const double s) const |
Multiply vector by scalar. | |
Vector2D | operator/ (const double s) const |
Divide vector by scalar. | |
double | operator* (const Vector2D &) const |
dot product | |
double & | operator[] (int i) |
Index. | |
Vector2D & | operator= (const Vector2D &) |
Assignment by memberwise copy. | |
Vector2D & | operator-= (const Vector2D &v1) |
minus equal | |
Vector2D & | operator+= (const Vector2D &v1) |
plus equal | |
Vector2D & | operator*= (const Vector2D &v1) |
element by element multiplication | |
Vector2D & | operator*= (double s) |
Vector2D & | operator/= (const Vector2D &v1) |
element by element division | |
Vector2D & | operator/= (double s) |
double | norm () |
Length of the vector. | |
operator double * () | |
Public Attributes | |
double | x [2] |
Friends | |
double | norm (Vector2D) |
Length of the vector. |
class that implements mathematical operations for a 2x1 vector
Most necessary mathematical operations are defined over operator overloading. For some reason the stream operators seem not to work, as there seem to be conflicting definitions somewhere else