Prestige Institute of Management, Gwalior: Presentation On Line Drawing Algorithm
Prestige Institute of Management, Gwalior: Presentation On Line Drawing Algorithm
MANAGEMENT , GWALIOR
Presentation on line drawing
algorithm
SUBMITTED TO
PROF .SATISH BANSAL
RASTERIZATION
Lines
Circles
Triangles
Polygons
0 1 2 3 4 5 6 7 8 9 10 11 12
Which intermediate
pixels to turn on?
dy y1 y0
dx x1 x0
b y 0 m * x0
y = mx + b
Given two end points (x0,y0), (x1, y1), how to compute m and b?
(x1,y1)
dy
(x0,y0)
dx
By Ay 96 41 55
m
0.5392
Bx Ax 125 23 102
Candid
ate
pixel
(Xk+1,
Yk)
Current pixel
Now let f(K) be a decision parameter whose value
will be f(K)=f(Xk+1,Yk+1/2)
If fk<0 ,the mid-point is below the line, so next
pixel(Xk+1,Yk)
If fk>0 , the mid-point is above the line, so next
pixel will be (Xk+1,Yk+1)
{
setpixel(x,y);
if(F<0)
F=F+h;
else
{F=F+h-w;
y++;
}
Bresenham algorithm