Professional Documents
Culture Documents
M1 N pixel
M2 NE pixel
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 = d1 = d1 = 2; d1= a+4 b 3 a(x+1/2) + b(y+2) + c ax + by + c + a/2 +2 b 0 + a/2 + 2b
M2 : d2 Equation for the M2 midpoint d1 = a(x+3/2) + b(y+2) + c d1 = ax + by + c +3 a/2 +2 b d1 = 2; d2 = 3a +4b 5 5 2; a + b = d2 d d2 = a + b + d 6 The equation of the M2 midpoint is d1 = a + b + d As mentioned above the algorithm chooses between N and NE pixels on the sign of the decision variable calculated in previous method. 0+ 3a/2 + 2b
Center of the ellipse (x,y) = (0,0) a = rx , b = r y The first point is considered from the origin (x,y) = (0,b)
The ellipse has 4 -fold symmetry, so that we have to consider of the ellipse to implement the algorithm. When we consider about the first region of the ellipse, m<0 In region 2 of the ellipse, m>0 Therefore we must find the point which changes the direction.
2b2x - 2a2y< 0 b2x - a2y< 0 2, b2x < a2y In this region, units steps at x direction.
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.
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 - Region 2:
>= 0
2b2x - 2a2y>= 0 b2x - a2y>= 0 b2x >= a2y In this region, units steps at y direction.
In the first scenario we can choose South pixel and SouthEast pixels d = initial decision variable. d = x2b2 + y2a2 - a2b2 d= (x+1/2)2b2 +(y-1)2 - a2b2 d = x2b2 + y2a2 - a2b2 + b2x + b2/4- 2a2y + a2 d = x b2 + b2/4- 2a2y + a24
If d< 0 , choose SE pixel. If the next pixel is SE, dse= x2b2 + y2a2 - a2b2 dse = (x+3/2)2b2 +(y-2)2 - a2b2 dse= x2b2 + y2a2 - a2b2 +6 b2x/2 + 9b2/4- 4a2y + 4a2 dse= 0 + 6 b2x/2 + 9b2/4- 4a2y + 4a2 dse - d= (3xb2 + 9b2/4- 4a2y + 4a2) (x b2 + b2/4- 2a2y + a2) dse - d= b2(2x+2) + a2(-2y+3) 5
ds = x2b2 + y2a2 - a2b2 ds = (x+1/2)2b2 +(y-2)2 - a2b2 ds= x2b2 + y2a2 - a2b2 +6 b2x/2 + 9b2/4- 4a2y + 4a2 ds = 0 + b2x + b2/4- 4a2y + 4a2 ds - d= (xb2 + b2/4- 4a2y + 4a2) (x b2 + b2/4- 2a2y + a2) ds= -2a2y+3a2+ d ds - d= a2(-2y+3) 6