it- 601: computer graphics lecture-03 scan conversion jesmin akhter lecturer,iit jahangirnagar...
TRANSCRIPT
IT- 601: Computer Graphics
Lecture-03Scan Conversion
Jesmin Akhter Lecturer,IIT
Jahangirnagar University, Savar, Dhaka,Bangladesh
04/19/23
Midpoint Ellipse Algorithm
• Implicit equation is: F(x,y) = b2x2 + a2y2 – a2b2 = 0• We have only 4-way symmetry• There exists two regions
– In Region 1 dx > dy• Increase x at each step• y may decrease
– In Region 2 dx < dy• Decrease y at each step• x may increase
Region 1
Region 2 S SE
E
SE
(x1,y1)(-x1,y1)
(x1,-y1)(-x1,-y1)
(-x2,y2)
(-x2,-y2)
(x2,y2)
(x2,-y2)
Midpoint Ellipse Algorithm
)22()32(
)()2(
),2(
SE tomove then 0 if
)32(
)()2(
),2(
),1(x),y(xE; tomove then 0 if
)()1(
),1(
22
222322
23
1
21
22221222
21
1
i1i1i
22221222
21
iiii
ii
iii
iii
ii
iii
ii
ii
iii
yaxbdd
bayaxb
yxFd
d
xbdd
bayaxb
yxFd
yd
bayaxb
yxFd
M
E
Pre
vio
us
Curr
ent
Next
),1( 21 ii yx ),2( 2
1 yx
SE
),2( 23 ii yx
Midpoint of the vertical line connecting E and SE is used to define the following decision parameter:
Decision Parameter (Region 1)Decision Parameter (Region 1)
),( ii yxp
iy
1iy
2iy
ix 1ix 2ix
Initial value with (0,b)
4/)2
1( 22222222
1 ababbababp
Midpoint Ellipse Algorithm
)32(
)2()(
)2,(
1)-y,(x)y,S(x tomove then 0 if
)32()22(
)2()(
)2,(
1)-y1,(x)y,SE(x tomove then 0 if
)1()(
)1,(
21
22222212
21
1
jj1j1j
221
22222232
23
1
jj1j1j
22222212
21
jjj
jj
jjj
j
jjjj
jj
jjj
j
jj
jjj
yadd
bayaxb
yxFd
d
yaxbdd
bayaxb
yxFd
d
bayaxb
yxFd
MS
Pre
vio
us
Curr
ent
Next
)1,( 21 jj yx
)2,( 21 jj yx
SE
)2,( 23 jj yx
)( jj yxp jx 1jx 2jx
jy
1jy
2jy
Decision Parameter (Region 2)Decision Parameter (Region 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
Side Effects of Scan Conversion
The most common side effects when working with
raster devices are:
1. Aliasing
2. Unequal intensity
3. Overstrike
In computer graphics, a raster graphics image, or
bitmap, is a dot matrix data structure representing a
rectangular grid of pixels, or points of color, viewable
via a monitor, paper, or other display medium
1. AliasingJagged 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 + bFor m = 0.5, b = 1 and x = 3 : y = 2.5
So the point (3,2.5) is plotted at alias location (3,3)
RemedyApply anti-aliasing algorithms. Most of these algorithms introduce extra pixels and pixels are intensified proportional to the area of that pixel covered by the object.
2. Unequal IntensityHuman perception of light is dependent on Density and Intensity of light source.
Thus, on a raster display with perfect squareness, a diagonal line of pixels will appear dimmer that a horizontal or vertical line.
Remedy1. By increasing the number of pixels on diagonal
lines.
1.44
1
3. OverstrikeThe same pixel is written more than once.
This results in intensified pixels in case of photographic media.
RemedyCheck each pixel to see whether it has already been written to prior to writing a new point.
10
ExampleExample
i pi xi+1, yi+1 2ry2xi+1 2rx2yi+1
0 -332 (1, 6) 72 768
1 -224 (2, 6) 144 768
2 -44 (3, 6) 216 768
3 208 (4, 5) 288 640
4 -108 (5, 5) 360 640
5 288 (6, 4) 432 512
6 244 (7, 3) 504 384
rx = 8 , ry = 6
2ry2x = 0 (with increment 2ry
2 = 72)
2rx2y = 2rx
2ry (with increment -2rx2 = -128)
Region 1Region 1 (x0, y0) = (0, 6)
2 2 210 41 332y x y xp r r r r
Move out of region 1 since2ry
2x > 2rx2y
11
ExampleExample
6
5 4 3
2 1 0
0 1 2 3 4 5 6 7 8
i pi xi+1, yi+1 2ry2xi+1 2rx2yi+1
0 -151 (8, 2) 576 256
1 233 (8, 1) 576 128
2 745 (8, 0) - -
Region 2Region 2 (x0, y0) = (7, 3) (Last position in region 1)
10 22 (7 ,2) 151ellipsep f
Stop at y = 0
12
ExercisesExercises
• 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).