.nh .po 3 .ce TEST 1 - CS528 .nf Instructor Dr P Juell NAME_______________________ OPEN BOOK March 30, 1990 100 points .fi 1. (30) One way to draw curves is to approximate them with straight lines. Contrast the following routine with the Bresenham circle routine. (The bres_line routine is the Bresenham line algorithm in the book extended for all slopes). .nf .in +2 procedure inter_circle(x_center,wy_center, radius: integer); var x_old, y_old, step, x, y : integer; procedure plot_circle_points(var x_old, y_old:integer; x, y: integer); procedure plot_line(x1, y1, x2, y2 :integer); begin bres_line(x1+x_center, y1+y_center, x2+x_center, y2+y_center); end; begin plot_line( x_old, y_old, x, y); plot_line( x_old,-y_old, x, -y); plot_line(-x_old,-y_old, -x, -y); plot_line(-x_old, y_old, -x, y); x_old := x; y_old := y; end; end; begin x_old := 0; y_old := r; for step = 1 to 10 do begin x := ( r * step) div 10; y := trunc(sqrt( r*r - x*x ) ); plot_circle_points( x_old, y_old, x, y); end; end; .in -2 .fi 2. (10) You are reading the specification for a CRT. The specifications say it is a black and white display. The frame buffer has 2 bits per pixel with lookup table entries of 8 bits. What does this tell you about the display. 3. (20) Show a line that incloses an area. Identify inside and the result of antialiasing area. Also show the pixel subdivisions. Correctly label one pixel for each of the values: 0%, 25%, 50%, 75% and 100%. 4. (20) Write the statements (not a full program) to produce the following image. Use the GKS functions given up to now in the book. __________ | | | *-----*| | | NOW || | | || | |_____|| |________| 5. (20) Write a routine that the book's fill_area_solid routine can use to provide a patterned fill. Your routine is to be used instead of the point plot command. The pattern will be in the variable pat. Its values are preset for you. var pat: array[1..4,1..4] of boolean;