[comp.graphics] Modified Liang-Barsky Polygon Clipping

sbw@naucse.UUCP (03/11/87)

I recently posted a query and a summary of responses concerning
the Liang-Barsky Polygon clipping algorithm as published in
CACM, VOL 26, Nov. 1983.

The corrigenda in CACM, VOL 27, April 1984 provided the fix
to the original algorithm.  It also led me to examine my
'patched' version more closely.  I now have a modified
version of the algorithm that, while based upon my patch,
appears (see below) to produce results identical to the
corrected Liang-Barsky algorithm.  The modified version is
both slightly simpler and slightly faster (it averages about 6%
faster over my test data) than the original.

Is anyone interested in this modified algorithm (in C)?  If so,
then I'll post the source to the net (about 150 lines - should
it go to net.sources?).

I have only done limited testing of the code, using 10 randomly
generated polygons (well 7 random and 3 'worst' case) with
from 4 to 200 vertices (counting first vertex twice).  In all
cases the output is exactly the same as the corrected Liang-Barsky
algorithm.  Anyone who wants to really test it out is welcome to.
Please mail me if it has problems.

matt@inuxf.UUCP (03/14/87)

> I recently posted a query and a summary of responses concerning
> the Liang-Barsky Polygon clipping algorithm as published in
> CACM, VOL 26, Nov. 1983.
> ...
> 
> Is anyone interested in this modified algorithm (in C)?  If so,
> then I'll post the source to the net (about 150 lines - should
> it go to net.sources?).
> 
Yes Please post it!  And Yes it should go in net.sources (Or whatever the
net.police call it these days) with an announcement in this group.
Thanks!


 Matt Verner   				UUCP:  ...ihnp4!inuxc!matt
 AT&T Graphics Software Labs		AT&T:  (317) 844-4364
 Indianapolis,  IN

           "The whole point of this sentence is to clearly
             explain the point this sentence is making."