Download presentation
Presentation is loading. Please wait.
1
Clipping Polygons Dr. Scott Schaefer
2
Clipping Polygons
3
Clipping Polygons
4
Why Is Polygon Clipping Hard?
What happens to a triangle during clipping? - possible outcomes: triangle triangle triangle quad triangle gon
5
Why Is Polygon Clipping Hard?
What happens to a triangle during clipping? - possible outcomes: triangle triangle triangle quad triangle gon How many sides could a clipped triangle have?
6
How Many Sides? 7
7
Why Is Polygon Clipping Hard?
Concave polygon Multiple polygons
8
Why Is Polygon Clipping Hard?
A really tough case
9
Sutherland-Hodgman Clipping
Basic idea: - consider each edge of the view window individually - clip the polygon against the view window edge’s equation
10
Sutherland-Hodgman Clipping
Basic idea: - consider each edge of the view window individually - clip the polygon against the view window edge’s equation
11
Sutherland-Hodgman Clipping
Basic idea: - consider each edge of the view window individually - clip the polygon against the view window edge’s equation
12
Sutherland-Hodgman Clipping
Basic idea: - consider each edge of the view window individually - clip the polygon against the view window edge’s equation
13
Sutherland-Hodgman Clipping
Basic idea: - consider each edge of the view window individually - clip the polygon against the view window edge’s equation
14
Sutherland-Hodgman Clipping
Basic idea: - consider each edge of the view window individually - clip the polygon against the view window edge’s equation
15
Sutherland-Hodgman Clipping
Basic idea: - consider each edge of the view window individually - clip the polygon against the view window edge’s equation
16
Sutherland-Hodgman Clipping
Basic idea: - consider each edge of the view window individually - clip the polygon against the view window edge’s equation
17
Sutherland-Hodgman Clipping
Basic idea: - consider each edge of the view window individually - clip the polygon against the view window edge’s equation
18
Sutherland-Hodgman Clipping
Basic idea: - consider each edge of the view window individually - clip the polygon against the view window edge’s equation - after doing all edges, the polygon is fully clipped
19
Sutherland-Hodgman Clipping
Input/output for algorithm: - input: list of polygon vertices in order {abcdef} a f b e d c
20
Sutherland-Hodgman Clipping
Input/output for algorithm: - input: list of polygon vertices in order - output: list of clipped polygon vertices consisting of old vertices (maybe) and new vertices (maybe)
21
Sutherland-Hodgman Clipping
Edge from S to E takes one of four cases: inside outside S E no output outside inside outside inside outside inside S E I output E output E S E S E output I output
22
Sutherland-Hodgman Algorithm
Out In No output Output E Output I Output I,E
23
Sutherland-Hodgman Algorithm
Out In No output Output E Output I Output I,E
24
Sutherland-Hodgman Algorithm
Out In No output Output E Output I Output I,E
25
Sutherland-Hodgman Algorithm
Out In No output Output E Output I Output I,E
26
Sutherland-Hodgman Algorithm
Out In No output Output E Output I Output I,E
27
Sutherland-Hodgman Algorithm
Out In No output Output E Output I Output I,E
28
Sutherland-Hodgman Algorithm
Out In No output Output E Output I Output I,E b
29
Sutherland-Hodgman Algorithm
Out In No output Output E Output I Output I,E
30
Sutherland-Hodgman Algorithm
Out In No output Output E Output I Output I,E
31
Sutherland-Hodgman Algorithm
Out In No output Output E Output I Output I,E
32
Sutherland-Hodgman Algorithm
Out In No output Output E Output I Output I,E
33
Sutherland-Hodgman Algorithm
Out In No output Output E Output I Output I,E
34
Sutherland-Hodgman Algorithm
Out In No output Output E Output I Output I,E
35
Sutherland-Hodgman Algorithm
Out In No output Output E Output I Output I,E
36
Sutherland-Hodgman Algorithm
Out In No output Output E Output I Output I,E
37
Sutherland-Hodgman Algorithm
Out In No output Output E Output I Output I,E
38
Sutherland-Hodgman Algorithm
Out In No output Output E Output I Output I,E
39
Sutherland-Hodgman Algorithm
Out In No output Output E Output I Output I,E
40
Sutherland-Hodgman Algorithm
Out In No output Output E Output I Output I,E
41
Sutherland-Hodgman Algorithm
Out In No output Output E Output I Output I,E
42
Sutherland-Hodgman Algorithm
Out In No output Output E Output I Output I,E
43
Sutherland-Hodgman Algorithm
Out In No output Output E Output I Output I,E
44
Sutherland-Hodgman Algorithm
Out In No output Output E Output I Output I,E
45
Sutherland-Hodgman Algorithm
Out In No output Output E Output I Output I,E
46
Sutherland-Hodgman Algorithm
Out In No output Output E Output I Output I,E
47
Sutherland-Hodgman Algorithm
Out In No output Output E Output I Output I,E
48
Sutherland-Hodgman Algorithm
Out In No output Output E Output I Output I,E
49
Sutherland-Hodgman Algorithm
Out In No output Output E Output I Output I,E
50
Sutherland-Hodgman Algorithm
Out In No output Output E Output I Output I,E
51
Sutherland-Hodgman Algorithm
Out In No output Output E Output I Output I,E
52
Sutherland-Hodgman Algorithm
Out In No output Output E Output I Output I,E
53
Sutherland-Hodgman Algorithm
Out In No output Output E Output I Output I,E
54
Sutherland-Hodgman Algorithm
Out In No output Output E Output I Output I,E
55
Sutherland-Hodgman Algorithm
Out In No output Output E Output I Output I,E
56
Sutherland-Hodgman Algorithm
Out In No output Output E Output I Output I,E
57
Sutherland-Hodgman Algorithm
Out In No output Output E Output I Output I,E
58
Sutherland-Hodgman Algorithm
Out In No output Output E Output I Output I,E
59
Sutherland-Hodgman Algorithm
Out In No output Output E Output I Output I,E
60
Sutherland-Hodgman Algorithm
Out In No output Output E Output I Output I,E
61
Sutherland-Hodgman Algorithm
Out In No output Output E Output I Output I,E
62
Sutherland-Hodgman Algorithm
Out In No output Output E Output I Output I,E
63
Sutherland-Hodgman Algorithm
Out In No output Output E Output I Output I,E
64
Sutherland-Hodgman Algorithm
Out In No output Output E Output I Output I,E
65
Sutherland-Hodgman Algorithm
Out In No output Output E Output I Output I,E Possible error for non-convex polygons
66
Sutherland-Hodgman Algorithm
Easy to pipeline for parallel processing Polygon from one boundary does not have to be complete before next boundary starts Leads to substantial performance gains
67
Weiler-Atherton Algorithm
General polygon vs. polygon clipping Handles non-convex shapes Not as efficient as Sutherland-Hodgman Not easy to parallelize
68
Weiler-Atherton Algorithm
Process the edges of the polygon in a counterclockwise order until an inside-outside pair of vertices is encountered Follow the window boundaries in a counterclockwise direction from the exit-intersection point to another intersection point with the polygon Repeat until at a previously processed vertex Return to the exit-intersection point and continue processing the polygon edges in a counterclockwise order
69
Weiler-Atherton Algorithm
70
Weiler-Atherton Algorithm
71
Weiler-Atherton Algorithm
72
Weiler-Atherton Algorithm
73
Weiler-Atherton Algorithm
74
Weiler-Atherton Algorithm
75
Weiler-Atherton Algorithm
76
Weiler-Atherton Algorithm
77
Weiler-Atherton Algorithm
78
Weiler-Atherton Algorithm
79
Weiler-Atherton Algorithm
80
Weiler-Atherton Algorithm
81
Weiler-Atherton Algorithm
82
Weiler-Atherton Algorithm
83
Weiler-Atherton Algorithm
84
Weiler-Atherton Algorithm
85
Weiler-Atherton Algorithm
86
Weiler-Atherton Algorithm
88
Sutherland-Hodgman Algorithm
Out In No output Output E Output I Output I,E
89
Sutherland-Hodgman Algorithm
Out In No output Output E Output I Output I,E
90
Sutherland-Hodgman Algorithm
Out In No output Output E Output I Output I,E
91
Sutherland-Hodgman Algorithm
Out In No output Output E Output I Output I,E
92
Sutherland-Hodgman Algorithm
Out In No output Output E Output I Output I,E
93
Sutherland-Hodgman Algorithm
Out In No output Output E Output I Output I,E
94
Sutherland-Hodgman Algorithm
Out In No output Output E Output I Output I,E
95
Sutherland-Hodgman Algorithm
Out In No output Output E Output I Output I,E
96
Sutherland-Hodgman Algorithm
Out In No output Output E Output I Output I,E
97
Sutherland-Hodgman Algorithm
Out In No output Output E Output I Output I,E
98
Sutherland-Hodgman Algorithm
Out In No output Output E Output I Output I,E
99
Sutherland-Hodgman Algorithm
Out In No output Output E Output I Output I,E
100
Sutherland-Hodgman Algorithm
Out In No output Output E Output I Output I,E
101
Sutherland-Hodgman Algorithm
Out In No output Output E Output I Output I,E
102
Sutherland-Hodgman Algorithm
Out In No output Output E Output I Output I,E
103
Sutherland-Hodgman Algorithm
Out In No output Output E Output I Output I,E
104
Sutherland-Hodgman Algorithm
Out In No output Output E Output I Output I,E
105
Sutherland-Hodgman Algorithm
Out In No output Output E Output I Output I,E
106
Sutherland-Hodgman Algorithm
Out In No output Output E Output I Output I,E
107
Sutherland-Hodgman Algorithm
Out In No output Output E Output I Output I,E
108
Sutherland-Hodgman Algorithm
Out In No output Output E Output I Output I,E
109
Sutherland-Hodgman Algorithm
Out In No output Output E Output I Output I,E
110
Sutherland-Hodgman Algorithm
Out In No output Output E Output I Output I,E
111
Sutherland-Hodgman Algorithm
Out In No output Output E Output I Output I,E
112
Sutherland-Hodgman Algorithm
Out In No output Output E Output I Output I,E
113
Sutherland-Hodgman Algorithm
Out In No output Output E Output I Output I,E
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.