835 words - 4 pages

* Midpoint Algorithm for the line of 1<m<∞

| | |

M1N pixel | M2NE pixel | |

M | | |

The equation for the line

ax + by + c = 0 1

The equation for the M point:

d – Equation for the first midpoint

d = a(x+1/2) + b(y+1) + c

d = ax + by + c + a/2 + b

d = 0 + a/2 + b

d = a/2+b

×2

d = a + 2b 2

By substituting the value fora and b we will able to find the value of d.

If d > 0, then we will select the N (North) pixel

If d < 0, then we will select NE (Northeast) pixel

Then there are two possibilities to go the line through M1 or M2

Equation for the above two points; M1 and M2

M1:

d1 – Equation for the M1 midpoint

d1 = a(x+1/2) ...view middle of the document...

In the first scenario we can choose East pixel and SouthEast pixels

d = initial decision variable.

d = X2b2 + Y2a2 - a2b2

d= (x+1)2b2 +(y-1/2)2 - a2b2

d = x2b2 + y2a2 - a2b2 + 2b2x + b2 - a2y + a2/4

d = 0 + 2b2x + b2 - a2y + a2/4 ;Since at the beginning x =0 and y = b the equation finally would be like below.

d = b2 –a2b + a2/4 1

if d < 0 we choose E pixel

if d >= 0 we choose SE pixel.

If we consider d<0 ; next pixel is E,

de = X2b2 + Y2a2 - a2b2

de = (x+2)2b2 +(y-1/2)2 - a2b2

de = x2b2 + y2a2 - a2b2 + 4b2x + 4b2 - a2y + a2/4

de = 0 + 4b2x +4b2 - a2y + a2/4

de-d = (4b2x +4b2 - a2y + a2/4) –( 2b2x + b2 - a2y + a2/4)

de= 2b2x +3b2 + d 2

If we consider d >= 0 ; next pixel is SE,

dse = X2b2 + Y2a2 - a2b2

dse = (x+2)2b2 +(y-3/2)2 - a2b2

dse = x2b2 + y2a2 - a2b2 + 4b2x + 4b2 - 3a2y + 9a2/4

dse = 0 + 4b2x +4b2 - 3a2y + 9a2/4

dse-d = (4b2x +4b2 -3 a2y + 9a2/4) –( 2b2x + b2 - a2y + a2/4)

dse= 2b2x +3b2 -2a2y + 2 a2+ d

dse= b2 (2x+3) +a2(-2y + 2) + d 3

Scenario 2 -...

Beat writer's block and start your paper with the best examples