2.1 Coordinate systems



2-D and 3-D Coordinate Systems

The coordinate system most frequently used in geometric modeling and computer graphics is the three-dimensional coordinate system (3D). 3D stands for three-dimensional, as opposed to 2D, or two-dimensional. Two-dimensional objects are always flat because they have only two dimensions: width and height. Three-dimensional objects are defined in a 3D coordinate space and have dimensions of width, height and depth.

In the 2D Cartesian plane a point is located by its x- and y-coordinates. But when we move to 3D there are two choices for positioning the third z -axis.

2.1 Coordinate systems



Figure 2.1: (a) A left-handed system. (b) A right-handed system

Figure 2.1 shows the two possibilities, which are described as left- and right handed axial systems. The choice between these axial systems is arbitrary, but one should be aware of the system employed by commercial computer graphics packages. For example, OpenGL uses a right-handed system (the positive z axis points out of the screen).


2.1 Coordinate systems



Fig. 2.2 shows the coordinates of a point P represented as a right-handed system, which is most often used in graphics, i.e., the thumb of the right hand points down the z-axis if we imagine grabbing the z-axis with the fingers of the right hand curling from the positive x-axis toward the positive y-axis.

Figure 2.2: A right-handed axial system showing the coordinates of a point P.


2.1 Coordinate systems



Homogeneous Coordinate Systems

Many graphics applications involve sequences of geometric transformation.

Homogeneous coordinates allows us to represent all geometric transformation equations as matrix multiplications, which is the standard method used in graphics system. It is suggested that homogeneous coordinates could be used to implement the most commonly required transformations and projections.

This is accomplished by representing each two-dimensional coordinate–position representation (x,y) to a three-element representation (xh,yh,h), called homogeneous coordinates, where the homogeneous parameter h is a non-zero value such that: x= xh/h, y=yh/h. A convenient choice is simply to set h=1.

The use of homogeneous coordinates is one of the hallmarks of computer graphics, as it both helps to keep straight the distinction between points and vectors and provides a compact notation when one works with affine transformations as we will see in chapter 6.

As we will see in chapter 3, OpenGL uses 4D homogeneous coordinates for all its vertices. If you send it a triple in the form (x,y,z), it converts it immediately to (x,y,z,1).

2.1 Coordinate systems



Display Coordinate Systems

Most 3D computer graphics systems use a variety of both 2D and 3D coordinate systems. In general, several different Cartesian reference frames are used in the process of constructing and displaying a scene.

First, we can define the shapes of individual objects within a separate coordinate reference frame for each object. These reference frames are called modeling coordinates, or sometimes local coordinates, or master coordinates. Once the individual object shapes have been specified, we can construct (model) a scene by placing the objects into appropriate locations within a scene reference frame called world coordinates. This step involves the transformation of the individual modeling-coordinate frames to specified positions and orientations within the world-coordinate frame. As an example, we could construct a bicycle by defining each of its parts (wheels, seat, frame, handle bars, gears, chain, and pedals) in separate modeling-coordinate frame. Then the component parts are fitted together in world coordinate.

After all parts of a scene have been specified, the overall world-coordinate description is processed through various routines onto one or more output-device reference frames for display. This process is called the viewing pipeline. World-coordinate positions are first converted to viewing coordinates corresponding to the view we want of a scene, based on the position and orientation of a hypothetical camera.

2.1 Coordinate systems



Then object locations are transformed to a two-dimensional projection of the scene, which corresponds to what we will see on the output device. The scene is then stored in normalized coordinates, where each coordinate value is in the range from -1 to 1 or in the range from 0 to 1, depending on the system. Normalized coordinates are also referred to as normalized device coordinates, since using this representation makes a graphics package independent of the coordinate range for any specific output device.

We also need to identify visible surfaces and eliminate picture parts outside the bounds for the view we want to show on the display device. The coordinate systems for the display devices are generally called device coordinates, or screen coordinates in the case of a video monitor. Be notice that left-handed system is used when dealing with viewing and cameras. Often, both normalized device coordinates and screen coordinates are specified in a left-handed system so that increasing positive distances from the xy plane (the scree, or viewing plane) can be interpreted as being farther from the viewing position.

2.1 Coordinate systems



Figure 2.3 briefly illustrates the sequence of coordinate transformations from modeling-coordinates to device coordinates for a display that is to contain a view of two three-dimensional objects.

Figure 2.3: The transformation sequence from modeling coordinates to device coordinates for a 3D scene

2.1 Coordinate systems




2.1 Coordinate systems




2.1 Coordinate systems




2.1 Coordinate systems




2.1 Coordinate systems




2.1 Coordinate systems




2.1 Coordinate systems




2.1 Coordinate systems