Talk:Sutherland–Hodgman algorithm

Latest comment: 15 years ago by Cooperised in topic Inaccurate algorithm?

Images needed

edit

This article would need images to make it easier to understand. Good examples for the images can be found here http://www.cs.drexel.edu/~david/Classes/CS430/Lectures/L-05_Polygons.6.pdf

There is a free image on commons commons:image:Sutherland-Hodgman clipping sample.svg 83.5.93.48 (talk) 12:07, 11 March 2008 (UTC)Reply

Inaccurate algorithm?

edit

I'm certain the pseudocode presented here is inaccurate - by testing points for inclusion in the clip plane rather than testing them sequentially against the infinitely-extended clip plane edges (as in the diagrams above), the point of the algorithm is missed and bugs are introduced. For example, the leftmost line on the capital W in the graphical example would be clipped entirely because neither of its endpoints lie within the clip plane; the desired behaviour is, of course, to clip it to two edges of the clip plane as shown.

Unless anyone steps in here to point out an error in my thinking, I'll rewrite the algorithm within the next day or two. Comments? Cooperised (talk) 17:06, 23 June 2009 (UTC)Reply

Algorithm rewritten. I've adopted a loosely object-oriented style for the pseudocode, if anyone hates it they can change it.  :-) Cooperised (talk) 10:13, 24 June 2009 (UTC)Reply