Derek Nickel provided the following reference to another article published in the Dr. Dobbs Sourcebook:
Michael Abrash, "3-D Clipping and Other Thoughts" In: Dr. Dobb's Sourcebook, March/April 1996, #256 Ramblings In Real Time, pp. 43-50In this article Michael Abrash discusses 3D clipping basics, i.e. the intersection of an edge with a plane, in the context of clipping polygons against the view frustrum. However, the algorithms are useful for any sort of 3D clipping task. The article explains why planes are stored as normals and offset to origin (see e-mail discussion), how new vertices and edges could be generated, that texture space clipping is simply done the same way as the 3D coordinates are clipped, and finally discusses the repspective advantages of viewspace and worldspace clipping. On the pages 47 and 50 you will find the listing of an example. The source is available, and there is a local copy with permission.
Quoting the
README.TXT:
"This
archive
contains the source code
(clip.h,
clip.c, and
resource.h)
for a sample system to render
3-D scenes to illustrate 3-D clipping, as discussed in my "Ramblings
in Realtime" column in the March/April 1995 issue of _Dr. Dobb's
Sourcebook_. The archive contains the source code for CLIP, a C
program that contains a small 3-D graphics engine to demonstrate 3-D
clipping. Both programs are Win32 programs, tested with VC++ 2.0
running on Windows NT 3.5.
To make the VC++ projects for this program, just unzip this archive
into the desired directory using the -d switch to pkunzip; it will
create a windebug subdirectory. Have VC++ build a project from the
files in the directory. Besides the source code, the Win32
executable clip.exe is provided in the WinDebug subdirectory. Key
commands to clip.exe are as follows:
left and right arrows: turn left and right up and down arrows: go forward and backward A and D: look up and down N and M: roll left and right D and C: move up and downThanks to Chris Hecker, John Carmack, and Eric Kutter for their help.