Computer
Graphics
Scan Conversion Polygon
Faculty of Physical and Basic Education
Computer Science
Dep.
2012

2013
Lecturer
:
Azhee W. MD.
E

mail:
azhee.muhamad@univsul.net
azheewria07@gmail.com
Scan Conversion
polygon
University of sulaimanyiah

Faculty of Physical and Basic Education

Computer Dep. 2012

2013
2
Polygon
Polygon Classifications
Identifying Concave Polygons
Splitting Concave Polygons
Inside

Outside Tests
Polygon
University of sulaimanyiah

Faculty of Physical and Basic Education

Computer Dep. 2012

2013
3
A polyline is a chain of connected line segments. When starting point
and terminal point of any polyline is same, i.e. when polyline is closed
then it is called polygon.
Polygon Classifications
University of sulaimanyiah

Faculty of Physical and Basic Education

Computer Dep. 2012

2013
4
interior angle
: is an angle inside the polygon boundary
that is formed by two adjacent
edges.
convex polygon
: interior angles of a polygon are less
than or
equal to 180
°
Or
Convex
: is a polygon in which the line segment
joining any two points within the polygon lies
completely inside the polygon
Polygon Classifications
University of sulaimanyiah

Faculty of Physical and Basic Education

Computer Dep. 2012

2013
5
Concave
polygon
: the polygon that is not
convex.
or
Concave
: is a polygon in which the line segment
joining any two points within the polygon may not lie
completely inside the
polygon.
Identifying Concave Polygons
University of sulaimanyiah

Faculty of Physical and Basic Education

Computer Dep. 2012

2013
6
1.
At
least one interior angle greater than 180
°
2. The extension of some edges of a
concave polygon
will
intersect
other
edges
3. Some pair of interior points will produce a
line segment
that
intersects the polygon
boundary
4. Find a cross product for adjacent edges
For
a
convex polygon
all cross products will be of the
same sign (positive or negative)
If some cross products yield a positive value and some
a negative
value, we have a
concave polygon
Convex or concave?
University of sulaimanyiah

Faculty of Physical and Basic Education

Computer Dep. 2012

2013
7
Convex
if no line that contains a side of the polygon
contains a point in the interior of the polygon
.
Concave
or non

convex if a line does contain a side of
the polygon containing a point on the interior of the
polygon.
Identifying Concave
Polygons(2)
University of sulaimanyiah

Faculty of Physical and Basic Education

Computer Dep. 2012

2013
8
Splitting Concave
Polygons: Cross
Product
University of sulaimanyiah

Faculty of Physical and Basic Education

Computer Dep. 2012

2013
9
example
University of sulaimanyiah

Faculty of Physical and Basic Education

Computer Dep. 2012

2013
10
Q)Use
cross product to find normal vector of a polygon with the
following vertices:
(0.2
,

0.4, 0.2), (0.6, 0.7, 0.5), (

0.3, 0.4,

0.3),
(

0.4,

0.3,

0.4)
Answer:
Ek
= Vk+1

Vk
E1 = (a1, a2, a3), E2 = (b1, b2, b3)
E1 x E2 = (a2b3 − a3b2, a3b1 − a1b3, a1b2 − a2b1)
V1 = (0.2,

0.4, 0.2), V2 = (0.6, 0.7, 0.5), V3 = (

0.3, 0.4,

0.3)
E1 = V2
–
V1
= (0.6, 0.7, 0.5)

(0.2,

0.4, 0.2)
= (0.4, 1.1, 0.3)
E2 = V3
–
V2
= (

0.3, 0.4,

0.3)

(0.6, 0.7, 0.5)
= (

0.9,

0.3,

0.8)
E1 x E2 = (1.1*

0.8

0.3*

0.3, 0.3*

0.9

0.4*

0.8, 0.4*

0.3

1.1*

0.9)
=
(

0.79, 0.05, 0.87)
Splitting Concave
Polygons: Set
of Triangles
University of sulaimanyiah

Faculty of Physical and Basic Education

Computer Dep. 2012

2013
11
Splitting Concave
Polygons: Set
of Triangles (2)
University of sulaimanyiah

Faculty of Physical and Basic Education

Computer Dep. 2012

2013
12
Inside

Outside Tests
University of sulaimanyiah

Faculty of Physical and Basic Education

Computer Dep. 2012

2013
13
It is not clear which regions of the
xy
plane we
should call interior and which regions we should
designate as exterior for a complex polygon with
intersecting
regions.
algorithms:
odd

even
rule
nonzero winding

number rule
Inside

Outside Tests (2)
University of sulaimanyiah

Faculty of Physical and Basic Education

Computer Dep. 2012

2013
14
odd

even rule
Draw a
reference line
from any position to
a
distant point
outside a closed polyline
The line must not pass through any endpoints
Count the number of
line segments crossed
along
this line
If
the number is odd then the
region considered to be
interior
Otherwise
, the region
is
exterior
Inside

Outside Tests (2)
University of sulaimanyiah

Faculty of Physical and Basic Education

Computer Dep. 2012

2013
15
nonzero winding

number rule
Counts the number of times the boundary of an object winds
around a particular point in the counterclockwise direction
The
count is called the
winding number
Initialize
winding number
to zero
Draw a
reference line
from any position to
a distant
point
The
line must not pass through any endpoints
Add one
to the winding number if the
intersected segment crosses the reference
line from right to left (counterclockwise)
Subtract
one
from the winding number if the
segment crosses from left to right (clockwise)
If winding number is nonzero, the region is
considered to be
interior
Otherwise
, the region is
exterior
Example
University of sulaimanyiah

Faculty of Physical and Basic Education

Computer Dep. 2012

2013
16
Q
)
Use nonzero winding number rule to determine the
interior and exterior regions of the following polygon
?
Example
University of sulaimanyiah

Faculty of Physical and Basic Education

Computer Dep. 2012

2013
17
References
University of sulaimanyiah

Faculty of Physical and Basic Education

Computer Dep. 2012

2013
18
Donald Hearn, M. Pauline Baker,
Computer Graphics with OpenGL, 3rd
edition, Prentice Hall, 2004
Chapter 3, 4
Comments 0
Log in to post a comment