Lecture 13
Lecture 13
Presented By,
Mrs. B.A.Chatterjee
1
UNIT II
Raster Scan Graphics
Computer Engineering 2
Lecture 13
Computer Engineering 3
Company
Polygon
LOGO
•Polygon is a closed figure made up of connected lines.
Polygon has many sides and is represented by line
segments. Line segments forming the boundary of the
polygon are called edges of polygon and the endpoints of
edges are known as vertices of the polygon.
Computer Engineering 4
Company
LOGO Polygon
Computer Engineering 5
Company
Types of Polygons
LOGO
o Convex Polygon
oConcave Polygon
oComplex Polygon
Computer Engineering 6
Company
Types of Polygons
LOGO
Convex polygon
•In a convex polygon, the angle between any consecutive pair
of edges is always less than 1800
•All the diagonals are inside the figure then it is called convex
polygon.
Computer Engineering 7
Company
Types of Polygons
LOGO
Computer Engineering 8
Company
Types of Polygons
LOGO
Concave Polygon
•In a concave polygon, the angle between at least one pair of
consecutive edges is greater than 1800.
Computer Engineering 9
Company
Types of Polygons
LOGO
Computer Engineering 10
Company
Types of Polygons
LOGO
Complex Polygon
Polygons which are either convex nor concave are called
complex polygon.
Complex polygons are self-intersecting or overlapping.
Computer Engineering 11
Company
Inside-Outside Test
LOGO
Deciding membership of pixel is very important in polygon
filling. Accurate detection of whether the point is inside or
outside of polygon is crucial.
o Even-odd method
oWinding number method
Computer Engineering 12
Company
Inside-Outside Test
LOGO
Even-Odd Method
This method constructs a line from a given point to the known point
outside the polygon and checks the intersection of line with polygon
boundary.
Draw a line from P2 to known exterior point to a polygon in any direction
and count number of intersections of line with polygon edges.
If count is odd, then point is inside polygon otherwise it is outside of the
polygon.
Line P2P1 intersects polygon edges only once, while line P2P3 intersects
polygon edge thrice. In both the cases count is odd, means the point is
inside the polygon.
Consider the point P4,draw a line to known exterior point P5,it
intersects polygon boundary four times, so P4 is considered as an
exterior point. Same is true for point P7.
Computer Engineering 13
Company
Inside-Outside Test
LOGO
Even-Odd Method
The rule is very simple, but the problem arises when the line crosses
the common vertex shared by two adjacent edges.
If both edges are on the same side of line segment, then count it as two
intersections.
For example,XY and YZ are on the same side of line P1P2,so count it
as two intersection points.
Computer Engineering 14
Company
Inside-Outside Test
LOGO
Computer Engineering 15