3D Cohen-Sutherland Clipping Algorithm
I've been redirected here from the Sun forums. I'm a distance learner and am taking a module on Computer Graphics whereby I have to provide Java code to twenty questions all of which cannot use inherent classes. The only thing I can use is drawRect in order to draw a pixel :-(
I have answered a question on 2D clipping using Cohen-Sutherland algorithm but I am having real problems trying to extend it to 3D. Here I have to clip a line segment from (x1, y1, z1) to (x2, y2, z2) against a canonical view volume, a cuboid from (-1, -1, 0) to (1, 1, 1). I appreciate that the outcodes have been extended to include front and behind. It is just how to divide the lines up in order to clip.
Any pointers would be welcome.
Thanks in advance.