Difference between revisions of "Matrix"
(tried to fill missing methods short description) |
|||
Line 33: | Line 33: | ||
=== Methods === | === Methods === | ||
[[Matrix.new]] ''creates a new Matrix object''<br/><!--GIDEROSMTD:Matrix.new(m11,m12,m21,m22,tx,ty) creates a new Matrix object--> | [[Matrix.new]] ''creates a new Matrix object''<br/><!--GIDEROSMTD:Matrix.new(m11,m12,m21,m22,tx,ty) creates a new Matrix object--> | ||
+ | [[Matrix:duplicate]] ''returns a copy of this matrix''<br/><!--GIDEROSMTD:Matrix:duplicate() returns a copy of this matrix --> | ||
+ | [[Matrix.fromSRT]] ''builds a matrix from scale/rotation/translation components''<br/><!--GIDEROSMTD:Matrix.fromSRT(srt,reverse) builds a matrix from scale/rotation/translation components --> | ||
[[Matrix:getAnchorPosition]] ''gets anchor position from matrix transformation''<br/><!--GIDEROSMTD:Matrix:getAnchorPosition() gets anchor position from matrix transformation--> | [[Matrix:getAnchorPosition]] ''gets anchor position from matrix transformation''<br/><!--GIDEROSMTD:Matrix:getAnchorPosition() gets anchor position from matrix transformation--> | ||
[[Matrix:getElements]] ''returns the elements of this matrix instance''<br/><!--GIDEROSMTD:Matrix:getElements() returns the elements of this matrix instance--> | [[Matrix:getElements]] ''returns the elements of this matrix instance''<br/><!--GIDEROSMTD:Matrix:getElements() returns the elements of this matrix instance--> | ||
Line 86: | Line 88: | ||
| style="width: 50%; vertical-align:top;"| | | style="width: 50%; vertical-align:top;"| | ||
+ | |||
=== Events === | === Events === | ||
=== Constants === | === Constants === |
Revision as of 08:33, 19 November 2021
Supported platforms:
Available since: Gideros 2011.6
Inherits from: Object
Description
The Matrix class specifies transformation from one coordinate space to another.
These transformations include translation, rotation, scaling and skewing.
A 2D transformation matrix is a 3 x 3 matrix in homogeneous coordinate system:
You can get and set the values of all six of the properties in a Matrix object: m11, m12, m21, m22, tx, and ty.
Since Gideros 2016.6, Matrix can also hold 3D (4x4) matrices.
Examples
Applying matrix to Sprite objects
local angle = math.rad(30)
-- create skew matrix
local m = Matrix.new(1, math.tan(angle), math.tan(angle), 1, 0, 0)
-- apply to Sprite
local sprite = Sprite.new()
sprite:setMatrix(m)
MethodsMatrix.new creates a new Matrix object |
EventsConstants |