2 #include "../misc/utils.hpp" 10 v.
x*sin(a)+v.
y*cos(a));
15 return sqrt((x-v1.
x)*(x-v1.
x)
21 return sqrt(v.
x*v.
x+v.
y*v.
y);
77 x =
x*cos(a)-
y*sin(a);
78 y =
x*sin(a)+
y*cos(a);
176 vector<double> res(2,0);
183 (
const vector<double>& data)
double distance(Vector2D const &v1) const
Caluclates the distance from the Vector to v1.
Geometrical calculations.
size_t getChunkSize(void) const
Returns the size of array needed to store all data.
Vector3D CrossProduct(Vector3D const &v1, Vector3D const &v2)
Returns the cross product of two vectors.
void Rotate(double a)
Rotates the vector in an anticlockwise direction.
Vector3D Reflect(Vector3D const &v, Vector3D const &normal)
Reflect vector.
double Projection(Vector3D const &v1, Vector3D const &v2)
Calculates the projection of one vector in the direction of the second.
double CalcAngle(Vector3D const &v1, Vector3D const &v2)
Returns the angle between two vectors (in radians)
double y
Component in the y direction.
vector< double > serialize(void) const
Convert an object to an array of numbers.
double fastsqrt(double x)
Fast approximate sqrt.
Vector3D operator*(double d, Vector3D const &v)
Scalar product.
Vector2D Rotate(Vector2D const &v, double a)
Rotates a vector.
Vector2D pol2cart(double radius, double angle)
Converts from polar coordinates to cartesian coordinates.
double ScalarProd(Vector3D const &v1, Vector3D const &v2)
Scalar product of two vectors.
Vector3D operator/(Vector3D const &v, double d)
Scalar division.
Vector2D & operator+=(Vector2D const &v)
Addition.
Vector2D normalize(const Vector2D &v)
Normalized a vector.
Vector2D & operator*=(double s)
Scalar product.
void Set(double ix, double iy)
Set vector components.
Vector2D & operator-=(Vector2D const &v)
Subtraction.
Vector2D(void)
Null constructor.
Vector2D & operator=(Vector2D const &v)
Assigment operator.
double abs(Vector3D const &v)
Norm of a vector.
Vector3D operator+(Vector3D const &v1, Vector3D const &v2)
Term by term addition.
Vector2D calc_mid_point(Vector2D const &v1, Vector2D const &v2)
Calculates the mid point between two vectors.
void unserialize(const vector< double > &data)
Convert an array of numbers to an object.
double fastabs(Vector2D const &v)
Norm of a vector, less accurate.
double x
Component in the x direction.
Vector2D zcross(Vector2D const &v)
Cross product of a vector in x,y plane with a unit vector in the z direction.
Vector3D operator-(Vector3D const &v1, Vector3D const &v2)
Term by term subtraction.
double dist_sqr(const Vector2D &v)
Calculates the square of the distance. This is computationaly cheaper then actually calculating the d...