The SutherlandHodgman PolygonClipping Algorithm
SAHIL GUPTA 3155
SHUBHAM SINGH - 3134
WHAT IS POLYGON ?
Apolygonis any 2-dimensional shape
formed with straight lines.
Triangles, quadrilaterals, pentagons, and
hexagons are all examples of polygons.
WHAT IS POLYGON?
There are two types of Polygon
1. Convex
2. Non-Convex
CONVEX POLYGON
Aconvex polygonis a
simplepolygon(not self-intersecting) in
which no line segment between two points
on the boundary ever goes outside
thepolygon.
A convex polygonis defined as
apolygonwith all its interior angles less
than 180
Convex Polygon
Non-Convex Polygon
Aconcave polygonis apolygonthat is
not convex.
Asimple polygonis concaveifat least one
of its internal angles is greater than 180.
An example of a non-simple (selfintersecting) polygon is astar polygon.
A concave polygonmust have at least
four sides.
Non-Convex Polygon
Polygon Clipping
Its the process of finding the exact part of a
polygon lying inside the view volume
Window must be convex.
Polygon can be Convex OR Non-Convex.
Properties of Polygon
Planner set of ordering Points.
No line crossing.
No holes.
It could be Convex or Non- Convex.
Sutherland-Hodgman
Algorithm
p0
p1
Clip the polygon
against each
boundary of the clip
region successively
Result is possibly
NULL if polygon is
outside
Can be generalised to
work for any
polygonal clip region,
not just rectangular
p4
Clip to
top
p2
p3
Clip to
right
etc
Sutherland-Hodgman
Clipping
Basic idea:
Consider each edge of the viewport individually
Clip the polygon against the edge equation
After doing all planes, the polygon is fully clipped
Sutherland-Hodgman
Clipping
Basic idea:
Consider each edge of the viewport individually
Clip the polygon against the edge equation
After doing all planes, the polygon is fully clipped
Sutherland-Hodgman
Clipping
Basic idea:
Consider each edge of the viewport individually
Clip the polygon against the edge equation
After doing all planes, the polygon is fully clipped
Sutherland-Hodgman
Clipping
Basic idea:
Consider each edge of the viewport individually
Clip the polygon against the edge equation
After doing all planes, the polygon is fully clipped
Sutherland-Hodgman
Clipping
Basic idea:
Consider each edge of the viewport individually
Clip the polygon against the edge equation
After doing all planes, the polygon is fully clipped
Sutherland-Hodgman
Clipping
Basic idea:
Consider each edge of the viewport individually
Clip the polygon against the edge equation
After doing all planes, the polygon is fully clipped
Sutherland-Hodgman
Clipping
Basic idea:
Consider each edge of the viewport individually
Clip the polygon against the edge equation
After doing all planes, the polygon is fully clipped
Sutherland-Hodgman
Clipping
Basic idea:
Consider each edge of the viewport individually
Clip the polygon against the edge equation
After doing all planes, the polygon is fully clipped
Sutherland-Hodgman
Clipping
Basic idea:
Consider each edge of the viewport individually
Clip the polygon against the edge equation
After doing all planes, the polygon is fully clipped
EXAMPLE
Sutherland-Hodgeman Clipping
Sutherland-Hodgeman Polygon
Clipping
2
2
2
3
1
Input
Left Clipper
Right Clipper
Bottom Clipper
Top Clipper
[1,2]:
(in-in)>{2}
[2,3]:
(in-out)>{2}
[2,2]:(in-in)>{2}
[3,1]:
(out-in)>{3,1}
[2,3]:(in-in)>{3}
[2,3]:(in-out)>{2}
[3,1]:(in-in)>{1}
[3,1]:(out-out)>{}
[1,2]:(in-in)>{2}
[1,2]:(out-in)>{1,2}
[2,1]:(in-in)>1}
[2,2]:(in-in)>{2}
[1,2]:(in-in)>{2}
[2,2]:(in-in)>{2}
[2,2]:(in-in)>{2}
May 2010
23
Pseudo Code
THANK YOU