Write a Java applet that implements a simple ray tracer to a flying saucer shape. In this homework you should take the routine you wrote for ray tracing to a flying saucer. If you recall, a flying saucer was formed by the intersection of two spheres. Apply the routine you wrote, pixel by pixel, to render an image of a flying saucer.

You will not yet need to create shading for the flying saucer. You will be doing that in a later assignment. Instead, for this assignment, you should assign a color to each pixel of:

*White*if the ray hits the part of the flying saucer that is on the first sphere*Gray*if the ray hits the part of the flying saucer that is on the second sphere*Black*if the ray misses the flying saucer entirely

You can paint a single pixel a color (eg: gray) by doing (for example):

g.setColor(Color.gray); g.drawRect(x, y, 1, 1);

Here are some suggestions for how you might implement this:

- Create a doubly nested loop that loops over pixels, such as:
for (int y = 0 ; y < W ; y++) for (int x = 0 ; x < H ; x++) { ... }

where W = bounds().width and where H = bounds().height. - Inside this loop, construct a ray that starts at point
**v**= (0,0,0) and travels in the direction**w**= (x/W - ½,y/H - ½, -f) where*f*is the ``focal length'' for your virtual camera (you can try different values for*f*until you get one that looks reasonable). - At each pixel, intersect the ray (
**v**,**w**) with your flying saucer, using your code from homework 2.