Gamedev Framework (gf)  0.6.0 A C++11 framework for 2D games
gf::Rotation Struct Reference

A rotation. More...

#include <gf/Transform.h>

## Public Member Functions

Rotation ()
Default constructor. More...

Rotation (float angle)
Constructor with an angle. More...

void setAngle (float angle)
Set the rotation angle. More...

float getAngle () const
Get the rotation angle. More...

## Public Attributes

float cos
The cosine of the rotation angle. More...

float sin
The sine of the rotation angle. More...

## Related Functions

(Note that these are not member functions.)

constexpr Vector2f transform (const Rotation &rotation, Vector2f point)
Apply a rotation to a 2D point. More...

constexpr Vector2f inverseTransform (const Rotation &rotation, Vector2f point)
Apply an inverse rotation to a 2D point. More...

## Detailed Description

A rotation.

See also
gf::Translation, gf::Transform

## ◆ Rotation() [1/2]

 gf::Rotation::Rotation ( )
inline

Default constructor.

The default rotation is a rotation of angle $$0$$.

## ◆ Rotation() [2/2]

 gf::Rotation::Rotation ( float angle )
inline

Constructor with an angle.

Parameters
 angle The rotation angle

## ◆ getAngle()

 float gf::Rotation::getAngle ( ) const
inline

Get the rotation angle.

Returns
The current rotation angle

## ◆ setAngle()

 void gf::Rotation::setAngle ( float angle )
inline

Set the rotation angle.

Parameters
 angle The new rotation angle

## ◆ inverseTransform()

 constexpr Vector2f inverseTransform ( const Rotation & rotation, Vector2f point )
related

Apply an inverse rotation to a 2D point.

Parameters
 rotation The rotation point The point to transform
Returns
The transformed point

## ◆ transform()

 constexpr Vector2f transform ( const Rotation & rotation, Vector2f point )
related

Apply a rotation to a 2D point.

Parameters
 rotation The rotation point The point to transform
Returns
The transformed point

## ◆ cos

 float gf::Rotation::cos

The cosine of the rotation angle.

## ◆ sin

 float gf::Rotation::sin

The sine of the rotation angle.