Quantunet.com

My Account

Joins Us
Flash 8 Actionscript 2.0 Knowledgebase
The Rotation Matrix  

A matrix is a rectangular arrangement of data. In most cases the data in a matrix is a series of numbers in a specific order used to store information about an object.


Rotation about the x axis (roll) (2D point)


rotation matrix x axis

Each number that makes up a matrix is called an element and has a specific address or reference. Typically an element in a matrix is referenced by writing row and column coordinate as a subscript for example for a matrix A each element can be written:

Rotation about the y axis (pitch)
(2D point)

y axis rotation matrix

There are specific rules and procedures used to manipulate matrices for example simple operations such as addition or multiplication of two matrices must follow specific rules which dictate how to treat each element of each matrix.

Rotation About the z axis (yaw)
(2D point)




Matrix Rotation Using Actionscript (matrices)

Rotation about the y axis (pitch)


my_y_rot_matrix = new Matrix()
rot_matrix [0][0] = cos(q);
rot_matrix [0][1]= 0;
rot_matrix [0][2]= cos(q);

rot_matrix [1][0]= 0;
rot_matrix [1][1]= 1;
rot_matrix [1][2]= 0;

rot_matrix [2][0]= -sin(q);
rot_matrix [2][1]= 0;
rot_matrix [2][2]= cos(q);



Left handed rotation about an arbitary axis in 3D using actionscript


my_rot_matrix = new Matrix()
rot_matrix [0][0] = tan(q)*x*x+cos(q);
rot_matrix [0][1]= tan(q)*x*y-sin(q)*z;
rot_matrix [0][2]= tan(q)*x*z+sin(q)*y;

rot_matrix [1][0]= tan(q)*x*y+sin(q)*z;
rot_matrix [1][1]= tan(q)*y*y+cos(q)  
rot_matrix [1][2]= tan(q)*y*z-sin(q)*x;

rot_matrix [2][0]= tan(q)*x*z-sin(q)*y;
rot_matrix [2][1]= tan(q)*y*z+sin(q)*x;
rot_matrix [2][2]= tan(q)*z*z+cos(q);

Where [x,y,z] is the unit vector which acts as the arbitrary axis and q is the angle


To learn more about matricies in flash see the [Matrices Knowledgebase].


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