Construction of rotating translation matrix

Source: Internet
Author: User

Turn: http://chensavvy.blog.163.com/blog/static/57157189200903185258/

The rotating translation matrix is very important in VC and 3D modeling.

Use a (I, j) as the entry of row I and column J in matrix. For example, a (3, 2) is an entry of 3rd rows and 2nd columns in matrix. Assuming that A, B, and C are matrices and AB = C, the calculation of items c is as follows: C (I, j) = (row I of )? (Column J of B ).

If the point in the plane is regarded as a 1X2 matrix, the point can be transformed by multiplying the point by a 2x2 matrix. Displays several transformations applied to points (2, 1.

 

All transformations shown in the preceding figure are linear transformations. Some other transformations (such as translation) are not linear and cannot be expressed in the form of multiplying the 2x2 matrix. Assume that you want to rotate a vertex 90 degrees from (2, 1), translate it to 3 units in the x direction, and translate it to 4 units in the Y direction. You can perform this operation by first using matrix multiplication and then using matrix addition.

 

A linear transformation (multiplied by a 2x2 matrix) following a one-level moving (addition to a 1X2 matrix) is called an affine transformation. An alternative solution for storing an affined transformation in a matrix (one for the linear part and one for translation) is to store the entire transformation in a 3 × 3 matrix. To make it take effect, points on the plane must be stored in the 1 × 3 matrix with the virtual coordinate. The common method is to make all coordinate coordinates equal to 1. For example, a matrix [2 1 1] represents a vertex (2, 1 ). This example demonstrates an affine transformation that represents multiplying a single 3x3 matrix (Rotating 90 degrees; translating three units in the x direction, and translating four units in the Y direction ).

 

In the previous example, a vertex (2, 1) is mapped to a vertex (2, 6 ). Note that the third column of the 3x3 matrix contains numbers 0, 0, and 1. This will always be the case for a 3 × 3 matrix of an affinic transformation. An important number is the six numbers in column 1 and column 2. 2 × 2 in the upper left corner of the matrix indicates the linear part of the transformation, and the first two items in the second row represent the translation.

 

In GDI +, you can store the affine transform in the matrix object. Because the third column of the Matrix that represents the affinine transformation is always (, 1), when constructing a matrix object, you only need to specify the number of six in the first two columns. The matrix mymatrix = new matrix (0, 1,-1, 0, 3, 4) Statement constructs the matrix displayed in the preceding figure.

Compound Transformation

A composite transformation is a transformation sequence. Consider the matrix and transformation in the following list:
Matrix
Rotate 90 degrees

Matrix B
Scale twice in the X direction

Matrix C
Translate three units in the Y direction

If the vertex (2, 1) represented by [2 1] and multiplied by A, B, and C, then the vertex (2, 1) there are three Transformations in the order listed.

[2 1 1] abc = [-2 5 1]

Instead of storing the three parts of the composite transformation in three independent matrices, We can multiply them together by A, B, and C to obtain a single 3 × 3 matrix that stores the entire composite transformation. Assume abc = D. Then, the result of multiplying a vertex by D is the same as that of multiplying A, B, and C by a vertex.

[2 1 1] d = [-2 5 1]

Displays matrices A, B, C, and D.

 

The matrix of composite transformations can be obtained by multiplying several individual transformation matrices, which means that any sequence of affinsic transformations can be stored in a single matrix object. Warning:

The order of compound transformations is very important. Generally, first rotation, then scaling, and then translation are different from first scaling, then rotating, and then translating. Similarly, the order of matrix multiplication is also important. Generally, ABC is different from BAC.

This matrix is displayed.

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.