home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.asm.x86      Ahh, the lost art of x86 assembly      4,675 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 4,174 of 4,675   
   R.Wieser to All   
   Re: Line clipping w. Cohen-Sutherland -    
   09 Oct 20 09:53:33   
   
   From: address@nospicedham.not.available   
      
   Terje,   
      
   > but in my own code I had the special case that frustrum would always be   
   > rectangular   
      
   Thats what I'm having.   
      
   > so the code was simple enough:   
   [snip]   
      
   Which is pretty-much what I ended up with too.   
      
   > An alternative is to classify each coordinate into one of 9 bins,   
      
   And thats pretty-much the problem : what does it give that a simple "if (x1   
   < Left and x2 < Left) or (x1 > Right and ....") comparision doesn't provide.   
      
   > For the remaining cases apply the parts of the first algorithm that makes   
   > sense for each case, i.e. only the full diagonals (from 0 to 8 or 2 to 6)   
   > need all the clipping operations   
      
   So, trying to skip certain checks depending on which zones the start and   
   endpoints are in ?   AFAICS that won't work, as the exact clipping action is   
   dependant on where, in those corner zones, the start and endpoints are.   
      
   Assuming a diagonal line than if it starts above the clipwindow diagonal the   
   top-boundary clip should be taken.  If it starts below the diagonal the   
   left-boundary should be taken.    It gets complicated when a line is not at   
   a diagonal angle, or when only the start or endpoints are in those corner   
   zones ...   
      
   I have got zero proof, but somehow I get the feeling that such checks could   
   easily become more expensive than a duplicated clipping or two.   
      
      
   tl;dr:   
   The thing is that the Cohen-Sutherland algorithm seems to make the whole   
   thing more complicated (and costly in the sense of total instructions - even   
   in pseudo-code) than what you and I ended up with. And that does not make   
   any sense.  As such I came to the conclusion I must be missing something in   
   that algorithm.  The question is, what ?   
      
   Regards,   
   Rudy Wieser   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca