21 #ifndef GF_TRANSFORM_H    22 #define GF_TRANSFORM_H    27 #include "Portability.h"    32 #ifndef DOXYGEN_SHOULD_SKIP_THIS    51     : cos(1.0f), sin(0.0f)
    62     : cos(
std::cos(angle)), sin(
std::sin(angle))
    73       cos = std::cos(angle);
    74       sin = std::sin(angle);
    83       return std::atan2(sin, cos);
    98       rotation.
cos * point.x - rotation.
sin * point.y,
    99       rotation.
sin * point.x + rotation.
cos * point.y
   114        rotation.
cos * point.x + rotation.
sin * point.y,
   115       -rotation.
sin * point.x + rotation.
cos * point.y
   144     : offset(translationOffset)
   178     return { point.x + translation.
offset.x, point.y + translation.
offset.y };
   191     return { point.x - translation.
offset.x, point.y - translation.
offset.y };
   225     : rotation(angle), translation(offset)
   251     : translation(offset)
   332     return { mat.xx * point.x + mat.xy * point.y + mat.xz, mat.yx * point.x + mat.yy * point.y + mat.yz };
   355     return Matrix3f(1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f);
   368       1.0f, 0.0f, offset.x,
   369       0.0f, 1.0f, offset.y,
   392     float cos = std::cos(angle);
   393     float sin = std::sin(angle);
   411     float cos = std::cos(angle);
   412     float sin = std::sin(angle);
   414        cos, -sin, center.x * (1 - cos) + center.y * sin,
   415        sin,  cos, center.y * (1 - cos) - center.x * sin,
   449       factor.x,     0.0f, 0.0f,
   450           0.0f, factor.y, 0.0f,
   466       factor.x,     0.0f, center.x * (1.0f - factor.x),
   467           0.0f, factor.y, center.y * (1.0f - factor.y),
   491 #ifndef DOXYGEN_SHOULD_SKIP_THIS   496 #endif // GF_TRANSFORM_H constexpr Vector2f inverseTransform(const Translation &translation, Vector2f point)
Apply an inverse translation to a 2D point. 
Definition: Transform.h:190
 
Rotation(float angle)
Constructor with an angle. 
Definition: Transform.h:61
 
void scale(Matrix3f &mat, Vector2f factor)
Combine the current transform with a scaling. 
 
void setOffset(Vector2f newOffset) noexcept
Set the translation offset. 
Definition: Transform.h:154
 
float getAngle() const
Get the rotation angle. 
Definition: Transform.h:82
 
constexpr Vector2f transform(const Matrix3f &mat, Vector2f point)
Apply an affine transformation to a 2D point. 
Definition: Transform.h:331
 
Vector2f offset
The offset of the translation. 
Definition: Transform.h:125
 
Matrix3f scaling(Vector2f factor)
Get a scaling matrix. 
Definition: Transform.h:447
 
Matrix< float, 3, 3 > Matrix3f
A float square matrix of size 3. 
Definition: Matrix.h:634
 
constexpr Vector2f transform(const Rotation &rotation, Vector2f point)
Apply a rotation to a 2D point. 
Definition: Transform.h:96
 
float sin
The sine of the rotation angle. 
Definition: Transform.h:43
 
A translation. 
Definition: Transform.h:124
 
constexpr Vector2f transform(const Translation &translation, Vector2f point)
Apply a translation to a 2D point. 
Definition: Transform.h:177
 
Translation()
Default constructor. 
Definition: Transform.h:132
 
Vector2f getOffset() const noexcept
Get the translation offset. 
Definition: Transform.h:163
 
General purpose math matrix. 
Definition: Matrix.h:60
 
Translation(Vector2f translationOffset)
Constructor with an offset. 
Definition: Transform.h:143
 
The namespace for gf classes. 
Definition: Action.h:35
 
Matrix3f rotation(float angle)
Get a rotation matrix. 
Definition: Transform.h:391
 
float angle(Direction direction)
Get an angle from a direction. 
 
void rotate(Matrix3f &mat, float angle)
Combine the current transform with a rotation. 
 
Matrix3f translation(Vector2f offset)
Get a translation matrix. 
Definition: Transform.h:366
 
void translate(Matrix3f &mat, Vector2f offset)
Combine the current transform with a translation. 
 
constexpr Vector2f inverseTransform(const Rotation &rotation, Vector2f point)
Apply an inverse rotation to a 2D point. 
Definition: Transform.h:112
 
void setAngle(float angle)
Set the rotation angle. 
Definition: Transform.h:72
 
A rotation. 
Definition: Transform.h:41
 
Rotation()
Default constructor. 
Definition: Transform.h:50
 
constexpr Matrix3f identityTransform()
Identity transform. 
Definition: Transform.h:354
 
float cos
The cosine of the rotation angle. 
Definition: Transform.h:42