Presentation is loading. Please wait.

Presentation is loading. Please wait.

Clipping Polygons Lecture 31 Fri, Nov 9, 2007.

Similar presentations


Presentation on theme: "Clipping Polygons Lecture 31 Fri, Nov 9, 2007."— Presentation transcript:

1 Clipping Polygons Lecture 31 Fri, Nov 9, 2007

2 Clipping Polygons Clipping polygons requires that their edges be clipping by the line-clipping algorithm, and then new edges be created. Keep in mind that OpenGL treats all polygons as though they were convex. How does this make clipping more efficient?

3 Clipping Polygons Clip region Polygon

4 Clipping Polygons Clip the top edge.

5 Clipping Polygons Clip the top edge.

6 Clipping Polygons Clip the top edge.

7 Clipping Polygons Clip the right edge.

8 Clipping Polygons Clip the right edge.

9 Clipping Polygons Clip the right edge.

10 Clipping Polygons Clip the bottom edge.

11 Clipping Polygons Clip the bottom edge.

12 Clipping Polygons Clip the bottom edge.

13 Clipping Polygons Clip the left edge.

14 Clipping Polygons Clip the left edge.

15 Clipping Polygons Clip the left edge.

16 Clipping Polygons The clipped polygon.

17 Clipping Polygons When an edge is clipped, a shade and a normal are assigned to the new vertex by interpolating between the endpoints. These interpolated shades and normals are used when the interior of the polygon is shaded.

18 Interpolating the Clipped Polygon
[1, 1, 0] (2, 4) 3 (-6, 0) [1, 0, 0] [0, 1, 0] (5, -2) (-5, -2) [0, 0, 1] -3 -4 4

19 Interpolating the Clipped Polygon
[1, 1, 0] (2, 4) 3 (-6, 0) [1, 0, 0] [0, 1, 0] (5, -2) (-5, -2) [0, 0, 1] -3 -4 4

20 Interpolating the Clipped Polygon
[1, 1, 0] (2, 4) 3 (-6, 0) [1, 0, 0] [0, 1, 0] (5, -2) (-5, -2) [0, 0, 1] -3 -4 4

21 Interpolating the Clipped Polygon
[1, 1, 0] (2, 4) (0, 3) 3 (-4, 1) (-6, 0) (4, 0) [1, 0, 0] [0, 1, 0] (5, -2) (-5, -2) (-4, -2) (4, -2) [0, 0, 1] -3 -4 4

22 Interpolating the Clipped Polygon
[1, 1, 0] [1, 0.75, 0] (2, 4) (0, 3) 3 [1, 0.25, 0] (-4, 1) [0.33, 1, 0] (-6, 0) (4, 0) [1, 0, 0] [0, 1, 0] (5, -2) (-5, -2) (-4, -2) [0, 0.1, 0.9] (4, -2) [0, 0, 1] -3 [0, 0.9, 0.1] -4 4

23 Interpolating the Clipped Polygon
[1, 0.75, 0] [0.83, 1, 0] (0, 3) (2.5, 3) 3 [1, 0.25, 0] (-4, 1) [0.33, 1, 0] (4, 0) (-4, -2) [0, 0.1, 0.9] (4, -2) -3 [0, 0.9, 0.1] -4 4

24 Interpolating the Clipped Polygon
[1, 0.75, 0] [0.83, 1, 0] (0, 3) (2.5, 3) 3 [1, 0.25, 0] (-4, 1) [0.33, 1, 0] (4, 0) (-4, -2) [0, 0.1, 0.9] (4, -2) -3 [0, 0.9, 0.1] -4 4


Download ppt "Clipping Polygons Lecture 31 Fri, Nov 9, 2007."

Similar presentations


Ads by Google