[comp.graphics] Fastest 2D line clipper

jcs@crash.cts.com (John Schultz) (04/08/90)

  I've written the Fast-Clipper (FC) line clipper in 68000
assembly.  It's generic enough to be assembled on any 680x0
machine, and is callable from HLLs which can pass arguments
in registers (simple mods to use stack args).
  The C version of this algorithm was shown to be twice as
fast as the Cohen-Sutherland (CS) algorithm.
  A modified line demo for the Amiga has been written to use
the clipper for testing/benchmarking.
  If anyone is interested in testing the algorithm, let me
know and I'll send you a copy.  Clip.a is 11739 bytes and
cliptest.c is 3613 bytes.  If there is enough interest and
these files are not too large, I'll post, else mail direct to
those inquiring.


    John

jcs@crash.cts.com (John Schultz) (04/08/90)

  I've gotten quite a few responses for the FC line clipper algorithm.
Many respondants requested the C version as well.  I never typed in
the C version, but a while back I did convert it to modula-2.  It is
fairly easy to read and converting to C shouldn't take too long.  Therefore,
if no one objects to the posting of two 11k files, a 3k file and a couple of
tiny files, I'll post clip.a, cliptest.c, clip2.def, and clip2d.mod, as
well as background information on the FC algorithm.


  John
 

prussak@spica.cs.buffalo.edu (Michal Prussak) (04/09/90)

In article <2130@crash.cts.com>, jcs@crash.cts.com (John Schultz) writes:
>   The C version of this algorithm was shown to be twice as
> fast as the Cohen-Sutherland (CS) algorithm.

In my understanding, Cohen-Sutherland is not presently the state
of the art algorithm. The best that I know is a Liong-Barski algorithm.
I don't see any point comparing your algorithm to an outdated one.

Michal Prussak

jcs@crash.cts.com (John Schultz) (04/09/90)

In article <21266@eerie.acsu.Buffalo.EDU> prussak@spica.cs.buffalo.edu (Michal Prussak) writes:
>
>In my understanding, Cohen-Sutherland is not presently the state
>of the art algorithm. The best that I know is a Liong-Barski algorithm.
>I don't see any point comparing your algorithm to an outdated one.
>
  The CS algorithm may not be the state of the art, but the FC clipper
was tested against the Liang-Barsky algorithm, which is a parametric
method.  The LB algorithm was 2-12x slower. The Cyrus-Beck parametric
method was much slower than the LB method. There was also an algorithm
published in ACM Computer Graphics, Volume 21, Number 4, July 1987,
pp. 253-262, developed by Tina M. Nicholl, D.T. Lee and Robin A. Nicholl.
They state that their method is faster than CS, and LB. They mention
the SPY algorithm as well, but it is unclear which is faster, as they
don't show any real statistical comparisons.  Further, they do not give
a complete source code example, so I didn't bother to implement and 
test it. Nice structured paper, though.
  Also, the FC or SPY algorithm was created by Sobkow,Pospisil and Yang.
I just fixed a few errors in the C version then rewrote it in assembly.
I have not heard of the Liong-Barski algorithm- what type of algorithm
is it? I'd be interested in seeing it (source, references, etc).
Of course, state of the art is high-speed hardware clipping, which is
available only on state of the art workstations or graphics boards.



  John