Chapter 6
Two-Dimensional Viewing
Exercises for this chapter deal with the two-dimensional viewing pipeline. This includes prob-
lems relating to display windows and viewports, transformations from world to viewing coordi-
nates, clipping procedures, and applications of the OpenGL two-dimension viewing functions.
Exercises
6-1. Matrix 6-1 is formed by first translating P
0
to the world coordinate origin, then rotating
the viewing-coordinate axes to align them with the world-coordinate axes. The elements
of the rotation matrix can be obtained from axis vector V using the methods described
in Section 6-2.
6-2. First set up the matrix for scaling the coordinates of the clipping window vertices, relative
to the window center position, so that the window is the same size as the viewport. Next,
premultiply the scaling matrix by a matrix that translates the coordinates of the window
center point to the viewport center point. Then express the elements of the composite
matrix in terms of the scaling and translation parameters in Eqs. 6-4 and 6-5.
6-3. Input to this procedure is the set of coordinates for the clipping-window vertices. The
elements of the transformation matrix are then calculated from a sequence of scale-rotate
operations, as in the preceding exercise. Any position on either the clipping window or
the normalized square can be used as the fixed point for the transformation sequence.
6-4. A circle and a few polygons, such as a triangle, rectangle, and hexagon, can each be defined
relative to the coordinate origin. For example, each polygon could be defined with its
centroid coordinates as (0, 0). Then a scene is constructed by positioning the objects
within a world-coordinate space. Viewing coordinates and a clipping window are defined
using the methods described in Section 6-2, and the normalized-square transformation is
given in Section 6-3.
A viewing table can be set up as a list of values for viewing-coordinate parameters P
0
and V (Section 5-8), along with the coordinate limits for the clipping window. Each set
of values can be referenced with a numerical index, such as the list position, and an input
37
评论5