Clipping Polygons Chapter 10 1 Clipping n Its
- Slides: 16
Clipping Polygons Chapter 10 1
Clipping n It’s the process of finding the exact part of a polygon lying inside the view volume n To maintain consistency, clipping of a polygon should result in a polygon, not a sequence of partially unconnected lines n We will first look at 2 different 2 D solutions and then extend one to 3 D 2
Sutherland-Hodgman Algorithm(2 D) p 0 p 1 n n n Clip the polygon against p each boundary of the clip region successively Result is possibly NUL if polygon is outside Can be generalised to work for any polygonal clip region, not just rectangular p 2 4 Clip to top p 3 Clip to right etc 3
Clipping a polygon against a region boundary n To find the new polygon • iterate through each of the polygon edges and construct a new sequence of points • starting with an empty sequence • for each edge there are 4 possible cases to consider right clip boundary P 1 P 0 P 2 P 3 clip region 4
Clipping a polygon edge against the boundary n Given an edge P 0, P 1 we have 4 case. It can be: • entering the clip region, add P and P 1 • leaving the region, add only P • entirely outside, do nothing • entirely inside, add only P 1 n V i si bl e si de of boundar y p p p 0 p p 1 p p p 1 0 Where P is the point of intersection p OUT 1 p 0 IN 5
Still the Sutherland-Hodgman n n We can determine which of the 4 cases and also the point of intersection with just if statements To sum it up, an example: P 1 P 2 P 0 P 3 Pa P 0 Pb P 3 6
Weiler-Atherton Algorithm n n n When we have non-convex polygons then the algorithm above might produce polygons with coincident edges This is fine for rendering but maybe not for other applications (eg shadows) The Weiler-Atherton algorithm produces separate polygons for each visible fragment 7
Weiler-Atherton Algorithm polygon 1 1 2 8 a i 0 A 0 j 9 5 4 7 b k 2 3 4 5 6 l 3 c 7 8 clip region b 6 c d B a 9 d loop of region vertices loop of polygon vertices 8
Find the intersection vertices and connect them in the two lists polygon 0 1 2 8 a 0 A j i 7 b 9 5 k 4 l clip region 2 3 4 6 5 c d B 1 3 6 7 Add vertex i: i a l b k c j d 8 9 9
Find the intersection vertices and connect them in the two lists polygon 0 1 2 8 a 0 A j i 7 b 9 5 k 4 l clip region 2 3 4 6 5 c d B 1 3 6 7 Add vertex l: i a l b k c j d 8 9 10
Find the intersection vertices and connect them in the two lists polygon 0 1 2 8 a 0 A j i 7 b 9 5 k 4 l clip region 2 3 4 6 5 c d B 1 3 6 7 Add vertex k: i a l b k c j d 8 9 11
Start from each Entering vertex and follow the loop to form each polygon 0 1 2 8 a A j i 0 Entering Leaving 7 b 9 5 k 4 l clip region 2 3 4 6 5 c d B 1 3 6 7 i a l b k c j d 8 9 12
Clipping polygons in 3 D n The Sutherland-Hodgman can easily be extended to 3 D • the clipping boundaries are 6 planes instead of 4 lines • intersection calculation is done by comparing an edge to a plane instead of edge to edge n It can either be done in Projection Space or in Canonical Perspective 13
Clipping in Projection Space n The view volume is defined by: n Testing for the 4 cases is fast, for example for the x = 1 (right) clip plane: • • x 0 1 and x 1 1 x 0 1 and x 1 > 1 x 0 > 1 and x 1 > 1 entirely inside leaving entering entirely outside 14
Clipping in Canonical Perspective p When we have an edge that extends from the front to behind the COP, then if we perform the clipping after the projection of the points (which in effect is what the PS does) we might get wrong results V View plane to n +1 p 2 q 1 N O COP q 2 -1 bo tto m 15
Clipping in homogeneous coordinates The Sutherland-Hodgman can also be used for clipping in 4 D before dividing the points by the w n This can have the advantage that is even more general, it even allows for the front clip plane to be behind the COP n 16
- What makes shapes similar
- Determine whether each pair of polygons is similar
- 6 quadrilaterals
- The emigree poem analysis
- When a train increases its velocity its momentum
- Sunny rainy snowy windy cloudy
- If its square its a sonnet
- Its halloween its halloween the moon is full and bright
- Its not easy but its worth it
- Interior and exterior clipping in computer graphics
- Clipping algorithm
- Contoh clipping
- Morphemes
- Nicholl lee nicholl line clipping algorithm
- Sauna ghassan
- Polygon clipping in computer graphics ppt
- Sutherland hodgman algorithm in computer graphics