Project 1: Computer Graphics 1 Introduction
Computer graphics are images displayed or animated on a computer screen. Applications of computer graphics are widespread and growing rapidly. For instance, computer-aided design is an integral part of many engineering processes. The entertainment industry has made the most spectacular use of computer graphics–from the special eﬀects in King Kong to the Nintendo Wii. Most interactive computer software for business and industry makes use of computer graphics including screen displays, desktop publishing, and slide production for commercial and education presentations. Consequently, most students studying a computer language spend some time learning how to use two-dimensional (2D) graphics, and maybe three dimensional (3D) graphics.
Transformations in 2D
We begin by examining some of the basic mathematics used to manipulate and display graphical images such as a letter of the alphabet. Such an image consists of a number of points, connected lines or curves, and information about how to ﬁll closed regions bounded by the lines and curves. Often, curved lines are approximated by short straight-line segments, and a ﬁgure is deﬁned mathematically by a list of points. The capital letter N can be determined by eight points, or vertices. The coordinates of the points can be stored in a data matrix D. In addition to D, it is necessary to specify which vertices are connected by lines, but we will omit this detail for now. The main reason graphical objects are described by a collection of straight-line segments is that the standard transformations in computer graphics map line segments onto other line segments. Once the vertices that describe an object have been transformed, their images can be connected with the appropriate straight lines to produce the compete image of the original object. 1. On graph paper, carefully draw the letter N. Construct a data matrix D containing the eight points or vertices from your drawing. Include in your report a picture of your letter N.
2. Given a matrix A =
1 .25 , describe the eﬀect of left multiplication by A on the letter 0 1 N. Include in your report a picture of the letter N after the transformation by A.
3. In the previous question, the N looks a bit too wide after the transformation by the matrix A. to compensate, multiply (on the left) the coordinates of the letter obtained in .75 0 the previous question by the matrix S = . Include a picture of this letter N 0 1 in your report and describe with a short sentence the eﬀect of left multiplication by the matrix S. There are three diﬀerent ways we can move an object to another location. The ﬁrst way is by translation. We can translate points in the xy-plane to a new position by adding translation amounts to the coordinates of the points. For example, we translate the point (x, y) by moving dx units parallel to the x-axis and by dy units parallel to the y-axis to the new point (x′, y ′). Then x′ = x + dx and y ′ = y + dy .
4. Translate your original letter N by 3 units to the right and 2 units up. Include a picture of the translated letter N in your report, and describe in a short sentence the eﬀect of this translation on the original letter N. Points can also be scaled (stretched) by sx along the x-axis and by sy along the y-axis into a new point by the multiplications x′ = sx · x and y ′ = sy · y. 5. Scale your original letter N by 1/2 in x and 1/4 in y. Now scale the original letter N by 2 in x and 4 in y. Include a printout of both scaled letters and describe in a short sentence the eﬀect of these transformations on the original letter N. 6. In the previous question, what matrices A and B would produce the eﬀects of the transformations on the letter N when the matrix D is multiplied on the left by A or B? Points can also be rotated through an angle θ about the origin. Let (x, y) denote a point in the plane that we wish to rotate through...