Kanzi  3.9.7
Kanzi Engine API
kanzi::SRTValue2D Class Reference

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< SRTValue2Dcreate (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...
 

Detailed Description

A structure that describes the scale, rotation and translation transformation in 2D space.

Rotation is stored as angle in radians.

Constructor & Destructor Documentation

kanzi::SRTValue2D::SRTValue2D ( )
inlineexplicit

Default constructor.

kanzi::SRTValue2D::SRTValue2D ( Vector2  scale,
float  rotationInRadians,
Vector2  translation 
)
inlineexplicit

Constructor with supplied scale, rotation and translation.

Parameters
scaleThe scale.
rotationInRadiansThe rotation angle in radians.
translationThe translation.

Member Function Documentation

KZ_NO_DISCARD Vector2 kanzi::SRTValue2D::getScale ( ) const
inline

Returns the scale.

Returns
The scale.
void kanzi::SRTValue2D::setScale ( Vector2  value)
inline

Sets the scale.

Parameters
valueThe scale.
void kanzi::SRTValue2D::scale ( Vector2  factor)
inline

Multiplies the current scale with the provided scaling factor.

Parameters
factorThe scaling factor.
void kanzi::SRTValue2D::uniformScale ( float  factor)
inline

Multiplies the current scale with the provided uniform scaling factor.

Parameters
factorThe scaling factor.
KZ_NO_DISCARD float kanzi::SRTValue2D::getScaleX ( ) const
inline

Returns the scale along the x-axis.

Returns
The x component of the scale.
void kanzi::SRTValue2D::setScaleX ( float  value)
inline

Sets the scale along the x-axis.

Parameters
valueThe x component of the scale.
KZ_NO_DISCARD float kanzi::SRTValue2D::getScaleY ( ) const
inline

Returns the scale along the y-axis.

Returns
The y component of the scale.
void kanzi::SRTValue2D::setScaleY ( float  value)
inline

Sets the scale along the y-axis.

Parameters
valueThe y component of the scale.
KZ_NO_DISCARD float kanzi::SRTValue2D::getRotation ( ) const
inline

Returns the rotation.

Returns
The rotation angle in radians.
void kanzi::SRTValue2D::setRotation ( float  rotationInRadians)
inline

Sets the rotation.

Parameters
rotationInRadiansThe rotation angle in radians.
void kanzi::SRTValue2D::rotate ( float  rotationInRadians)
inline

Adds a rotation angle to the current rotation.

Parameters
rotationInRadiansThe rotation angle in radians.
KZ_NO_DISCARD Vector2 kanzi::SRTValue2D::getTranslation ( ) const
inline

Returns the translation.

Returns
The translation.
void kanzi::SRTValue2D::setTranslation ( Vector2  value)
inline

Sets the translation.

Parameters
valueThe translation.
void kanzi::SRTValue2D::translate ( Vector2  translation)
inline

Adds the provided translation to the current translation.

Parameters
translationThe translation term.
KZ_NO_DISCARD float kanzi::SRTValue2D::getTranslationX ( ) const
inline

Returns the translation along the x-axis.

Returns
The x component of the translation.
void kanzi::SRTValue2D::setTranslationX ( float  value)
inline

Sets the translation along the x-axis.

Parameters
valueThe x component of the translation.
KZ_NO_DISCARD float kanzi::SRTValue2D::getTranslationY ( ) const
inline

Returns the translation along the y-axis.

Returns
The y component of the translation.
void kanzi::SRTValue2D::setTranslationY ( float  value)
inline

Sets the translation along the y-axis.

Parameters
valueThe y component of the translation.
KZ_NO_DISCARD Matrix3x3 kanzi::SRTValue2D::toMatrix ( ) const

Converts the SRT representation to Matrix3x3 transform.

Returns
A matrix representation of the SRT object.
static KZ_NO_DISCARD SRTValue2D kanzi::SRTValue2D::createScale ( Vector2  scale)
inlinestatic

Creates a scale SRT.

Parameters
scaleThe scale.
Returns
An SRT object with scale.
static KZ_NO_DISCARD SRTValue2D kanzi::SRTValue2D::createRotation ( float  rotationInRadians)
inlinestatic

Creates a rotation SRT.

Parameters
rotationInRadiansThe rotation angle in radians.
Returns
An SRT object with rotation.
static KZ_NO_DISCARD SRTValue2D kanzi::SRTValue2D::createTranslation ( Vector2  translation)
inlinestatic

Creates a translation SRT.

Parameters
translationThe translation.
Returns
An SRT object with translation.
static KZ_NO_DISCARD optional<SRTValue2D> kanzi::SRTValue2D::create ( const Matrix3x3 matrix)
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.

Parameters
matrixThe transformation 3x3 matrix.
Returns
If the matrix is decomposable, returns an SRTValue3D object, otherwise nullopt.
KZ_NO_DISCARD SRTValue2D kanzi::SRTValue2D::translated ( Vector2  translation) const
inline

Translates the SRT object.

Parameters
translationThe translation term.
Returns
A new SRT object with the translation applied.
KZ_NO_DISCARD SRTValue2D kanzi::SRTValue2D::scaled ( Vector2  scale) const
inline

Scales the SRT object.

Parameters
scaleThe scaling factor.
Returns
A new SRT object with the scale applied.
KZ_NO_DISCARD SRTValue2D kanzi::SRTValue2D::rotated ( float  rotationInRadians) const
inline

Rotates the SRT object.

Parameters
rotationInRadiansThe rotation angle in degrees.
Returns
A new SRT object with the rotation applied.

Friends And Related Function Documentation

KZ_NO_DISCARD friend bool operator== ( const SRTValue2D left,
const SRTValue2D right 
)
friend

Equality operator.

Parameters
leftThe left operand.
rightThe right operand.
Returns
If the left and right operand are equal, true, otherwise false.
KZ_NO_DISCARD friend bool operator!= ( const SRTValue2D left,
const SRTValue2D right 
)
friend

Inequality operator.

Parameters
leftThe left operand.
rightThe right operand.
Returns
If the left and right operand are not equal, true, otherwise false.

The documentation for this class was generated from the following file: