A structure that describes the scale, rotation and translation transformation in 2D space. More...
#include <kanzi/core/math/srt_value_2d.hpp>
Public Member Functions | |
KZ_NO_DISCARD float | getRotation () const |
Returns the rotation. More... | |
KZ_NO_DISCARD Vector2 | getScale () const |
Returns the scale. More... | |
KZ_NO_DISCARD float | getScaleX () const |
Returns the scale along the x-axis. More... | |
KZ_NO_DISCARD float | getScaleY () const |
Returns the scale along the y-axis. More... | |
KZ_NO_DISCARD Vector2 | getTranslation () const |
Returns the translation. More... | |
KZ_NO_DISCARD float | getTranslationX () const |
Returns the translation along the x-axis. More... | |
KZ_NO_DISCARD float | getTranslationY () const |
Returns the translation along the y-axis. More... | |
void | rotate (float rotationInRadians) |
Adds a rotation angle to the current rotation. More... | |
KZ_NO_DISCARD SRTValue2D | rotated (float rotationInRadians) const |
Rotates the SRT object. More... | |
void | scale (Vector2 factor) |
Multiplies the current scale with the provided scaling factor. More... | |
KZ_NO_DISCARD SRTValue2D | scaled (Vector2 scale) const |
Scales the SRT object. More... | |
void | setRotation (float rotationInRadians) |
Sets the rotation. More... | |
void | setScale (Vector2 value) |
Sets the scale. More... | |
void | setScaleX (float value) |
Sets the scale along the x-axis. More... | |
void | setScaleY (float value) |
Sets the scale along the y-axis. More... | |
void | setTranslation (Vector2 value) |
Sets the translation. More... | |
void | setTranslationX (float value) |
Sets the translation along the x-axis. More... | |
void | setTranslationY (float value) |
Sets the translation along the y-axis. More... | |
SRTValue2D () | |
Default constructor. More... | |
SRTValue2D (Vector2 scale, float rotationInRadians, Vector2 translation) | |
Constructor with supplied scale, rotation and translation. More... | |
KZ_NO_DISCARD Matrix3x3 | toMatrix () const |
Converts the SRT representation to Matrix3x3 transform. More... | |
void | translate (Vector2 translation) |
Adds the provided translation to the current translation. More... | |
KZ_NO_DISCARD SRTValue2D | translated (Vector2 translation) const |
Translates the SRT object. More... | |
void | uniformScale (float factor) |
Multiplies the current scale with the provided uniform scaling factor. More... | |
Static Public Member Functions | |
static KZ_NO_DISCARD optional< SRTValue2D > | create (const Matrix3x3 &matrix) |
Attempts to create an SRT object from a given transformation 3x3 matrix. More... | |
static KZ_NO_DISCARD SRTValue2D | createRotation (float rotationInRadians) |
Creates a rotation SRT. More... | |
static KZ_NO_DISCARD SRTValue2D | createScale (Vector2 scale) |
Creates a scale SRT. More... | |
static KZ_NO_DISCARD SRTValue2D | createTranslation (Vector2 translation) |
Creates a translation SRT. More... | |
Friends | |
KZ_NO_DISCARD friend bool | operator!= (const SRTValue2D &left, const SRTValue2D &right) |
Inequality operator. More... | |
KZ_NO_DISCARD friend bool | operator== (const SRTValue2D &left, const SRTValue2D &right) |
Equality operator. More... | |
A structure that describes the scale, rotation and translation transformation in 2D space.
Rotation is stored as angle in radians.
|
inlineexplicit |
Default constructor.
|
inlineexplicit |
Constructor with supplied scale, rotation and translation.
scale | The scale. |
rotationInRadians | The rotation angle in radians. |
translation | The translation. |
|
inline |
Returns the scale.
|
inline |
Sets the scale.
value | The scale. |
|
inline |
Multiplies the current scale with the provided scaling factor.
factor | The scaling factor. |
|
inline |
Multiplies the current scale with the provided uniform scaling factor.
factor | The scaling factor. |
|
inline |
Returns the scale along the x-axis.
|
inline |
Sets the scale along the x-axis.
value | The x component of the scale. |
|
inline |
Returns the scale along the y-axis.
|
inline |
Sets the scale along the y-axis.
value | The y component of the scale. |
|
inline |
Returns the rotation.
|
inline |
Sets the rotation.
rotationInRadians | The rotation angle in radians. |
|
inline |
Adds a rotation angle to the current rotation.
rotationInRadians | The rotation angle in radians. |
|
inline |
Returns the translation.
|
inline |
Sets the translation.
value | The translation. |
|
inline |
Adds the provided translation to the current translation.
translation | The translation term. |
|
inline |
Returns the translation along the x-axis.
|
inline |
Sets the translation along the x-axis.
value | The x component of the translation. |
|
inline |
Returns the translation along the y-axis.
|
inline |
Sets the translation along the y-axis.
value | The y component of the translation. |
KZ_NO_DISCARD Matrix3x3 kanzi::SRTValue2D::toMatrix | ( | ) | const |
Converts the SRT representation to Matrix3x3 transform.
|
inlinestatic |
Creates a scale SRT.
scale | The scale. |
|
inlinestatic |
Creates a rotation SRT.
rotationInRadians | The rotation angle in radians. |
|
inlinestatic |
Creates a translation SRT.
translation | The translation. |
|
static |
Attempts to create an SRT object from a given transformation 3x3 matrix.
Note that you can decompose a matrix into SRT only if its column vectors are orthogonal to each other.
matrix | The transformation 3x3 matrix. |
|
inline |
Translates the SRT object.
translation | The translation term. |
|
inline |
Scales the SRT object.
scale | The scaling factor. |
|
inline |
Rotates the SRT object.
rotationInRadians | The rotation angle in degrees. |
|
friend |
Equality operator.
left | The left operand. |
right | The right operand. |
|
friend |
Inequality operator.
left | The left operand. |
right | The right operand. |