ALGORITHM References Wanted: tri mesh clipping

Jim Roth jroth at allvax.dec.com
Tue Oct 16 21:31:24 AEST 1990


In article <JIM.90Oct14172452 at baroque.Stanford.EDU>, jim at baroque.Stanford.EDU (James Helman) writes...
>I'm looking for algorithms for clipping triangular meshes "on the fly"
>against several "arbitrary" clipping planes.

If your goal is good performance, then note that most triangles in a mesh
are either trivially accepted (lying entirely in a view volume) or
trivially rejected (lying entirely to one side of some clipping plane.)

Statistially, fairly few actually require detailed clipping.

If your mesh comes in where each triangle shares a side with the previous
one (like PHIGS+), then check and save the status of each new vertex
with respect to all clip planes and only do clipping if the triangle
requires more work.  This is easily checked with boolean operations on
"outcode" bits saved with each vertex.

To do clipping, use Sutherland-Hodgeman clipping, as it is very
efficient and can even be inlined as a set of macro expansions if only
a few clipping planes are in use (this is impractical if you have lots
of planes.)  This yields a convex polygon, which you can triangulate again
if your renderer requires it.

- Jim



More information about the Comp.sys.sgi mailing list