List of all members | Public Member Functions | Public Attributes | Related Functions
thor::PolarVector2< T > Struct Template Reference

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

r
 Radius.
 
phi
 Angle in degrees.
 

Related Functions

template<typename T >
length (const PolarVector2< T > &vector)
 Returns the length of a polar vector. More...
 
template<typename T >
polarAngle (const PolarVector2< T > &vector)
 Returns the angle of a polar vector in degrees. More...
 

Detailed Description

template<typename T>
struct thor::PolarVector2< T >

Vector in polar coordinate system.

2D vector which stores its components in polar instead of cartesian coordinates.

Constructor & Destructor Documentation

template<typename T>
thor::PolarVector2< T >::PolarVector2 ( )

Default constructor.

Creates a zero vector. The angle phi measures 0 degrees.

template<typename T>
thor::PolarVector2< T >::PolarVector2 ( radius,
angle 
)

Constructs a polar vector with specified radius and angle.

Parameters
radiusThe radial component (length of the vector).
angleThe angular component in degrees.
template<typename T>
thor::PolarVector2< T >::PolarVector2 ( const sf::Vector2< T > &  vector)

Constructs a polar vector from a cartesian SFML vector.

Parameters
vectorCartesian (x,y) vector being converted to polar coordinates. Zero vectors are allowed and result in a polar vector with r=0 and phi=0.

Member Function Documentation

template<typename T>
thor::PolarVector2< T >::operator sf::Vector2< T > ( ) const

Converts the polar vector into a cartesian SFML vector.

Returns
Equivalent (x,y) vector in cartesian coordinates.

The documentation for this struct was generated from the following files: