Computer Graphics - Coordinate System (Coordinate Summary)

     It is recommended to buy the fourth edition of "Computer Graphics" 

1 coordinate system

1.1 Before we talk about coordinate transformations, we must make a formal definition of our coordinate system. The default coordinate system used by DirectX is left-handed . The default coordinate system used by OpenGL is the right-handed coordinate system .

We can make a simple judgment on the coordinate system by using the hand.

       In a left-handed coordinate system, your thumb will point in the positive direction of the X axis (pointing to the right), your index finger will point in the positive direction of the Y axis (up), and your middle finger will point in the positive direction of the Z axis (away from you).

      In a right-handed coordinate system, your thumb will point in the positive direction of the X-axis (to the right), and your index finger will point in the positive direction of the Y-axis (up), but unlike a left-handed coordinate system, your middle finger will point to the Z-axis The positive direction, but this direction is not away from you, but to yourself.

left handed coordinates right hand

Another important theory related to the coordinate system is that the rotation direction of each coordinate system is different.

The following table shows the rotation directions for positive and negative rotations for left-handed and right-handed coordinate systems.

left-handed coordinate system Right-handed coordinate system
view directions Forward direction of rotation Negative direction of rotation Forward direction of rotation Negative direction of rotation
Looking at the positive direction from the negative direction of the coordinate axis (for example, looking from -1 to +1) counterclockwise clockwise clockwise counterclockwise
Looking at the negative direction from the positive direction of the coordinate axis (for example, looking from +1 to -1) clockwise counterclockwise counterclockwise clockwise

2 Cartesian coordinate system

The Cartesian coordinate system is the collective name of the Cartesian coordinate system and the oblique coordinate system.

   2.1 Cartesian coordinate system

A two-dimensional Cartesian coordinate system is usually defined by two mutually perpendicular coordinate axes, usually referred to as the x-axis and the y-axis, respectively. The intersection point of the two coordinate axes is called the origin, usually marked as O, which means zero and is the first letter of Origin in English. Each axis points in a specific direction. The coordinate axes of these two different lines determine a plane called the xy-plane, also known as the Cartesian plane.

The coordinates of the four points in the figure are, green point: (2,3)(2, 3)(2,3), red point: (−3,1)(-3, 1)(−3,1), Blue points: (−1.5,−2.5)(-1.5, -2.5)(−1.5,−2.5), purple points: (0,0)(0, 0)(0,0).

In order to know the distance of any point on the coordinate axis from the origin. We can plot values ​​on the axes. Then, start from the origin, go to the direction pointed by the coordinate axis, and describe the value on the coordinate axis every other unit length. This value is the number of plots, and it is also a positive integer distance from the origin; similarly, we can also plot a negative integer distance from the origin against the direction pointed by the coordinate axis. The value depicted on the x-axis is called the x-coordinate, also known as the abscissa, and the value depicted on the y-axis is called the y-coordinate, also known as the ordinate.

Here, both coordinates are integers, corresponding to axis-specific points. According to the scale, we can generalize to each point of the real number coordinates and its corresponding coordinate axis. These two coordinates are the Cartesian coordinates of the Cartesian coordinate system, denoted as (x,y)(x,y)(x,y).

The position of any point P on the plane can be expressed by Cartesian coordinates. Just draw a line perpendicular to the x-axis from point P. From the point of intersection of this line with the x-axis, the x-coordinate of point P can be found. Likewise, the y-coordinate of point P can be found. In this way, we can get the Cartesian coordinates of point P.

2.2. Oblique coordinate system

Two number axes that are perpendicular to each other and have a common origin form a plane Cartesian coordinate system , and if the two coordinate axes in the coordinate system are not perpendicular, then such a coordinate system is called an " oblique coordinate system ".

In addition to the Cartesian coordinate system, there are some other coordinate systems:

2.3. World coordinate system: All coordinate systems can be transformed into the world coordinate system

2.4. Object coordinate system

Usually in 3D development or drawing, a coordinate system is set for the drawn object itself, so that no matter where the object is, it is relative to its own object coordinate system.

2.5 Inertial coordinate system

It is an intermediate coordinate system between the world coordinate system and the object coordinate system. Each axis (x axis, y axis, z axis) of the coordinate system is parallel to the world coordinate system.

        It is said that one day, the French philosopher and mathematician Descartes fell ill and was seriously ill in bed. Even so, he pondered over a question: geometric figures are intuitive, while algebraic equations are relatively abstract. Can geometric figures and algebraic equations be combined? Combined, that is to say, can we use geometric figures to represent equations? To achieve this goal, the key is how to link the points that make up the geometric figure with each set of "numbers" that satisfy the equation. "Connect. Suddenly, he saw a spider on the corner of the roof, hanging down with a thread. After a while, the spider climbed up the thread again, and pulled the thread from side to side. The "performance" of the spider made Descartes' thinking suddenly clear. He thought, the spider can be regarded as a point, it can move up, down, left and right in the room, can each position of the spider be determined by a set of numbers ? He also thought that the two adjacent walls in the room and the ground have handed over three lines. If the corner of the wall on the ground is used as the starting point, and the three handed over lines are used as the three number axes, then the position of any point in space can use these three lines. Find three numbers in order on the number line. Conversely, a point P can be found in the space corresponding to any set of three sequential numbers. In the same way, a set of numbers (x, y) can be used to represent a point on the plane, and a point on the plane. Points can also be represented by a set of two sequential numbers, which is the prototype of the coordinate system.

3 Coordinate systems in computer graphics

1. Modeling coordinate system (MC)

  The modeling coordinate system is a local coordinate system, and it can also be a typical planar Cartesian coordinate system. Its appearance is mainly for the convenience of model construction and transformation. Generally speaking, we are always used to think about the basic shape or figure and some corner points, center points or points close to them on the object. For example, when creating a circle, the center of the circle is generally used as a reference point to Create other points on the circle, and then essentially build a reference coordinate system with the center of the circle as the origin. When transforming a circle, similarly, it is more intuitive and convenient to use the center of the circle as the reference point for transformation.

2. World coordinate system (WC)

  Once the objects are modeled, the next step is to place the individual objects or groups of shapes into the flat scene we wish to draw. As mentioned above, each object has its own modeling coordinate system when it is created. When we put them together, in order to determine the position of each object and the relative position of other objects, we must discard each object itself The coordinate system is incorporated into a unified coordinate system. This coordinate system is called the world coordinate system, also known as the user coordinate system. It is a global coordinate system and a typical plane Cartesian coordinate system. This process is essentially a transformation process of assembling an object from local space to world space.

3. Observe the coordinate system (VC)

        After the two-dimensional graphics scene is determined, the user can define the observation area and direction according to the requirements of the graphics display to obtain the desired display results. Objects in the entire world coordinate system are repositioned and described, which simplifies the derivation and calculation of subsequent two-dimensional graphics imaging on the projection surface. Therefore, it is necessary to introduce an observation coordinate system to accomplish this. The following figure is a schematic diagram of the observation coordinate system:

  Figure 1: Viewing coordinate system

 4. Normalized Device Coordinate System (NDC)

        To make viewing processing independent of the output device, we can transform the object description into an intermediate coordinate system that is both device independent and easily transformable into the device coordinate system. This intermediate coordinate system is usually called a normalized device coordinate system, and its coordinate range is [0,1], which can make the two-dimensional observation results independent of various output and display devices that may be used, and improve the portability and Device independence.

5. Device coordinate system (DC)

        In order to facilitate the output of two-dimensional observation results, DC is used to define the image space, also known as the screen coordinate system or pixel coordinate system. It is mainly used to define the pixels on the surface of a special computer graphics display device. In most cases, there is a separate coordinate system for each specific display device. Once a display window is defined, a finite area called the viewport can be further defined in the device coordinate system. The imaging of the viewport is what is actually observed. The device coordinate system is generally associated with a specific output device, and its coordinate system is a discrete integer value.

   In order to facilitate the understanding of the above concepts, here are a few diagrams:

 

Figure 2: Coordinate system conversion process

Figure 3: Schematic diagram of coordinate system conversion process

Guess you like

Origin blog.csdn.net/zhanglixin999/article/details/131309520