In C, I'm writing a program in which I need to draw some 3d

representations of rectangles. Initially, I've been just throwing

wireframes down, but it has occured to me that after a certain

number of these, the drawing becomes to complex to pick out the

individual rectangles... (In fact they're constructing rectangular

prisms). They are rectangles of varying size, and are all parallel

to one of the xy,xz,yz planes.

So I've decided to fill the rectangles, so that you can't see the ones

behind it. So I thought I'd just sort them by depth and draw them

in order, rather than try to draw only visible sections, and so forth.

So my question:

What's a good way to determine if a rectangle is overlapping another,

and which one is closer? I don't expect these to be too complicated,

but I need some way to determine the order in which I should draw

the rectangles.

----------------------------------------------- James W. Clark