Docsity

Polygon Clipping algorithm, Lecture notes of Computer Graphics

Partial preview of the text

Download Polygon Clipping algorithm and more Lecture notes Computer Graphics in PDF only on Docsity!

Computer Graphics

Sutherland - Hodgman

(Polygon Clipping)

Covered by:-

Arvind Kumar

Assistant Professor Vidya College of Engg.

Sutherland- Hodgman Polygon Clipping The Sutherland-Hodgman algorithm performs a clipping of a polygon against each window edge in turn. The order to clip the polygon should be:

  1. Clipping against the left side of the clip window.
  2. Clipping against the top side of the clip window.
  3. Clipping against the right side of the clip window.
  4. Clipping against the bottom side of the clip window.

Sutherland- Hodgman Polygon Clipping It consist of Four Cases:

  1. If the first vertex of the edge is outside the window and second vertex is inside then the intersection point of the polygon edge with the window boundary and the second vertex are added to the output vertex list.

Save {v’ 1 and v 2 } V

V’ V

Sutherland- Hodgman Polygon Clipping

  1. If the both vertices of the edge are inside the window. Then only second vertex is added to the output vertex list.

Save {v 2 }

V V

Sutherland- Hodgman Polygon Clipping

  1. If the both vertices of the edge are outside the window. Then nothing is added to the output vertex list.

Save { ∅ }

V V

Numerical

Q 1. For a polygon and clipping window as shown in figure give the list of vertices after each boundary clipping. Clipping Window V V V V

**2. Top Clipped: : Output vertex= { V’ 1 , V 2 , V’ 2 , V’ 3 ,V 4 ,V’ 4 }

  1. Right Clipped: Output vertex= { V’ 1 , V 2 , V’ 2 , V’ 3 ,V 4 ,V’ 4 } V’ V V V V’ V’ V’ V V V’ V’ V’ V’**

4. Bottom Clipped: Output vertex= { V’ 1 , V 2 , V’ 2 , V’ 3 ,V 4 ,V’ 4 } Final Clipped polygon: { V’ 1 , V 2 , V’ 2 , V’ 3 ,V 4 ,V’ 4 }

V

V

V V’ V’ V’ V’ V V V’ V’ V’ V’