Kanzi Engine API
kanzi::SRTValue2D Class Reference

Structure describing scale, rotation and translation transformation in 2D space. More...

#include <kanzi/core/math/srt_value_2d.hpp>

Public Member Functions

float getRotation () const
 Returns rotation. More...
 
Vector2 getScale () const
 Returns the scale. More...
 
float getScaleX () const
 Returns scale along X. More...
 
float getScaleY () const
 Returns scale along Y. More...
 
Vector2 getTranslation () const
 Returns translation. More...
 
float getTranslationX () const
 Returns translation along X. More...
 
float getTranslationY () const
 Returns translation along Y. More...
 
void rotate (float rotationInRadians)
 Applies rotation. More...
 
void scale (Vector2 factor)
 Applies scale factor. More...
 
void setRotation (float rotationInRadians)
 Sets rotation. More...
 
void setScale (Vector2 value)
 Sets the scale. More...
 
void setScaleX (float value)
 Sets scale along X. More...
 
void setScaleY (float value)
 Sets scale along Y. More...
 
void setTranslation (Vector2 value)
 Sets translation. More...
 
void setTranslationX (float value)
 Sets translation along X. More...
 
void setTranslationY (float value)
 Sets translation along Y. More...
 
 SRTValue2D ()
 Default constructor. More...
 
 SRTValue2D (Vector2 scale, float rotationInRadians, Vector2 translation)
 Constructor with supplied scale, rotation and translation. More...
 
Matrix3x3 toMatrix () const
 Converts the SRT representation to Matrix3x3 transform. More...
 
void translate (Vector2 translation)
 Applies translation. More...
 
void uniformScale (float factor)
 Applies uniform scale factor. More...
 

Static Public Member Functions

static optional< SRTValue2Dcreate (const Matrix3x3 &matrix)
 Attempts to create a SRT object from a given transformation 3x3 matrix. More...
 
static SRTValue2D createRotation (float rotationInRadians)
 Creates a rotation SRT. More...
 
static SRTValue2D createScale (Vector2 scale)
 Creates a scale SRT. More...
 
static SRTValue2D createTranslation (Vector2 translation)
 Creates a translation SRT. More...
 

Friends

bool operator!= (const SRTValue2D &left, const SRTValue2D &right)
 Operator !=. More...
 
bool operator== (const SRTValue2D &left, const SRTValue2D &right)
 Operator ==. More...
 

Detailed Description

Structure describing 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.

Member Function Documentation

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

Returns the scale.

void kanzi::SRTValue2D::setScale ( Vector2  value)
inline

Sets the scale.

void kanzi::SRTValue2D::scale ( Vector2  factor)
inline

Applies scale factor.

Multiplies current scale with provided factor.

void kanzi::SRTValue2D::uniformScale ( float  factor)
inline

Applies uniform scale factor.

Multiplies current scale with provided factor.

float kanzi::SRTValue2D::getScaleX ( ) const
inline

Returns scale along X.

void kanzi::SRTValue2D::setScaleX ( float  value)
inline

Sets scale along X.

float kanzi::SRTValue2D::getScaleY ( ) const
inline

Returns scale along Y.

void kanzi::SRTValue2D::setScaleY ( float  value)
inline

Sets scale along Y.

float kanzi::SRTValue2D::getRotation ( ) const
inline

Returns rotation.

Rotation is angle in radians.

void kanzi::SRTValue2D::setRotation ( float  rotationInRadians)
inline

Sets rotation.

Rotation is angle in radians.

void kanzi::SRTValue2D::rotate ( float  rotationInRadians)
inline

Applies rotation.

Provided angle is added. Rotation is angle in radians.

Vector2 kanzi::SRTValue2D::getTranslation ( ) const
inline

Returns translation.

void kanzi::SRTValue2D::setTranslation ( Vector2  value)
inline

Sets translation.

void kanzi::SRTValue2D::translate ( Vector2  translation)
inline

Applies translation.

Adds provided translation to existing translation.

float kanzi::SRTValue2D::getTranslationX ( ) const
inline

Returns translation along X.

void kanzi::SRTValue2D::setTranslationX ( float  value)
inline

Sets translation along X.

float kanzi::SRTValue2D::getTranslationY ( ) const
inline

Returns translation along Y.

void kanzi::SRTValue2D::setTranslationY ( float  value)
inline

Sets translation along Y.

Matrix3x3 kanzi::SRTValue2D::toMatrix ( ) const

Converts the SRT representation to Matrix3x3 transform.

static SRTValue2D kanzi::SRTValue2D::createScale ( Vector2  scale)
inlinestatic

Creates a scale SRT.

static SRTValue2D kanzi::SRTValue2D::createRotation ( float  rotationInRadians)
inlinestatic

Creates a rotation SRT.

Rotation is angle in radians.

static SRTValue2D kanzi::SRTValue2D::createTranslation ( Vector2  translation)
inlinestatic

Creates a translation SRT.

static optional<SRTValue2D> kanzi::SRTValue2D::create ( const Matrix3x3 matrix)
static

Attempts to create a SRT object from a given transformation 3x3 matrix.

Note: A matrix is decomposable into SRT if its column vectors are orthogonal to each other.

Parameters
matrixThe transformation 3x3 matrix.
Returns
A SRTValue3D object if the matrix is decomposable, nullopt otherwise.

Friends And Related Function Documentation

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

Operator ==.

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

Operator !=.


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