18.8 Assignments

Questions

1. What is meant by the term "screen resolution"?

2. Who was RenÚ Descartes, and what were some of major contributions to mathematics?

3. What procedure of the API is employed in (a) MacOS and (b) Windows NT to determine the current size of a window?

4. What is a pixel?

5. Why do you suppose that no graphics module was standardized by the ISO committee?

6. Give a detailed explanation of the three kinds of coordinate systems used in this chapter.

7. Give a detailed explanation of the three kinds of angle measurement units.

8. What is a fractal?

9. Look up a typical turtlegraphics module and discuss how it differs from GraphPaper. Write a definition module for Turtlegraphics.

10. The moire pattern in figure 18.12 is just made with straight lines. Yet, the result does not have lines right across the figure in most instances. Why not?

11. Look up a MacOS programming reference and thoroughly comment everything in the MacOS versions of GraphWindow, explaining what every import is and what it does. Be sure to detail the Window record type.

12. Look up a Windows NT programming reference and thoroughly comment everything in the NT version of GraphWindow, explaining what every import is and what it does.

13. Detail the differences between the style of event-based programming in MacOS and in Windows.

Problems

14. Produce a module ComplexPlane that graphs points in a complex plane. It will take arguments that are complex numbers, not ordered pairs (x, y). As this is drawing complex numbers as points, the contents are likely to have little relationship with those of GraphPaper. Be sure to get your design approved by your instructor before implementation.

15. Implement a turtlegraphics module as you described in question 9.

16. Write and test a module to graph functions. It should be able to read from the keyboard and parse such expressions as y = 3x^5 + 4x^-2 + sin(x) + 1/x + ln(x), where the "^" symbol is taken to mean "to the power of." That is, it should correctly evaluate polynomial expressions, reciprocal, negative exponents, and the names of the functions in RealMath, and then graph them over some user-specified range of values.

17. Look up (in a calculus book) how to draw such figures as the rose, limašon, and lemniscate in polar coordinates. Construct and test a module to read formulas in polar form in terms of r and . (similar to the previous module in Cartesian form) , parse such formulas, and graph them.

18. Parametric equations are given in the form x = f (t); y = g (t), where t is another variable, called a parameter, and s equation forms are called parametric equations. Construct and test a module to read from the keyboard functions in parametric form and graph them, as in the last two questions.

19. Write a module that graphically illustrates the results of adding two dimensional vectors.

20. The module TestGraph in section 18.3 did not completely test all aspects of GraphPaper. Extend it so that it does test everything.

21. Look up at least two more fractals and write code to construct them.

22. Look up Hilbert's space filling curve and write a module to produce it.

23. Sierpinski's curve in section 18.4.3 was based on a rectangle. Write a module to make the analogous figure bases on five sides.

24. Write a module to draw a table and four chairs around it.

25. Produce a piece of string art of your own design. Perhaps you can make the bounding figure something other than a rectangle.

26. Add to GraphPaper the ability to clear the screen from one graph and start over.

27. Write a module to draw pie charts and/or bar graphs. The data could be read from a file.

28. Port SillyBalls to WindowsNT. Detail all the changes you have to make.

29. Implement the module Keyboard for Windows NT.

30. If you have a Windows 32-bit compiler other than StonyBrook, port the GraphWindow and GraphPaper modules to it.

Projects

31. Add to GraphPaper the ability to save and load graphics files in some standard format (such as PICT or TIFF.)

32. Add to the MacOS version of GraphWindow the ability to switch to another application, switch back and get the window redrawn.

33. Write a module to graphically illustrate the results of a tree traversal as it is taking place.

34. Write a module to graphically illustrate the contents of a heap in tree form as it is being sorted.


Contents