Image programming in actionscript3 games)

Source: Internet
Author: User

Total Directory: http://blog.csdn.net/iloveas2014/article/details/38304477

 

4.2.2 induction of matrix transformation and its embodiment in matrix


Although there are many types of operations and matrices, it is not difficult to figure out that these transformations are similar to two types: they are multiplied by a 1*2 matrix and a 2*2 matrix:

 

And

Therefore, matrix contains six variables, A, B, C, D, TX, and Ty. However, Adobe skillfully combines the addition matrix and multiplication matrix into a 3*2 matrix, only retaining multiplication. This reduces the number of matrix operations and facilitates the migration of matrix operations. You must know that there are more than one matrix in ActionScript.

 

 
After the merger, two problems are required:


1 3*2 the matrix does not meet the conditions of matrix multiplication. What should I do?


2. How to Implement addition in multiplication?


The first problem is that Adobe uses the method of adding blank columns to complete:

 


 
U, V, W completely act as the placeholder, so you can fill in the value of the unit matrix:

 


 
What is the value of Z equal? Calculate the matrix above:

 


 
We can see that both Tx and ty are added to X and Y respectively. If Z is set to 1, the second problem is solved at the same time.


The following matrix represents the calculation process of matrix.

 


 
So far, the structure of matrix has been formed, and it can be used for the basic transformation of 2D graphics. What I have never wondered is why the Adobe help file does not include the horizontal variables A, C, TX, and vertical variables B, d, and ty in the same column, I tried to apply the Matrix Multiplication. Adobe's layout seems to have never been explained. So here I made my own claim to adjust the position of B and C in the Adobe matrix.


Although I have been entangled in this detail for a long time, readers do not need to care about it, because it does not affect our use of the matrix class.

 


 

Image programming in actionscript3 games)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.