Vector in polar coordinate system. More...
Public Member Functions | |
PolarVector2 () | |
Default constructor. More... | |
PolarVector2 (T radius, T angle) | |
Constructs a polar vector with specified radius and angle. More... | |
PolarVector2 (const sf::Vector2< T > &vector) | |
Constructs a polar vector from a cartesian SFML vector. More... | |
operator sf::Vector2< T > () const | |
Converts the polar vector into a cartesian SFML vector. More... | |
Public Attributes | |
T | r |
Radius. | |
T | phi |
Angle in degrees. | |
Related Functions | |
template<typename T > | |
T | length (const PolarVector2< T > &vector) |
Returns the length of a polar vector. More... | |
template<typename T > | |
T | polarAngle (const PolarVector2< T > &vector) |
Returns the angle of a polar vector in degrees. More... | |
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.