[comp.graphics] Vector Clipping

peteru@tekig5.PEN.TEK.COM (Peter Uchytil) (08/15/89)

Hi, I need an algorithm that will do vector clipping.  Ideally it would
work like this: give it the clipping window and the endpoints of the 
vector and it gives you the new endpoints back.  There must be an 
algorithm of this type somewhere out there.  Can someone point me in the
right direction?  Thanks!

Pete
peteru@icarus.pen.tek.com

lhf@aries5.uucp (Luiz H. deFigueiredo) (08/15/89)

In article <4670@tekig5.PEN.TEK.COM> peteru@tekig5.PEN.TEK.COM (Peter Uchytil) writes:
>Hi, I need an algorithm that will do vector clipping.  Ideally it would
>work like this: give it the clipping window and the endpoints of the 
>vector and it gives you the new endpoints back.  There must be an 
>algorithm of this type somewhere out there.  Can someone point me in the
>right direction?  Thanks!

How about one of the text books like
 Newman & Sproll, Foley & van Dan, Baker, Harrison, etc...
They all explain the Choen-Sutherland algorithm for vector clipping.
-------------------------------------------------------------------------------
Luiz Henrique de Figueiredo		internet: lhf@aries5.waterloo.edu
Computer Systems Group			bitnet:   lhf@watcsg
University of Waterloo
			(possible domains are waterloo.edu and uwaterloo.ca)
-------------------------------------------------------------------------------

jfh@brunix (John Forbes Hughes) (08/22/89)

In article <378@maytag.waterloo.edu> lhf@Self.UUCP (Luiz H. deFigueiredo) writes:
>In article <4670@tekig5.PEN.TEK.COM> peteru@tekig5.PEN.TEK.COM (Peter Uchytil) writes:
>>Hi, I need an algorithm that will do vector clipping.  Ideally it would
>>work like this: give it the clipping window and the endpoints of the 
>>vector and it gives you the new endpoints back.  There must be an 
>>algorithm of this type somewhere out there.  Can someone point me in the
>>right direction?  Thanks!
>
>How about one of the text books like
> Newman & Sproll, Foley & van Dan, Baker, Harrison, etc...
>They all explain the Choen-Sutherland algorithm for vector clipping.

   The new edition of Foley and van Dam (now 'Foley, van Dam, Feiner, and 
Hughes') contains not only Cohen-Sutherland, but also the Cyrus-Beck/Liang-
Barsky algorithms, which are more efficient, in that the average number of 
intersections computed is smaller than that for C-S. 
   We also describe the Nicholl-Lee-Nicholl algorithm, which is the most 
efficient, but involves a great deal of code, because of its case-by-case 
analysis. If you are truly fascinated by these, let me know and I can fax you 
the relevant pages of the text (or send you the words, but not the pictures, 
via e-mail). 
   One interesting question: only C-S does 3D clipping. How hard is it to 
generalize NLN-clipping to 3D?

-John Hughes, Mathematics and Computer Science Dept's., Brown University
CSnet:   jfh@cs.brown.edu@relay.cs.net
ARPAnet: jfh@CS.BROWN.EDU
BITNET:  jfh@browncs		
UUCP:   ...!{decvax,allegra}!brunix!jfh
   "I was in this prematurely air-conditioned supermarket and there were 
   all these aisles..." -L. Childs