Anda di halaman 1dari 1

Bresenhman Algo.

for line:

Step 1: Step 2:

Input (x1,y1) and (x2,y2). Compute dx=x2-x1 dy=y2-y1

Step 3: plot(x1,y1). Step 4: p=2dy-dx (decision parameter)

Step 5: if p < 0 Then plot(x+1,y) Compute p = p+2dy Else Plot(x+1,y+1) Compute p=p+2(dy-dx)

Step 6: Repeat the above step for dx no. of times.

Example:

Draw a line using Bresenhman Algorithm (3, 3) and (8, 5).

Anda mungkin juga menyukai