Computer Science, asked by mansichoubisa901, 9 months ago

Why sutherland hodgman clipping algorithm only works for convex clipping region?

Answers

Answered by dRoid17x
1

Because the algorithm relies on the turn of the clipping region to determine what is inside and outside the region. Convex shapes have constant turn. If you follow each edge counter-clockwise it will always turn left to the next edge. In other words, if a point is to the left of all clipping edges (following the edges counter-clockwise), then it is inside the clipping region. If a point is to the right of any clipping edge, then it is outside the clipping region and can be eliminated.

You can easily modify the algorithm to accept concave clipping regions by first converting the concave region into a set of convex regions and then operating on each of those convex regions normally.

Similar questions