| EXERCISES FOR WEEK
3 |
| week3-1 | Write a function to set the viewport in terms of percentage of a normalized rectangle. A normalized rectangle has real coordinates that go from (0.0, 0.0) in the lower left corner to (1.0, 1.0) in the upper right corner. So for example, if you wanted to set the viewport to the lower left quadrant of the screen window, you would use the call setVP(0.0, 0.0, 0.5, 0.5). This would result in the lower left corner of the viewport set to (0.0, 0.0) and the upper right corner of the viewport set to (0.5, 0.5). If the screen window had been set to 800 by 600, then the viewport would be 400 by 300 and would be anchored in the lower left; if the window had been set to 500 by 500, the the viewport would be 250 by 250; if the window had been set to 100 by 700, then the viewport would be 50 by 350. If you set the viewport to lower left corner (1/3, 1/3) and the upper right corner to be (2/3, 2,3), the the viewport would be the center of the window. (Imagine tic-tac-toe board; would be the center portion.) If the corresponding window had been set to 600 by 300, then the viewport would be 200 pixels wide, 100 pixels tall, and have lower left at pixel (200, 100).
|
|||||||||||||||||||||||||||||||||||||
| week3-2 | 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-3 | See Hill, top of page 120. Show that the parametric representation of a parabola, given by is consistent with the implicit form given by: y2 - 4ax = 0 | |||||||||||||||||||||||||||||||||||||
| week3-4 |
| |||||||||||||||||||||||||||||||||||||
| week3-5 |
| |||||||||||||||||||||||||||||||||||||
| week3-6 |
| |||||||||||||||||||||||||||||||||||||
| week3-7 | 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-8 |
|