Quantunet.com

My Account

Joins Us
Flash 8 Actionscript 2.0 Knowledgebase
Matrix Transformation Knowledgebase

Matrix Transformations
The rules which govern how elements in matrices behave give rise to unique behvours and characteristics. In many cases these characteristics can be used to simplifiy multi-step operations in algebra by creating a predictable structure of manipulation which can be elegantly manipulated using matrix operations. With vector manipulation x and y cordinates of a object can be stored in a matrix so the matrix acts to describe the object. This matrix can then be multiplied by another matrix call and operator which will modify its perperties in a predicatble way creating a resulting matrix with a new modified description of the original object.

For example:


All the matrix does is provide the mechanism in which to calculate a set of results. However this mechanism can be used to produce a variety of effects on the properties of objects in space such as translation, reflection, rotation and distortion.

The Indentity Matrix

The identity matrix

Multiplying 2D coordinates by the identity matrix:
How to reflect a shape using matrices and actionscript
To learn more about the identity matrix reflection [Matrix Reflection Knowledegbase].


A Scale Matrix

scaling matrix

Stretch a shape along the y axis
How to stretch an object using matrices and actionscript:
To learn more about matrix distortion matrices see: [Matrix Scale Knowledegbase].


The Reflection Matrix:

y axis reflection

Reflecting an object in the y axis:
How to reflect a shape using matrices and actionscript
To learn more about matrix reflection [Matrix Reflection Knowledegbase].

The Translation Matrix:

trsnslation matrix

Translating an object in 2d space:
How to move an object using matrices and actionscript
To learn more about matrix translation [Matrix Translation Knowledegbase].


A Skew Matrix
(affline transformations)

vert and horix skew matrix

Skew a shape along the y axis
How to stretch an object using matrices and actionscript:
To learn more about matrix distortion see: [Matrix Skew Knowledegbase].


A Rotation Matrix

rotation matrix

Rotating a shape about the z axis:
How to rotate an object using matrices and actionscript
To learn more about matrix rotation [Matrix Rotation Knowledegbase].


The Transformation Matrix
The transfomation matrix is a fusion of multiple different matrix operations. It can translate, scale, rotate and skew a movie clip with one operation. In this way it can vastly simplify calculations involving multiple operations and organize calculations involving multiple coordinates. Instead of having to perform seperate calcualtions on a set of points the transformation matrix can be used to perform them all at the same time. This makes a very versatile matrix operator so in flash the "transform" matrix has its own class.

This matrix operator represents what is "under the hood" of the transform matrix class in flash.

 transformation matrix  
  • a and d can be adjusted to scale or reflect a movie clip.
  • c and b can be used tovertically or horizontall skew a movie clip.
  • a,b,c and d can be used together to rotate amovie clip.
  • tx and and ty are used to translate the position of the movie clip on stage.

*u,v and w cannot be accessed in the transform matrix class.

An alternative representation of this matrix can be found that has the same elements but with thier positions flipped. This matrix performs the same operations but when used to manipulated points it requires a slighlty different calcualtion set up (using row vectors instead of column vectors). However the results are the same as the orientation of the elements in an operation matrix is ultimately not important (the relative position is).

transfrmation matrix 2

Traditionally in computer graphics and modeling u v and w have been used to perfrom extra graphical transformations however in flash the transformation matrix class can only perate in 2d space so the values of u and v are au6tomatically set to zero and the value of w is set to one.

transformation matrix values

It is in this form that the transform matrix is most often shown in flash (in the flash help pages).

Methods Of The Matrix Transform Class (AS 2.0)
In flash the transform matrix is used as a generic to perform generic transformation or combinations of transformation at the same time. If a user wants to perform a specific operation they could use a modified form of the tranformation matrix or use a selected "method" of the matrix transform class. For example:

translate(tx:Number, ty:Number):Void
scale(sx:Number, sy:Number):Void
rotate(angle:Number):Void
identity():Void

Using these methods selected operations can be performed such as translation, rotation, scale or reflection without the need to work directly with matrices.

Note: In Actionscript 2.0 there is no skew method available for the matrix transform class.


© 2008 Quantunet LLC All Rights Reserved | Intellectual Property | Terms of Use | Privacy
Home | About Quantunet | FAQ's | Contact Us