#include <Geometry.h>
Notation of values and constructor order arguments are column based:
x y
Public Member Functions | |
Vector () | |
Constructor, create vector with coordinates (0, 0). | |
Vector (double v) | |
Constructor, create vector with coordinates (v, v). | |
Vector (double x, double y) | |
Constructor, create vector with coordinates (x, y). | |
Vector (double array[2]) | |
Constructor, create vector with coordinates (array[0], array[1]). | |
void | operator+= (const Vector &v) |
Add vector v component by component. | |
void | operator-= (const Vector &v) |
Substract vector v component by component. | |
void | operator *= (double f) |
Multiply each component by scalar f. | |
void | operator/= (double f) |
Divive each component by scalar f. | |
Vector | operator+ (const Vector &v) const |
Add vector v component by component and return the resulting vector. | |
Vector | operator- (const Vector &v) const |
Substract vector v component by component and return the resulting vector. | |
Vector | operator/ (double f) const |
Multiply each component by scalar f and return the resulting vector. | |
Vector | operator * (double f) const |
Divive each component by scalar f and return the resulting vector. | |
double | operator * (const Vector &v) const |
Return the scalar product with vector v. | |
double | norm (void) const |
Return the norm of this vector. | |
double | norm2 (void) const |
Return the square norm of this vector (and thus avoid a square root). | |
double | cross (const Vector &v) const |
Return the cross product with vector v. | |
Vector | unitary (void) const |
Return a unitary vector of same direction. | |
double | angle (void) const |
Return the angle with the horizontal (arc tangant (y/x)). | |
Public Attributes | |
double | x |
components | |
double | y |
components |