Vector in polar coordinate system. More...
Public Member Functions | |
PolarVector2 () | |
Default constructor. | |
PolarVector2 (T radius, T angle) | |
Constructs a polar vector with specified radius and angle. | |
PolarVector2 (const sf::Vector2< T > &vector) | |
Constructs a polar vector from a cartesian SFML vector. | |
operator sf::Vector2< T > () const | |
Converts the polar vector into a cartesian SFML vector. | |
Public Attributes | |
T | r |
Radius. | |
T | phi |
Angle in degrees. | |
Related Functions | |
template<typename T > | |
T | thor::Length (const PolarVector2< T > &vector) |
Returns the length of a polar vector. | |
template<typename T > | |
T | thor::PolarAngle (const PolarVector2< T > &vector) |
Returns the angle of a polar vector in degrees. |
Vector in polar coordinate system.
2D vector which stores its components in polar instead of cartesian coordinates.
thor::PolarVector2< T >::PolarVector2 | ( | ) |
Default constructor.
Creates a zero vector. The angle phi measures 0 degrees.
thor::PolarVector2< T >::PolarVector2 | ( | T | radius, |
T | angle | ||
) |
Constructs a polar vector with specified radius and angle.
radius | The radial component (length of the vector). |
angle | The angular component in degrees. |
thor::PolarVector2< T >::PolarVector2 | ( | const sf::Vector2< T > & | vector | ) |
Constructs a polar vector from a cartesian SFML vector.
vector | Cartesian (x,y) vector being converted to polar coordinates. Zero vectors are allowed and result in a polar vector with r=0 and phi=0. |
thor::PolarVector2< T >::operator sf::Vector2< T > | ( | ) | const |
Converts the polar vector into a cartesian SFML vector.