[Convert] [matrix] matrix transformation of coordinates

Source: Internet
Author: User

2.3.3 basic two-dimensional transformation

The basic two-dimensional transformations include scaling, rotating, shearing, and translation ).

1) Proportional Transformation

Proportional transformation is to enlarge or reduce the horizontal coordinates of any point on the plane by S11 times, and the vertical coordinates by s22 times, that is

S is called the proportional transformation matrix. Figure 2.24 shows several examples of proportional transformation. In the figure, (B) is S11 = s22, and (c) is S11 = S21.

 

2) Rotation Transformation

Rotation Transformation is to rotate θ around any point on the plane around the origin. It is generally set to be positive in the clockwise direction and negative in the clockwise direction. From figure 2.25, the transformation formula is available:

3) Error tangent Transformation

What is the geometric meaning of non-diagonal elements in the Rotation Transformation Matrix? Observe the example in Figure 2.26. The element S21 in the transformation matrix acts as the "miscut" of the image along the X direction. The smaller the value of Y, the smaller the error cut. S12 is used to "stagger" the image to the Y direction, and the size of the image is proportional to the X value.

4) Translation Transformation

Translation switching refers to moving any point on the plane along the X direction C ., Move ty in the Y direction (Figure 2.27), and its transformation formula is

As shown in the preceding figure, the translation swap cannot be expressed directly by a 2x2 matrix. The following homogeneous coordinate transformation matrix solves this problem.

Note: The Key to this sentence is (the question is why two-digit conversion requires a 3x3 matrix)

2.3.4 homogeneous coordinates

For example, place P = [XY] on the plane to the space to represent [x y H], so that X = x/h, y = y/H is called [x y H ", which is the homogeneous coordinate of point P. If the third component H of the homogeneous coordinate must be 1, it is called the normalized homogeneous coordinate. The normalized homogeneous coordinate of P = [XY "is [x y 1]. Obviously, the points described in the two-dimensional space and the point described in the homogeneous space are one-to-many relationships. After the homogeneous coordinates are used, the available matrix multiplication of translation switching is shown as follows:

Note: now we can see that when translating, X1 = x * 1 + x * 0 + x * Tx, y1 = y * 0 + y * 1 + y * ty is equal to the sum. Now all conversions can use matrix multiplication.

2.3.5 composite Transformation

Complex transformations are often encountered in actual problems, but they can be combined by a series of basic transformations. The following is an example. Example 1: Rotation Transformation around any point c = [CX Cy. Figure 2.28 The total transformation can be combined by three basic transformations. First, perform translation switching. The translation quantity is-cx and-cy, then rotate the θ angle around the origin, and finally perform the translation transformation with the translation quantity of Cx and Cy. Therefore, the homogeneous coordinates of any point P after successive transformation are

A transformation matrix is called a composite transformation matrix.

Example 2 proportional transformation from any point c = [CX Cy]

Composite with example 1 and its composite transform arrays. That is

According to the above calculation process, a simple proportional transformation requires three calculation steps. The first translation can be seen as moving the substitution object to the origin of the coordinate system, and the second translation can be seen as moving the substitution object back to the original position.

Example 3 symmetric transformation relative to the straight line AX + by + c = 0

This example can be composed of five basic transformations. The composite transformation matrix can be calculated as follows:

 

 

 

2.3.6 3D Transformation

For the point P = [x y z] in three-dimensional space, the normalized homogeneous coordinates are similar to the two-dimensional conditions. The transformation matrices of the translation switching and proportional transformation are:

TX, Ty, TZ are the translation quantities in the X, Y, and Z directions. S11, s22, and s33 are the proportional factors relative to the origin in the X, Y, and Z directions. The three-dimensional rotation and transformation are slightly complicated. The right-hand coordinate system is used. From the point of view of the square direction of the specified coordinate axis to the origin point, the clockwise direction is positive and the clockwise direction is negative. The conversion matrices that rotate θ angles around the Z axis, X axis, and Y axis are:

Mathematical Proof: The 3x3 sub-matrix composed of the first three rows and the first three columns in the rotation transformation is a orthogonal matrix, that is, the vectors of the three columns (rows) are units vectors and are orthogonal to each other, after the Rotation Transformation, the three column vectors overlap with the X axis, Y axis, and Z axis respectively. Using this property, it is sometimes easy to determine the Rotation Transformation Matrix.

Like 2D transformations, 3D ry transformations are also composite transformations composed of a series of basic transformations. Pay attention to the order of transformation matrices during the transformation process. Although some transformation matrices are irrelevant to their order, we recommend that you perform matrix operations in sequence from the perspective of programming and computing. The role of most elements in the three-dimensional transformation matrix has been understood by the reader, but what is the role of the elements in the last column of the Matrix in the transformation? This will be answered in the perspective transformation section.

2.3.7 three-dimensional perspective transformation

The 3x1 sub-matrix composed of the fourth column of the three-dimensional homogeneous geometric transformation matrix is related to perspective switching. The elements are called perspective parameters. Perspective transformation to any point in space

In the preceding formula, the denominator px + Qy + rz + L is a variable. Therefore, after the perspective conversion, the image is deformed. How do P, Q, and r parameters generate perspective transformations for the image? To simplify the problem, set p = 0 and q = 0 first, then the transformation matrix then transforms the space point

In the preceding formula, when z = 0, x = x, y = y indicates that the plane Z = 0 is the non-changing plane in the transformation, that is, after the transformation, the X and Y values do not change. When Z → AC, Z → L/R indicates that an infinitely distant point corresponds to a finite point after perspective transformation, that is, after the linear transformation of the parallel Z axis, it is sent to a point 1/R on the Z axis. When Z → L/R, z→∞ indicates that the finite-L/R point corresponds to the infinite-point after the perspective transformation. The original-L/R Line Transformation on the axis is parallel to the Z axis. When r> 0, the geometric meaning of this transformation is 2.31. Likewise, it can be inferred that when R is less than 0 and P is less than 0, there is also a finite point X = L/P on the X axis that corresponds to the point X = ∞. In this case, after the geometric meaning of perspective switching in perspective chart 2.31 is changed, the straight lines parallel to the Z axis are merged to a point 1/R on the Z axis, A straight line parallel to the X axis is routed to point 1/P on the X axis. If the pivoting parameters P, Q, and R are not equal to zero, the pivoting transformation is performed. Points at x = ∞, y = ∞, and z = ∞ are mapped to X = L/P, y = L/Q, and z = 1/R respectively. At this time, after the straight lines parallel to the three coordinate axes are transformed, they are respectively transferred to a fixed point on the X, Y, and Z axes.

2.3.8 3D transformation Application

1) multi-faceted view

In engineering drawing, a three-dimensional multi-faceted view is projected onto the projection surface using the positive projection method, then, multiple projection planes and the obtained projection graphs are flattened on the same plane according to certain rules to obtain a three-dimensional multi-faceted view. If this projection process is represented by a matrix, it means to make a positive projection to the projection plane, and then rotate the projection plane around the corresponding coordinate axis, then, the image is moved along the projection axis to maintain a certain distance between views. The three steps can be represented by matrices respectively, and the final result is obtained after the three matrices are cascade. In order to derive the transform matrix of three views, the X-Y plane is used as the front projection plane (that is, the V plane), and the main view is drawn on the projection plane. (1) main view: When the three-dimensional projection is positive to the XY plane, the XY plane remains unchanged when the projection plane is expanded. Therefore, the X and Y coordinates remain unchanged, while the zcoordinate is zero. Therefore, the transformation matrix of the main view is

(2) Top view: the top view is a projection to the xz plane (that is, the H plane), and then the xz plane along with the obtained projection is directly transferred out of the Y angle around the X axis, so that it is coincident with the x y plane, and the view obtained from a distance is reversed along the Y axis. At this time, the X and Y coordinates remain unchanged, and Y = 0. Therefore, the transformation matrix of the top view is

(3) lateral view: the lateral view is first projected to the Y-Z plane (W plane), so that the Y and Z coordinates remain unchanged, x = 0, and then the Y axis is converted to 90 angles, Which is coincident with the XY plane, and the view is translated along the X axis, so the transformation matrix of the top view is

The three-dimensional three views can also be obtained, that is, the three-dimensional projection to the XY plane to obtain the main view. In order to get the top view, you can first turn the stereo around the X axis to 90 degrees, then project to the XY side, and then pan along the X axis to obtain the side view. This transformation is the same as the above transformation.

 

Address: http://www.cnblogs.com/Clingingboy/archive/2010/10/17/1853559.html

 

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.