Class SRTValue3D

A structure that describes the scale, rotation and translation transformation in 3D space. Rotation is stored as quaternion, with the angle in radians.

SRTValue3D constructors

Functions which can be used to create new instances of SRTValue3D.

Synopsis

Methods
SRTValue3D()

Default constructor

SRTValue3D()

Constructor with the supplied scale, rotation angle, and translation

SRTValue3D()

Constructor with the supplied scale, rotation as a quaternion, and translation

SRTValue3D()

Default constructor.

Example
local srtvalue3d = SRTValue3D()
SRTValue3D(scale, eulerAnglesInRadians, translation)

Constructor with the supplied scale, rotation angle, and translation.

Example
local srtvalue3d = SRTValue3D(scale, eulerAnglesInRadians, translation)
Parameters
scale (Vector3)

The scale.

eulerAnglesInRadians (Vector3)

The rotation in Euler angles (radians).

translation (Vector3)

The translation.

SRTValue3D(scale, rotation, translation)

Constructor with the supplied scale, rotation as a quaternion, and translation.

Example
local srtvalue3d = SRTValue3D(scale, rotation, translation)
Parameters
scale (Vector3)

The scale.

rotation (Quaternion)

The rotation.

translation (Vector3)

The translation.

SRTValue3D methods

Methods of SRTValue3D class.

Synopsis

Methods
SRTValue3D:getScale()

Returns the scale

SRTValue3D:setScale()

Sets the scale

SRTValue3D:getScaleX()

Returns the scale along the x-axis

SRTValue3D:setScaleX()

Sets the scale along the x-axis

SRTValue3D:getScaleY()

Returns the scale along the y-axis

SRTValue3D:setScaleY()

Sets the scale along the y-axis

SRTValue3D:getScaleZ()

Returns the scale along the z-axis

SRTValue3D:setScaleZ()

Sets the scale along the z-axis

SRTValue3D:scale()

Multiplies the current scale with the provided scaling factor

SRTValue3D:getRotation()

Returns the rotation as a quaternion

SRTValue3D:setRotation()

Sets the rotation

SRTValue3D:setRotation()

Sets the rotation

SRTValue3D:getTranslation()

Returns the translation

SRTValue3D:setTranslation()

Sets the translation

SRTValue3D:translate()

Adds the provided translation to the current translation

SRTValue3D:getTranslationX()

Returns the translation along the x-axis

SRTValue3D:setTranslationX()

Sets the translation along the x-axis

SRTValue3D:getTranslationY()

Returns the translation along the y-axis

SRTValue3D:setTranslationY()

Sets the translation along the y-axis

SRTValue3D:getTranslationZ()

Returns the translation along the z-axis

SRTValue3D:setTranslationZ()

Sets the translation along the z-axis

SRTValue3D:rotate()

Applies a rotation to the current rotation

SRTValue3D:toMatrix()

Converts the SRT representation to Matrix4x4 transform

SRTValue3D.create()

Attempts to create an SRT object from a given transformation 4x4 matrix

SRTValue3D.createScale()

Creates a scale SRT

SRTValue3D.createUniformScale()

Creates a uniform scale SRT

SRTValue3D.createTranslation()

Creates a translation SRT

SRTValue3D:translated()

Translates the SRT object

SRTValue3D:scaled()

Scales the SRT object

SRTValue3D:rotated()

Rotates the SRT object

SRTValue3D:getScale()

Returns the scale.

Return Values
(Vector3)

The scale.

SRTValue3D:setScale(value)

Sets the scale.

Parameters
value (Vector3)

The scale.

SRTValue3D:getScaleX()

Returns the scale along the x-axis.

Return Values
(float)

The x component of the scale.

SRTValue3D:setScaleX(value)

Sets the scale along the x-axis.

Parameters
value (float)

The x component of the scale.

SRTValue3D:getScaleY()

Returns the scale along the y-axis.

Return Values
(float)

The y component of the scale.

SRTValue3D:setScaleY(value)

Sets the scale along the y-axis.

Parameters
value (float)

The y component of the scale.

SRTValue3D:getScaleZ()

Returns the scale along the z-axis.

Return Values
(float)

The z component of the scale.

SRTValue3D:setScaleZ(value)

Sets the scale along the z-axis.

Parameters
value (float)

The z component of the scale.

SRTValue3D:scale(factor)

Multiplies the current scale with the provided scaling factor.

Parameters
factor (Vector3)

The scaling factor.

SRTValue3D:getRotation()

Returns the rotation as a quaternion.

Return Values
(Quaternion)

The rotation.

SRTValue3D:setRotation(value)

Sets the rotation.

Parameters
value (Quaternion)

Rotation as a quaternion.

SRTValue3D:setRotation(eulerAnglesInRadians)

Sets the rotation.

Parameters
eulerAnglesInRadians (Vector3)

Rotation angle as Euler angle in radians.

SRTValue3D:getTranslation()

Returns the translation.

Return Values
(Vector3)

The translation.

SRTValue3D:setTranslation(value)

Sets the translation.

Parameters
value (Vector3)

The translation.

SRTValue3D:translate(translation)

Adds the provided translation to the current translation.

Parameters
translation (Vector3)

The translation term.

SRTValue3D:getTranslationX()

Returns the translation along the x-axis.

Return Values
(float)

The x component of the translation.

SRTValue3D:setTranslationX(value)

Sets the translation along the x-axis.

Parameters
value (float)

The x component of the translation.

SRTValue3D:getTranslationY()

Returns the translation along the y-axis.

Return Values
(float)

The y component of the translation.

SRTValue3D:setTranslationY(value)

Sets the translation along the y-axis.

Parameters
value (float)

The y component of the translation.

SRTValue3D:getTranslationZ()

Returns the translation along the z-axis.

Return Values
(float)

The z component of the translation.

SRTValue3D:setTranslationZ(value)

Sets the translation along the z-axis.

Parameters
value (float)

The z component of the translation.

SRTValue3D:rotate(rotation)

Applies a rotation to the current rotation.

Parameters
rotation (Quaternion)

Rotation quaternion.

SRTValue3D:toMatrix()

Converts the SRT representation to Matrix4x4 transform.

Return Values
(Matrix4x4)

A matrix representation of the SRT object.

SRTValue3D.create(matrix)

Attempts to create an SRT object from a given transformation 4x4 matrix. Note that you can decompose a matrix into SRT only if its column vectors are orthogonal to each other.

Parameters
matrix (Matrix4x4)

The transformation 4x4 matrix.

Return Values
(SRTValue3D or nil)

If the matrix is decomposable, returns an SRTValue3D object, otherwise nil.

SRTValue3D.createScale(scale)

Creates a scale SRT.

Parameters
scale (Vector3)

The scale.

Return Values
(SRTValue3D)

An SRT object with scale.

SRTValue3D.createUniformScale(scale)

Creates a uniform scale SRT.

Parameters
scale (float)

The scale.

Return Values
(SRTValue3D)

An SRT object with scale.

SRTValue3D.createTranslation(translation)

Creates a translation SRT.

Parameters
translation (Vector3)

The translation.

Return Values
(SRTValue3D)

An SRT object with translation.

SRTValue3D:translated(translation)

Translates the SRT object.

Parameters
translation (Vector3)

The translation term.

Return Values
(SRTValue3D)

A new SRT object with the translation applied.

SRTValue3D:scaled(scale)

Scales the SRT object.

Parameters
scale (Vector3)

The scaling factor.

Return Values
(SRTValue3D)

A new SRT object with the scale applied.

SRTValue3D:rotated(rotation)

Rotates the SRT object.

Parameters
rotation (Quaternion)

The rotation.

Return Values
(SRTValue3D)

A new SRT object with the rotation applied.

SRTValue3D functions

SRTValue3D specific standalone functions, which are not a part of the SRTValue3D class.