Gamedev Framework (gf)  0.11.0 A C++14 framework for 2D games
gf::Transform Struct Reference

A simple transformation (rotation then translation) More...

#include <gf/Transform.h>

## Public Member Functions

Transform ()
Default constructor. More...

Transform (float angle, Vector2f offset)
Constructor with a rotation and a translation. More...

Transform (float angle)
Constructor with a rotation. More...

Transform (Vector2f offset)
Constructor with a translation. More...

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

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

void setOffset (Vector2f offset) noexcept
Set the translation offset. More...

Vector2f getOffset () const noexcept
Get the translation offset. More...

## Public Attributes

Rotation rotation
The rotation of the transformation. More...

Translation translation
The translation of the transformation. More...

## Related Functions

(Note that these are not member functions.)

constexpr Vector2f transform (const Transform &trans, Vector2f point)
Apply a transformation to a 2D point. More...

constexpr Vector2f inverseTransform (const Transform &trans, Vector2f point)
Apply an inverse transformation to a 2D point. More...

## Detailed Description

A simple transformation (rotation then translation)

This class is meant for simple transformation as can be seen in physics. It is the composition of a rotation and a translation.

For more complex affine transformation, you can use gf::Matrix3f.

gf::Matrix3f, gf::Rotation, gf::Translation

## ◆ Transform() [1/4]

 gf::Transform::Transform ( )
inline

Default constructor.

The default transform is the identity.

## ◆ Transform() [2/4]

 gf::Transform::Transform ( float angle, Vector2f offset )
inline

Constructor with a rotation and a translation.

Parameters
 angle The rotation angle offset The translation offset

## ◆ Transform() [3/4]

 gf::Transform::Transform ( float angle )
inline

Constructor with a rotation.

There is no translation.

Parameters
 angle The rotation angle

## ◆ Transform() [4/4]

 gf::Transform::Transform ( Vector2f offset )
inline

Constructor with a translation.

There is no rotation.

Parameters
 offset The translation offset

## ◆ getAngle()

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

Get the rotation angle.

Returns
The rotation angle

## ◆ getOffset()

 Vector2f gf::Transform::getOffset ( ) const
inlinenoexcept

Get the translation offset.

Returns
The translation offset

## ◆ setAngle()

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

Set the rotation angle.

Parameters
 angle The rotation angle

## ◆ setOffset()

 void gf::Transform::setOffset ( Vector2f offset )
inlinenoexcept

Set the translation offset.

Parameters
 offset The translation offset

## ◆ inverseTransform()

 constexpr Vector2f inverseTransform ( const Transform & trans, Vector2f point )
related

Apply an inverse transformation to a 2D point.

Parameters
 trans The transformation point The point to transform
Returns
The transformed point

## ◆ transform()

 constexpr Vector2f transform ( const Transform & trans, Vector2f point )
related

Apply a transformation to a 2D point.

Parameters
 trans The transformation point The point to transform
Returns
The transformed point

## ◆ rotation

 Rotation gf::Transform::rotation

The rotation of the transformation.

## ◆ translation

 Translation gf::Transform::translation

The translation of the transformation.