Currently, many people have mentioned computer graphics during the Silverlight interview. I didn't know it at the time. Although I passed the interview, I still want to get in touch with computer graphics.
Computer Graphics is a complex thing that involves all the knowledge of advanced mathematics: calculus, linear algebra, three-dimensional ry, probability, and some physical knowledge. So it is complicated. In fact, we don't need to make it very complicated, but we can understand it a little, for example, vector, color, light, and so on. Then we can learn about the coordinate calculation.
The Cartesian coordinate system is an Orthogonal Linear coordinate system. It is a mathematical concept and does not specify how to draw it.
In traditional teaching, the two-dimensional Cartesian coordinate system is often drawn as y up, X to the right, and the two axes into a right angle, which originated from the ancient architecture and the triangle surveying and painting method. The height of the building should be calculated from the ground up. You can imagine how unnatural y would be if it was down from the roof (so the coordinate system floated as the height of the room) or down from the ground (so the cellar coordinate was a positive number and the subject would be a negative number.
But this is not necessary. There is no relationship between how a top view is oriented. In fact, is the vertical direction of XY even though the vertical axis is neither x nor y?
When we look at elementary physics, we will find that we need to specify the reference system first, and often draw voltage-time, distance-acceleration images in the Cartesian coordinate system.
In space ry, you will see the 3D Cartesian coordinate system drawn in any direction. the X, Y, and Z axes can be specified in any direction, however, the direction of Z is generally x <B> x </B> Y <B> [NOTE 2] </B>. of course, this is for the convenience of the Cross-Multiplication operation.
Why does the computer use the Y-down coordinate system? This is also traditional: The CRT display scan method is from top to bottom by line <B> [NOTE 3] </B>, the first line is at the top, number of times. similarly, for ease of display, the rendering cache in the video card also arranges the screen, and most bitmap formats such as BMP and jpg are also the same. Another benefit is that it is the same as our reading habits. We know that early computers were mainly used to process text, and the text was arranged from top to bottom row on the display or in the memory. As you can imagine, if the Y axis is in turn up above, it will cause much trouble. Therefore, traditionally, this Y axis downward coordinate system is used in graphics.
In fact, as long as you use this coordinate system from start to end, there is nothing wrong with it. Remove the deep-rooted old coordinate system (in fact it does not exist ...)
All concepts of Silverlight are based on Y-down coordinate system. It works perfectly with math objects.
Of course, there is a difference between the Y axis and the downward direction. It means that the X operation (or the potential Z axis) is reversed, so the meaning of the so-called clockwise and counterclockwise is different: you should pay attention to this when using the positive and Inverse Calculation plane, or when performing vector operations to determine the upper and lower sides.