Documente Academic
Documente Profesional
Documente Cultură
Lecture-03
Scan Conversion
Jesmin Akhter
Lecturer,IIT
Jahangirnagar University,
Savar, Dhaka,Bangladesh
09/20/16
Midpoint Ellipse
Algorithm
Implicit equation is:
In Region 2 dx < dy
Decrease y at each step
x may increase
(-x1,y1)(x1,y1)
(-x2,y2)
(x2,y2)
(-x2,-y2)
(x2,-y2
(-x1,-y1(x
) 1,-y1)
E
SE
Region 1
Region 2
SE
Midpoint Ellipse
Algorithm
Decision Parameter
Midpoint of the
(Region
1)vertical line connecting E and SE is used to
define the following decision parameter:
d i F ( xi 1, yi 12 )
( xi 1, yi 12 )
p ( xi , yi )
b 2 ( xi 1) 2 a 2 ( yi 12 ) 2 a 2b 2
if d i 0 then move to E; (x i 1 ,y i 1) (x i 1, yi )
S
E
b ( xi 2) a ( yi ) a b
2 2
xi xi 1 xi 2
d i 1 d i b 2 (2 xi 3)
if d 0 then move to SE
d i 1 F ( xi 2, yi 32 )
b 2 ( xi 2) a 2 ( yi 32 ) a 2b 2
d i d i b 2 (2 xi 3) a 2 (2 yi 2)
yi 2
Next
1 2
2
Current
Previous
yi
yi 1
d i 1 F ( xi 2, yi 12 )
2
( x 2, y 12 )
( xi 2, yi 32 )
1
2
b 2 ( x j 12 ) 2 a 2 ( y j 1) 2 a 2b 2
Current
Previous
Decision Parameter
(Region
d F ( x 2)
, y 1)
Next
Midpoint Ellipse
Algorithm
x j x j 1 x j 2
p (x j y j )
b 2 ( x j 32 ) 2 a 2 ( y j 2) 2 a 2b 2
d j 1 d j b (2 x j 2) a (2 y j 3)
2
b 2 ( x j 12 ) 2 a 2 ( y j 2) 2 a 2b 2
d j 1 d j a 2 (2 y j 3)
S
E
y j 1
yj 2
( x j 12 , y j 1)
yj
( x j , y j 2)
1
2
( x j 32 , y j 2)
Self Study
Pseudo code for midpoint ellipse
algorithm
Solved Problems:
3.1,3.2,3.6,3.7,3.10,3.11,3.12,3.20,3.21
1. Aliasing
Jagged appearance of curves or diagonal lines on
a display screen, which is caused by low screen
resolution.
Refers to the plotting of a point in a location other
than its true location in order to fit the point into
the raster.
Consider equation y = mx + b
For m = 0.5, b = 1 and x = 3 : y = 2.5
Remedy
So theanti-aliasing
point (3,2.5)algorithms.
is plotted at
alias
Apply
Most
of location
these
(3,3)
algorithms
introduce extra pixels and pixels are
intensified proportional to the area of that pixel
covered by the object.
1.
44
2. Unequal Intensity
1
3. Overstrike
The same pixel is written more than once.
This results in intensified pixels in case of
photographic media.
Remedy
Check each pixel to see whether it has already
been written to prior to writing a new point.
rx = 8 ,
2ry2x = 0
ry = 6
Example
pi
2rx2yi+1
-332
(1, 6)
72
768
-224
(2, 6)
144
768
-44
(3, 6)
216
768
208
(4, 5)
288
640
-108
(5, 5)
360
640
288
(6, 4)
432
512
244
(7, 3)
504
384
Example
Region 2
(x0, y0) = (7, 3)
p 20 f ellipse (7 12 , 2) 151
i
pi
-151
(8, 2)
576
256
233
(8, 1)
576
128
745
(8, 0)
2rx2yi+1
Stop at y = 0
3
2
11
Exercises
Draw the ellipse with rx = 6, ry = 8.
Draw the ellipse with rx = 10, ry = 14.
Draw the ellipse with rx = 14, ry = 10
and center at (15, 10).
12