Download presentation
Presentation is loading. Please wait.
Published byEwa Wierzbicka Modified over 5 years ago
1
Type to enter a caption. Computer Graphics Week 5 Lecture 1
2
Polygon Clipping
3
Polygon Basics Convex Polygon Non Convex Polygon
A line joining any two interior points lie completely inside the polygon A line joining any two interior points does not lie completely inside the polygon
4
Polygon Basics Postively Oriented Polygon:
If the tour of vertices in the given order produces a counter clockwise circuit e.g. ABCDE → +vely oriented AEDCB → not +vely oriented
5
Mathematical defination of +ve orientation
NOTE: If we tour along the edges of +vely oriented polygon our left hand would always point towards the inside of the polygon Let A(x1,y1) and B(x2,y2) be a directed line segment, Then a point P(x,y) will be to the left of line segment if C = (x2-x1)(y-y1) - (y2-y1)(x-x1) is +ve
6
Mathematical defination of Convex Polygon
So if a point P(x,y) , that lies inside the polygon, is to the right of any edge , then the polygon is not Convex polygon (Given positive orientation)
7
Sutherland Hodgeman Algo
For Clipping any polygon against a convex clipping window Successively , clips the polygon against the infinite edges of clipping window
8
S-H Algo Input : Vertices of polygon to be clipped (v1,v2, … , vn)
Output : Produces a clipped polygon by introducing new vertices at places where the polygon gets clipped. Algo: The algo starts from the edge vn to v1, moves around the edges of polygon until it reaches back to vn. At each step , it examines the relationship between the polygon edge and the clipping boundary. Based on the relationship , adds zero,one or two vertices to the list of output vertices (that will define the clipped polygon) Explanation on board
9
SO, There could be 4 cases based on how polygon edge crosses the clipping boundary
10
Case: Both Vertices, of polygon edge (v1 and v2) , are inside the clipping boundary Output: Add v2 to output list Case 1
11
Case 2 Case: v1 is inside v2 is outside Output:
Intersection point of polygon edge with the clipping boundary , i , is output Case 2
12
Case: Both v1 and v2 are outside Output: no output Case 3
13
Case: v1 is outside and v2 is inside Output: i and v2 Case 4
14
Example
15
Left Edge Clipping Input vertices : v1 to v8
Output vertices: i1,i2,v8,v7,v6,v5,v4,v3,v2
16
Bottom Edge Clipping Input vertices : i1,i2,v8,v7,v6,v5,v4,v3,v2
Output vertices: i2,v8,i3,i4,v6,v5,v4,v3,v2,i1
17
Right Edge Clipping Input vertices : i2,v8,i3,i4,v6,v5,v4,v3,v2,i1
Output vertices: i5,i6,v4,v3,v2,i1,i2,v8,i3,i4,v6
18
Top Edge Clipping Input vertices : i5,i6,v4,v3,v2,i1,i2,v8,i3,i4,v6
Output vertices: i7,i8,v2,i1,i2,v8,i3,i4,v6,i5,i6,v4
19
The End
20
Slide 1
21
Text
23
Text
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.