Geometrical calculations. More...
#include <vector>
#include <boost/array.hpp>
#include "../misc/serializable.hpp"
Go to the source code of this file.
Classes | |
class | Vector2D |
2D Mathematical vector More... | |
Functions | |
double | abs (Vector2D const &v) |
Norm of a vector. More... | |
double | fastabs (Vector2D const &v) |
Norm of a vector, less accurate. More... | |
Vector2D | operator+ (Vector2D const &v1, Vector2D const &v2) |
Term by term addition. More... | |
Vector2D | operator- (Vector2D const &v1, Vector2D const &v2) |
Term by term subtraction. More... | |
Vector2D | operator* (double d, Vector2D const &v) |
Scalar product. More... | |
Vector2D | operator* (Vector2D const &v, double d) |
Scalar product. More... | |
Vector2D | operator/ (Vector2D const &v, double d) |
Scalar division. More... | |
double | ScalarProd (Vector2D const &v1, Vector2D const &v2) |
Scalar product of two vectors. More... | |
double | CalcAngle (Vector2D const &v1, Vector2D const &v2) |
Returns the angle between two vectors (in radians) More... | |
double | Projection (Vector2D const &v1, Vector2D const &v2) |
Calculates the projection of one vector in the direction of the second. More... | |
Vector2D | Rotate (Vector2D const &v, double a) |
Rotates a vector. More... | |
Vector2D | Reflect (Vector2D const &v, Vector2D const &axis) |
Reflect vector. More... | |
double | distance (Vector2D const &v1, Vector2D const &v2) |
Calculates the distance between two vectors. More... | |
double | CrossProduct (Vector2D const &v1, Vector2D const &v2) |
Returns the z component of the cross product of two vectors. More... | |
Vector2D | calc_mid_point (Vector2D const &v1, Vector2D const &v2) |
Calculates the mid point between two vectors. More... | |
Vector2D | zcross (Vector2D const &v) |
Cross product of a vector in x,y plane with a unit vector in the z direction. More... | |
Vector2D | pol2cart (double radius, double angle) |
Converts from polar coordinates to cartesian coordinates. More... | |
Vector2D | normalize (const Vector2D &v) |
Normalized a vector. More... | |
double | dist_sqr (const Vector2D &v) |
Calculates the square of the distance. This is computationaly cheaper then actually calculating the distance. More... | |
Geometrical calculations.
Definition in file geometry.hpp.
double abs | ( | Vector2D const & | v | ) |
Norm of a vector.
v | Two dimensional vector |
Definition at line 19 of file geometry.cpp.
Calculates the mid point between two vectors.
v1 | First vector |
v2 | Second vector |
Definition at line 140 of file geometry.cpp.
Returns the angle between two vectors (in radians)
v1 | First vector |
v2 | Second vector |
Definition at line 119 of file geometry.cpp.
Returns the z component of the cross product of two vectors.
v1 | First vector |
v2 | Second vector |
Definition at line 134 of file geometry.cpp.
double dist_sqr | ( | const Vector2D & | v | ) |
Calculates the square of the distance. This is computationaly cheaper then actually calculating the distance.
v | Vector |
Definition at line 163 of file geometry.cpp.
Calculates the distance between two vectors.
v1 | First vector |
v2 | Second vector |
Definition at line 129 of file geometry.cpp.
double fastabs | ( | Vector2D const & | v | ) |
Norm of a vector, less accurate.
v | Two dimensional vector |
Definition at line 24 of file geometry.cpp.
Normalized a vector.
v | Original vector |
Definition at line 158 of file geometry.cpp.
Scalar product.
d | Scalar |
v | Vector |
Definition at line 92 of file geometry.cpp.
Scalar product.
v | Vector |
d | Scalar |
Definition at line 97 of file geometry.cpp.
Term by term addition.
v1 | First vector |
v2 | Second vector |
Definition at line 81 of file geometry.cpp.
Term by term subtraction.
v1 | First vector |
v2 | Second vector |
Definition at line 86 of file geometry.cpp.
Scalar division.
v | Vector |
d | Scalar |
Definition at line 102 of file geometry.cpp.
Vector2D pol2cart | ( | double | radius, |
double | angle | ||
) |
Converts from polar coordinates to cartesian coordinates.
radius | Radius |
angle | Angle relative to the x axis |
Definition at line 150 of file geometry.cpp.
Calculates the projection of one vector in the direction of the second.
v1 | First vector |
v2 | Direction of the projection |
Definition at line 114 of file geometry.cpp.
Reflect vector.
v | Vector |
axis | Axis of reflection |
Definition at line 124 of file geometry.cpp.
Rotates a vector.
v | Vector |
a | Angle |
Definition at line 7 of file geometry.cpp.
Scalar product of two vectors.
v1 | 2D vector |
v2 | 2D vector |
Definition at line 107 of file geometry.cpp.
Cross product of a vector in x,y plane with a unit vector in the z direction.
v | Vector in the x,y plane |
Definition at line 145 of file geometry.cpp.