SRTValue2D
¶
A structure that describes the scale, rotation and translation transformation in 2D space. Rotation is stored as angle in radians.
Functions which can be used to create new instances of SRTValue2D.
| SRTValue2D() | Default constructor |
| SRTValue2D() | Constructor with supplied scale, rotation and translation |
Default constructor.
local srtvalue2d = SRTValue2D()
Constructor with supplied scale, rotation and translation.
local srtvalue2d = SRTValue2D(scale, rotationInRadians, translation)
| scale | (Vector2) | The scale. |
| rotationInRadians | (float) | The rotation angle in radians. |
| translation | (Vector2) | The translation. |
Methods of SRTValue2D class.
| SRTValue2D:getScale() | Returns the scale |
| SRTValue2D:setScale() | Sets the scale |
| SRTValue2D:scale() | Multiplies the current scale with the provided scaling factor |
| SRTValue2D:uniformScale() | Multiplies the current scale with the provided uniform scaling factor |
| SRTValue2D:getScaleX() | Returns the scale along the x-axis |
| SRTValue2D:setScaleX() | Sets the scale along the x-axis |
| SRTValue2D:getScaleY() | Returns the scale along the y-axis |
| SRTValue2D:setScaleY() | Sets the scale along the y-axis |
| SRTValue2D:getRotation() | Returns the rotation |
| SRTValue2D:setRotation() | Sets the rotation |
| SRTValue2D:rotate() | Adds a rotation angle to the current rotation |
| SRTValue2D:getTranslation() | Returns the translation |
| SRTValue2D:setTranslation() | Sets the translation |
| SRTValue2D:translate() | Adds the provided translation to the current translation |
| SRTValue2D:getTranslationX() | Returns the translation along the x-axis |
| SRTValue2D:setTranslationX() | Sets the translation along the x-axis |
| SRTValue2D:getTranslationY() | Returns the translation along the y-axis |
| SRTValue2D:setTranslationY() | Sets the translation along the y-axis |
| SRTValue2D:toMatrix() | Converts the SRT representation to Matrix3x3 transform |
| SRTValue2D.createScale() | Creates a scale SRT |
| SRTValue2D.createRotation() | Creates a rotation SRT |
| SRTValue2D.createTranslation() | Creates a translation SRT |
| SRTValue2D.create() | Attempts to create an SRT object from a given transformation 3x3 matrix |
| SRTValue2D:translated() | Translates the SRT object |
| SRTValue2D:scaled() | Scales the SRT object |
| SRTValue2D:rotated() | Rotates the SRT object |
Returns the scale.
| (Vector2) | The scale. |
Sets the scale.
| value | (Vector2) | The scale. |
Multiplies the current scale with the provided scaling factor.
| factor | (Vector2) | The scaling factor. |
Multiplies the current scale with the provided uniform scaling factor.
| factor | (float) | The scaling factor. |
Returns the scale along the x-axis.
| (float) | The x component of the scale. |
Sets the scale along the x-axis.
| value | (float) | The x component of the scale. |
Returns the scale along the y-axis.
| (float) | The y component of the scale. |
Sets the scale along the y-axis.
| value | (float) | The y component of the scale. |
Returns the rotation.
| (float) | The rotation angle in radians. |
Sets the rotation.
| rotationInRadians | (float) | The rotation angle in radians. |
Adds a rotation angle to the current rotation.
| rotationInRadians | (float) | The rotation angle in radians. |
Returns the translation.
| (Vector2) | The translation. |
Sets the translation.
| value | (Vector2) | The translation. |
Adds the provided translation to the current translation.
| translation | (Vector2) | The translation term. |
Returns the translation along the x-axis.
| (float) | The x component of the translation. |
Sets the translation along the x-axis.
| value | (float) | The x component of the translation. |
Returns the translation along the y-axis.
| (float) | The y component of the translation. |
Sets the translation along the y-axis.
| value | (float) | The y component of the translation. |
Converts the SRT representation to Matrix3x3 transform.
| (Matrix3x3) | A matrix representation of the SRT object. |
Creates a scale SRT.
| scale | (Vector2) | The scale. |
| (SRTValue2D) | An SRT object with scale. |
Creates a rotation SRT.
| rotationInRadians | (float) | The rotation angle in radians. |
| (SRTValue2D) | An SRT object with rotation. |
Creates a translation SRT.
| translation | (Vector2) | The translation. |
| (SRTValue2D) | An SRT object with translation. |
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 | (Matrix3x3) | The transformation 3x3 matrix. |
| (SRTValue2D or nil) | If the matrix is decomposable, returns an SRTValue3D object, otherwise nil. |
Translates the SRT object.
| translation | (Vector2) | The translation term. |
| (SRTValue2D) | A new SRT object with the translation applied. |
Scales the SRT object.
| scale | (Vector2) | The scaling factor. |
| (SRTValue2D) | A new SRT object with the scale applied. |
Rotates the SRT object.
| rotationInRadians | (float) | The rotation angle in degrees. |
| (SRTValue2D) | A new SRT object with the rotation applied. |
SRTValue2D specific standalone functions, which are not a part of the SRTValue2D class.