Difference between revisions of "Matrix"
Line 2: | Line 2: | ||
'''Supported platforms:''' android, ios, mac, pc<br/> | '''Supported platforms:''' android, ios, mac, pc<br/> | ||
'''Available since:''' Gideros 2011.6<br/> | '''Available since:''' Gideros 2011.6<br/> | ||
− | === Description === | + | === <translate>Description</translate> === |
<translate><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 /> | ||
Line 16: | Line 16: | ||
Since Gideros 2016.6, Matrix can also hold 3D (4x4) matrices.</translate> | Since Gideros 2016.6, Matrix can also hold 3D (4x4) matrices.</translate> | ||
− | === Examples === | + | === <translate>Examples</translate> === |
'''Applying matrix to Sprite objects'''<br/> | '''Applying matrix to Sprite objects'''<br/> | ||
<source lang="lua">local angle = math.rad(30) | <source lang="lua">local angle = math.rad(30) | ||
Line 26: | Line 26: | ||
{|- | {|- | ||
| style="width: 50%; vertical-align:top;"| | | style="width: 50%; vertical-align:top;"| | ||
− | === Methods === | + | === <translate>Methods</translate> === |
[[Special:MyLanguage/Matrix.new|Matrix.new]] ''<translate>creates a new Matrix object</translate>''<br/> | [[Special:MyLanguage/Matrix.new|Matrix.new]] ''<translate>creates a new Matrix object</translate>''<br/> | ||
[[Special:MyLanguage/Matrix:getAnchorPosition|Matrix:getAnchorPosition]] ''<translate>get anchor position from matrix transformation</translate>''<br/> | [[Special:MyLanguage/Matrix:getAnchorPosition|Matrix:getAnchorPosition]] ''<translate>get anchor position from matrix transformation</translate>''<br/> | ||
Line 80: | Line 80: | ||
[[Special:MyLanguage/Matrix:translate|Matrix:translate]] ''<translate>combine existing translation with provided translation</translate>''<br/> | [[Special:MyLanguage/Matrix:translate|Matrix:translate]] ''<translate>combine existing translation with provided translation</translate>''<br/> | ||
| style="width: 50%; vertical-align:top;"| | | style="width: 50%; vertical-align:top;"| | ||
− | === Events === | + | === <translate>Events</translate> === |
− | === Constants === | + | === <translate>Constants</translate> === |
|} | |} |
Revision as of 07:27, 24 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:
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 |