Gamedev Framework (gf)  0.12.0
A C++14 framework for 2D games
Public Member Functions | Public Attributes | Related Functions | List of all members
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

Constructor & Destructor Documentation

◆ 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
angleThe rotation angle

Member Function Documentation

◆ 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
angleThe new rotation angle

Friends And Related Function Documentation

◆ inverseTransform()

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

Apply an inverse rotation to a 2D point.

Parameters
rotationThe rotation
pointThe 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
rotationThe rotation
pointThe point to transform
Returns
The transformed point

Member Data Documentation

◆ cos

float gf::Rotation::cos

The cosine of the rotation angle.

◆ sin

float gf::Rotation::sin

The sine of the rotation angle.