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:
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:
for (int y = 0 ; y < W ; y++) for (int x = 0 ; x < H ; x++) { ... }where W = bounds().width and where H = bounds().height.