Bromeon
Public Member Functions | Public Attributes | Related Functions
thor::PolarVector2< T > Struct Template Reference

Vector in polar coordinate system. More...

List of all members.

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

r
 Radius.
phi
 Angle in degrees.

Related Functions

typedef PolarVector2< float > thor::PolarVector2f
 Type definition for float polar vectors.
template<typename T >
thor::Length (const PolarVector2< T > &vector)
 Returns the length of a polar vector.
template<typename T >
thor::PolarAngle (const PolarVector2< T > &vector)
 Returns the angle of a polar vector in degrees.

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 file: