3D Clipping3D clipping is required when displaying 3D objects that can have negative z values when transformed to world space. Consider again our 40x40x40 cube. If we assume the cube vertices are defined in world space instead of object space, the cube will be drawn centered at the world space origin. This means the front half of the cube will extend through z=0 and into negative z space. This will cause major problems when we project the world space points to screen space when displaying the cube. 3D clipping solves this problem by clipping a polygon's world space points against a specified z plane, called the near clipping plane. Any z coordinates that extend into this plane are set to the near clipping value, and their x and y coordinates are adjusted accordingly. Besides the near clipping plane, Fastgraph's 3D clipping also supports a far clipping plane. Objects that are completely behind the far clipping plane are not drawn, as we assume these are too far away for the viewer to see. By default, Fastgraph uses a near clipping value of 1 and a far clipping value of 1000, but we can redefine these with fg_3Dsetzclip(). Its two parameters are floating point z values that respectively specify the near and far clipping planes. They must be greater than zero (recall that z values are positive in a lefthanded 3D coordinate system), or if zbuffering is used, greater than or equal to 1. The far clipping plane must be greater than the near clipping plane. We must also use 3D clipping when we use a different POV. In this case, any transformed z coordinates that end up behind the viewer must be clipped. Although this might seem like a special case at first, it's really just analogous to clipping negative z values when using the default POV.

copyright 2001 Ted Gruber Software, Inc.