EXERCISES FOR WEEK 3
week3-1 Suppose your real world window frame is given by Frame.Left, Frame.Right, Frame.Bottom, and Frame.Top and the values for width and height of the screen window are given by ScreenWindow.Width and ScreenWindow.Height.   If the default viewport is used (the frame is mapped to the entire window), what is the real value (in terms of the real frame setting) for the pixel values (x,y) returned by the mouse click.  In other words, to what point in your real window on your graph paper does the mouse click correspond? 

 

week3-2 Test your answer to exercise 1 with this case:

The lower left corner of your real frame is (-5.0, -10.0) and the upper right corner of your real frame is (10.0, 15.0).  The screen window width is 400 pixels and the screen window height is 500 pixels.  The x and y values returned by the mouse click are (200, 300).  What is the corresponding (x,y) point in the real window?

 

week3-3

Regarding exercise 2, what will be the coordinates of the viewport within the screen window if we choose a viewport that preserves the aspect ratio of the real frame and is centered within the screen window?

Test your answer to exercise 3 by choosing this viewport with the window and mouse info given in the test case in exercise 2.

 

week3-4

Do practice exercise 3.3.1 on page 109 of the Hill textbook (Line Clipping Algorithm). Check your solutions in the back of the book.

 

 

week3-5

See Hill, top of page 120. Show that the parametric representation of a parabola, given by

x(t) = at2;
y(t) = 2at;

is consistent with the implicit form given by:     y2 - 4ax = 0
week3-6

What points will be plotted for the parabola given in the previous exercise if t has the values listed in the table? Assume the value of a is 1. Sketch the curve.

t
x
y
0.0
   
0.5
   
1.0
   
-1.0
   
-0.2
   

 

week3-7

Suppose you want to plot n sample points on a parametric curve. This means that you want t to take on n values between the first value and the last value, inclusive. If the first value for t is 0 and the last value for t is 1, what are the intermediate values for t if n is ....

n
values of t
3
0, 1/2, 1
4
0, 1/3, 2/3, 1
5
      
11
      
n
      

 

week3-8

Find the x and y coordinates for the 11 points on the line segment from A to B, using the parametric equations. A = (2, -12) and B = (20, 18). (Round decimal answers to nearest hundredth.)

t
P.x
P.y
0.0
   
0.1
   
0.2
   
0.3
   
0.4
   
0.5
   
0.6
   
0.7
   
0.8
   
0.9
   
1.0
   

 

week3-9

Write a program to draw the parametric Rose Curve, given by the function f(Ø) = K cos (nØ), where n specifies the number of petals in the rose. Try it out for several different values. If you get really ambitious, this could be a menu option.

What are the beginning and ending values for Ø?

week3-10

Do Example 4.5.2 on page 160 of the Hill book. For the points A(4,9) and B(3,7), Find the following points "in-between" A and B, for the values given for t:

t
x
y
0.0
   
  
0.2
   
   
0.4
   
   
0.6
   
   
0.8
   
   
1.0
   
   

Plot the points on graph paper.