
3-D Extension of 2-D Cohen-Sutherland Algorithm, Outcode of six bits. A bit is true (1) when the appropriate condition is satisfied:
Bit 1 - Point is above view volume y > -z
Bit 2 - Point is below view volume y < z
Bit 3 - Point is right of view volume x > -z
Bit 4 - Point is left of view volume x < z
Bit 5 - Point is behind view volume z < -1
Bit 6 - Point is in front of view volume z > zmin
A line is trivially accepted if both endpoints have a code of all zeros.
A line is trivially rejected if the bit-by-bit logical AND of the codes is not all zeros.
Otherwise Calculate intersections.
One the y = z plane from parametric equation of the line:
y0 + t( y1 - y0) = z0 + t( z1 + z0)
Solve for t and calculate x and y. Already know z = y