Difference between revisions of "Matrix"
Line 3: | Line 3: | ||
'''Available since:''' Gideros 2011.6<br/> | '''Available since:''' Gideros 2011.6<br/> | ||
=== Description === | === Description === | ||
− | <br /> | + | <translate><br /> |
The Matrix class specifies transformation from one coordinate space to another.<br /> | The Matrix class specifies transformation from one coordinate space to another.<br /> | ||
These transformations include translation, rotation, scaling and skewing.<br /> | These transformations include translation, rotation, scaling and skewing.<br /> | ||
Line 12: | Line 12: | ||
<br /> | <br /> | ||
You can get and set the values of all six of the properties in a<br /> | You can get and set the values of all six of the properties in a<br /> | ||
− | Matrix object: | + | Matrix object: [[[m11`, `m12`, `m21`, `m22`, `tx`, and `ty]]].<br /> |
<br /> | <br /> | ||
− | Since Gideros 2016.6, Matrix can also hold 3D (4x4) matrices. | + | Since Gideros 2016.6, Matrix can also hold 3D (4x4) matrices.</translate> |
=== Examples === | === Examples === | ||
'''Applying matrix to Sprite objects'''<br/> | '''Applying matrix to Sprite objects'''<br/> |
Revision as of 13:33, 23 August 2018
Supported platforms: android, ios, mac, pc
Available since: Gideros 2011.6
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 homogenous coordinate system:
![images/matrix_props.png]
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)
--aply to Sprite
local sprite = Sprite.new()
sprite:setMatrix(m)
MethodsMatrix.new - creates a new Matrix object |
EventsConstants |