Assignment 2

Assignment 2 is to produce a images like the ones below.It is due before class on Friday, February 7. Please hand in your PostScript files via email.

The first picture below shows the paths of ray coming from underwater to the air above. The second shows the paths of rays of red light reflecting inside a raindrop, and the one on the right shows what happens if these same rays pass through. Doing this will involve using the basic commands discussed in the notes above, together with a small collection of special commands designed for the task. They are contained in the file lenses.inc, which you should download onto your machine. Then, at the beginning of your PostScript program you should include the line (lenses.inc) run, which will cause this file to be included in your program if your environment has been set up satisfactorily. This may involve fooling around with the options in your PostScript viewer. For one thing, you should click off the option SAFER in GSView.

The package of procedures in lenses.inc includes commands

  • Notes on the package lenses.inc
  • A start:


    Click on image to see the PostScript source.

    In order to understand exactly what this program does, you should read especially the section on the stack in the notes. In order to complete the drawing, you have to figure out what angle is the most extreme one visible from above the pool, the one that corresponds to a ray horizontal along the water surface. Use the law of refraction to figure this out with a calculator, say. We'll talk about all of these things on Monday.

    Then to begin on the other two figures. This will require that you import the file lenses.inc into your own file and use the routines defined there.

  • Class on Wednesday (Jan. 29), Friday (Jan. 31), Monday (Feb. 3). and Wednesday (Feb. 5) will be at the usual time, but in the Mathematics Computer Laboratory, Mathematics 202. The assignment is due on Friday, February 7.
  • To work with PostScript on your own computer, you will need to download GhostScript and GhostView as mentioned above. Also, you must toggle off the Safer option to run files.
  • As you work on these, you should ask yourself:
  • Solutions to Assignment #2