0% found this document useful (0 votes)
17 views15 pages

Lecture 13

Uploaded by

Mayur Mahajan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views15 pages

Lecture 13

Uploaded by

Mayur Mahajan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 15

Subject – Computer Graphics

Course Code-22318 Class-CO3I

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.

•Triangle is the polygon with a minimum number of edges.

• Polygon is always closed figure.


•Less than three sides cannot form the polygon.
•The circle is closed figure but it does not have edges, so it
is not a polygon.

Computer Engineering 4
Company

LOGO Polygon

Polygon with different shapes and sides

Computer Engineering 5
Company
Types of Polygons
LOGO

We can classify polygon in one of the following categories:

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

•For a convex polygon ,if we select any random two points


inside the polygon and we join them through a line, all the
points on the line are certainly inside the polygon.

•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.

•For a concave polygon, there always exists a pair of vertices


inside the polygon. When joined through a line segment, part of
line segment falls outside the polygon.

•Diagonals are going to outside the figure, then it is called


concave polygon.

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.

We will discuss two methods to decide if a pixel is inside the


polygon.

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.

Line P3P4 intersects the outer boundary of the polygon at common


vertex shared by edges BC and CD.So even though P3P4 intersects
three polygon edges(YZ,BC and CD),P3 is an exterior point.

The solution to this problem is to count intersection as a single


intersection, if both edges are on the opposite side of the line. For
example,CD and BC in case of line P3P4.

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

You might also like