Mathematical regulations:
Because of the different habits, each person has different standards for the same thing.
Some "habits" of the whole project should be stipulated in advance, and they should be resolutely implemented and unified.
World coordinate system:
All objects in the scene are in the world coordinate system, and all coordinate systems are left-handed coordinate systems. The orientation of the three axes of the left-hand coordinate system is as follows:
Based on the screen, the coordinate system X axis points to the right, the Y axis points upward, and the Z axis points to the inside of the screen.
With this coordinate system we can create a world space. Of course, it has not really been created. It is just an agreement for future use. Just like the latitude and longitude of the earth, with this we can describe what is in what place.
Object coordinate system:
There are many objects in the world, such as models in games, players, and so on.
Every object in the world contains three pieces of data:
1) The center of the object is in the world position (x, y, z)
2) The angle at which the object is rotated (Pitch, Yaw, Roll). Corresponding to the angle of rotation about the xyz axis, respectively, and specifying that the clockwise direction viewed from the negative direction of each axis is positive. For example, (0,0,90) means that the object does not rotate along the xy axis, only rotates 90 degrees along the z-axis, and the direction of rotation is clockwise.
3) The position (xi, yi, zi) of all points constituting the object relative to the center of the object (i is the point constituting the object, such as the 8 vertices of the cube)
The basic idea of ​​rasterization
(assuming there is only one object in the world coordinate system, simplifying the description):
1) Zoom, rotate, and translate all points of the object according to their position and orientation in the world. This step will convert the coordinates of all points of the object from the object coordinate system to the world coordinate system.
For example, an object has only one point, which is at (1,0,0) relative to the center of the object, and the center of the object is at (0,1,0) of the world, and has not been rotated. Then, after the point is converted by the coordinates of scaling, rotation and translation, the position (1, 1, 0) of the point in the world coordinate system can be obtained.
2) Simplify the observers (people, players, cameras, etc.) in the world into a single point, like a camera, which is where the line of sight is observed. At the same time, the camera also has position information (x, y, z) and rotation angle information (pitch, yaw, roll). From these two sets of data we can find the position of the camera in the world coordinate system and the orientation of the line of sight.
But the action to be performed is exactly the opposite. We take all the points of the world (after the first step, the coordinate system of these points has been converted from their object coordinate system to the world coordinate system) to perform the inverse transformation of the above transformation, which can be obtained by camera. The coordinates of all points in the center. The world space after this step is called the observation space.
3) Turn the observation space to the homogeneous clipping space. The range of things that a camera (or human) sees in real life is limited. But all the points so far have been transformed regardless of whether the camera can't see it. So also convert all the points in the observation space to a space called a homogeneous clipping space. This space has an artificially defined range of length, width, and height, and the center of the cube's range is at the origin (0, 0, 0).
That is to say, the range of up, down, left, and right of this range is -1 to 1. After a special matrix multiplication transformation, all points in the 2x2x2 cube shape will be visible and will eventually be rendered. All points that are not in the 2x2x2 size range are out of sight and will not be rendered at the end. Pirate map:
On the left is the observation space, and at the origin is our camera (this coordinate system is not the left-hand coordinate system we use, this is the right-hand coordinate system, and its z-axis is facing the screen). On the right is the homogeneous clipping space formed after the third step of conversion.
All points have been converted to this homogeneous clipping space, and all points that are not enclosed within the cube are trimmed.
At this time, we can already take the x and y coordinates of each point and match them to the resolution of the display (that is, the value of the xy coordinate of each point is stretched from [-1, 1] to [0]. , 1920] and [0, 1080]), directly displayed. However, the results displayed will be strange, and the objects of different distances are the same. This projection process is called orthogonal projection, and the world that we see in everyday life is the result of perspective projection.
How to make a perspective projection? The general idea is to take the z coordinate of each point in the observation space, divided by the value of x and y (x = x/z, y = y/z) of the point in the homogeneous clipping space. It is displayed as a perspective image after projection.
Short summary:
To convert the points that make up the 3D world to the 2D plane of the display, you need to do the following for each point.
1) Object space is converted to world space (by several matrix multiplications)
2) World space is converted to observation space (requires inverse matrix of camera transformation)
3) The observation space is converted to the homogeneous clipping space (by multiplying the special transformation matrix)
4) Perform perspective division (divide by a specific z value)
But the above transformation just got the final location information. To display on the screen, you also need to fill the faces made up of points and lines, or even assign custom textures.
LED Lighting Cable:Form: socket, plug stamping injection molding, widely used for LED outdoor lighting waterproof plug, connector, power cord plug.
Product advantages: at present, LED outdoor waterproof male and female plug, waterproofing, waterproof power line, waterproof connection line, waterproof plug wire and so on have been widely used in society, mainly waterproof male and female plug, waterproofing, waterproof power line, waterproof plug wire, these products play the advantage of environmental protection and energy saving, and can play an anti ultraviolet, radiation protection, anti-oxidation, anti-aging in hot summer. Function, in the cold winter to play a moisture-proof, moisture-proof, cold-resistant effect, so at present this product has been through the national policy and has been strongly supported by the national policy.
Main markets: LED lighting industry, outdoor lighting industry, urban lighting engineering industry, driving power industry
LED Lighting Cable
ShenZhen Antenk Electronics Co,Ltd , https://www.antenksocket.com