1.14k likes | 1.16k Views
This article explores why polygon clipping is difficult and covers the Sutherland-Hodgman algorithm for clipping polygons. It discusses possible outcomes, concave polygons, and the input/output of the algorithm.
E N D
Clipping Polygons Dr. Scott Schaefer
Why Is Polygon Clipping Hard? • What happens to a triangle during clipping? - possible outcomes: triangle triangle triangle quad triangle 5-gon
Why Is Polygon Clipping Hard? • What happens to a triangle during clipping? - possible outcomes: triangle triangle triangle quad triangle 5-gon How many sides could a clipped triangle have?
Why Is Polygon Clipping Hard? Concave polygon Multiple polygons
Why Is Polygon Clipping Hard? • A really tough case
Sutherland-Hodgman Clipping • Basic idea: - consider each edge of the view window individually - clip the polygon against the view window edge’s equation
Sutherland-Hodgman Clipping • Basic idea: - consider each edge of the view window individually - clip the polygon against the view window edge’s equation
Sutherland-Hodgman Clipping • Basic idea: - consider each edge of the view window individually - clip the polygon against the view window edge’s equation
Sutherland-Hodgman Clipping • Basic idea: - consider each edge of the view window individually - clip the polygon against the view window edge’s equation
Sutherland-Hodgman Clipping • Basic idea: - consider each edge of the view window individually - clip the polygon against the view window edge’s equation
Sutherland-Hodgman Clipping • Basic idea: - consider each edge of the view window individually - clip the polygon against the view window edge’s equation
Sutherland-Hodgman Clipping • Basic idea: - consider each edge of the view window individually - clip the polygon against the view window edge’s equation
Sutherland-Hodgman Clipping • Basic idea: - consider each edge of the view window individually - clip the polygon against the view window edge’s equation
Sutherland-Hodgman Clipping • Basic idea: - consider each edge of the view window individually - clip the polygon against the view window edge’s equation
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
Sutherland-Hodgman Clipping • Input/output for algorithm: - input: list of polygon vertices in order {abcdef} a f b e d c
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)
outside inside outside inside S E E S I outputE output no output Sutherland-Hodgman Clipping • Edge from S to E takes one of four cases: outside inside outside inside E S E S E output I output
Out In Out In Out In Out In Output I,E No output Output E Output I Sutherland-Hodgman Algorithm
Out In Out In Out In Out In Output I,E No output Output E Output I Sutherland-Hodgman Algorithm
Out In Out In Out In Out In Output I,E No output Output E Output I Sutherland-Hodgman Algorithm
Out In Out In Out In Out In Output I,E No output Output E Output I Sutherland-Hodgman Algorithm
Out In Out In Out In Out In Output I,E No output Output E Output I Sutherland-Hodgman Algorithm
Out In Out In Out In Out In Output I,E No output Output E Output I Sutherland-Hodgman Algorithm
Out In Out In Out In Out In Output I,E No output Output E Output I Sutherland-Hodgman Algorithm b
Out In Out In Out In Out In Output I,E No output Output E Output I Sutherland-Hodgman Algorithm
Out In Out In Out In Out In Output I,E No output Output E Output I Sutherland-Hodgman Algorithm
Out In Out In Out In Out In Output I,E No output Output E Output I Sutherland-Hodgman Algorithm
Out In Out In Out In Out In Output I,E No output Output E Output I Sutherland-Hodgman Algorithm
Out In Out In Out In Out In Output I,E No output Output E Output I Sutherland-Hodgman Algorithm
Out In Out In Out In Out In Output I,E No output Output E Output I Sutherland-Hodgman Algorithm
Out In Out In Out In Out In Output I,E No output Output E Output I Sutherland-Hodgman Algorithm
Out In Out In Out In Out In Output I,E No output Output E Output I Sutherland-Hodgman Algorithm
Out In Out In Out In Out In Output I,E No output Output E Output I Sutherland-Hodgman Algorithm
Out In Out In Out In Out In Output I,E No output Output E Output I Sutherland-Hodgman Algorithm
Out In Out In Out In Out In Output I,E No output Output E Output I Sutherland-Hodgman Algorithm
Out In Out In Out In Out In Output I,E No output Output E Output I Sutherland-Hodgman Algorithm
Out In Out In Out In Out In Output I,E No output Output E Output I Sutherland-Hodgman Algorithm
Out In Out In Out In Out In Output I,E No output Output E Output I Sutherland-Hodgman Algorithm
Out In Out In Out In Out In Output I,E No output Output E Output I Sutherland-Hodgman Algorithm
Out In Out In Out In Out In Output I,E No output Output E Output I Sutherland-Hodgman Algorithm
Out In Out In Out In Out In Output I,E No output Output E Output I Sutherland-Hodgman Algorithm
Out In Out In Out In Out In Output I,E No output Output E Output I Sutherland-Hodgman Algorithm
Out In Out In Out In Out In Output I,E No output Output E Output I Sutherland-Hodgman Algorithm
Out In Out In Out In Out In Output I,E No output Output E Output I Sutherland-Hodgman Algorithm
Out In Out In Out In Out In Output I,E No output Output E Output I Sutherland-Hodgman Algorithm
Out In Out In Out In Out In Output I,E No output Output E Output I Sutherland-Hodgman Algorithm