Traditional Culture Encyclopedia - Traditional virtues - 3D Shape: Matrix and Linear Transformation
3D Shape: Matrix and Linear Transformation
Rotation is a very common graphic transformation in daily development. Now we will explain the image transformation in 2D and 3D environments.
Suppose the object is now at the origin, such as the picture below.
Then the rotation angle of the object is θ = 3/π, and the rotation is often considered as positive counterclockwise and negative clockwise. So how does q change for the basis vector p? As shown in the figure below. I use drawing tools directly here. The picture is rough, please forgive me.
We can see the values of the rotated new vectors P 1 and Q 1 (of course, they are actually calculated according to trigonometric functions), and then we can construct the following general rotation matrix from these two values. Are we familiar with the following matrix? Is there an affine transformation? Don't worry, we'll take our time.
& lt/b & gt;
In the 3D environment, we no longer say that we rotate around a point, but around an axis. Although it rotates around an axis, it is necessary to define the positive and negative directions. The situation is different in the left and right coordinate systems. What? I don't know how to define the left and right coordinate system. Then look at the picture below.
So how do we judge the positive and negative directions in our coordinate system? For example, in the left-handed coordinate system, we need to use the left-handed rule to judge the positive and negative directions, while in the right-handed coordinate system, the opposite is true. Let's take the left-handed system as an example, and the schematic diagram of the rules is as follows. There is not much explanation for the left-handed rule. If you don't understand, please consult the physics related knowledge of senior high school by yourself. )
| Left-handed coordinate system |
|: - :|: - :|: - :|
| Look where | Positive direction | Negative direction |
| Looking at the positive end point from the negative end point of the shaft | counterclockwise | clockwise |
| Looking from the positive end point of the shaft to the negative end point | clockwise | counterclockwise |
We have understood the direction of rotation above. Next, let's look at three special cases, which rotate around the x, y, z, y and z axes respectively.
Let's look at the change of the basis vector. First, because the basis vectors P, Q and R in 3D all rotate around the X axis, it is said that the basis vector P has not changed at all, only the two basis vectors Q and R have changed. Suppose the rotation angle θ = 3/π, as shown in the figure below.
Then, if we pass through the 2D formulas of trigonometric functions, we can get the following rotation transformation matrix.
Then around the Y axis and the Z axis, it's similar, so I won't make a diagram, and I'll just go to the formula.
So after reading three special rotation methods, let's take a look at the rotation around any axis in 3 D.
As shown in the figure, if the vector V (pink) rotates around the axis N to get the vector V' (pink), it is difficult for us to observe it directly.
But if we decompose the vector v and the vector v', and then put the rotating θ on a plane to solve it, our rotation problem will be transformed into a simple 2D problem, as shown in the following figure.
I'll explain each vector here,
Where n is the projection of V on the rotation axis (assuming that the rotation axis is n', then n = n' (V n');
V is the vector before rotation;
V' is the rotated vector;
P is the component of v perpendicular to n (P' is the same);
ω is a vector perpendicular to n and p, and its length is equal to p.
We have basically explained the above vectors, and now we know that the conditions are vector v, rotation axis n' and rotation angle θ, and vector v' is to be calculated. )
The whole idea is that we can use vector n and vector p' to represent vector v', v' = n+p ';; Then n = n' (v n') and p' =ωsinθ+ncosθ. These three vector expressions are used to represent decomposition. The calculation process is as follows. (Note: Due to time, I wrote the calculation process directly on paper. Sao Dong's words were "I practiced dog days in summer and three-nine in winter, but I still lost. )
First, we analyze p'=ωsinθ+pcosθ, and the steps are as follows.
Above we have calculated p' and then brought it into v' = n+p', and the calculation is as follows.
Now that we have the transformation relationship, we will transform the three basis vectors, p, q and r. Let's take p = as an example. The rotation axis vector n' =, r =, and the specific calculation process is as follows.
Similarly, the basis vector q is similar, and the results are as follows.
Then, the scale matrix of 2D is as follows.
3D is not derived from the same principle. The scaling matrix results in 3D are as follows.
Generally speaking, projection is dimensionality reduction. This blog mainly studies orthogonal projection. Perspective projection will be reflected in later blogs, but I still want to use those two pictures to illustrate the difference between orthographic projection and perspective projection. Simply put, the origin of orthographic projection and the straight line of projection point are parallel, but all projection lines of perspective projection will intersect at one point, as shown below.
Next, we will directly look at the orthogonal projection matrix in 2D and 3D environments.
& lt/b & gt;
Of course, we can also project onto any straight line or plane, and the straight line or plane must pass through the origin. Then we use the scaled result to get the following result.
Mirror image is a transformation, and its function is to "fold" according to a straight line or plane, as shown in the figure.
Both mirror image and projection can be transformed by scaling matrix, and we only need to set the scaling factor of the scaling matrix to-1, so the mirror image matrix along any axis in 2D and 3D cases is as follows.
Shear is a kind of "distorted" transformation of coordinate system. If the stretching is uneven, the angle will change during the shearing process, but the area (2D) or volume (3D) will not change.
The specific interpretation is as follows.
So what is the form of cutting in 3D environment? As shown below.
Of course, cutting is not commonly used.
After two or three days of writing and learning, I finally completed the linear transformation of rotation, scaling, projection, mirror image and cutting. Learning 3D graphics requires a notebook and a pen, which can only be mastered by constant calculus. If you like Sao Dong, please stay tuned. In the next article, I will learn and sort out other knowledge of matrix and related knowledge of homogeneous matrix.
Finally, you should attach a: & gtPdf version of the portal to end the knowledge of linear transformation.
- Related articles
- Classification and introduction of wind instruments
- My family in Tangshan rural. Want to do some small business what project recommended, direct sales agent or something okay 。。。。 Recommended
- What is the storage performance of coatings?
- Attach great importance to family. Family-centered zodiac girl?
- What are the famous wines in Anhui?
- Distribution of Traditional Commodities in Tongzhou District
- wedding dress
- What is the general price of excimer laser surgery? What is the approximate price?
- I want to know the details of all the members of SJ and Henry's profile.
- Are bowls made in Chen Shenglong worth collecting during the Republic of China?