Slideshare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our User Agreement and Privacy Policy.

Slideshare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our Privacy Policy and User Agreement for details.

Like this presentation? Why not share!

- Midpoint circle algo by Mohd Arif 24548 views
- Computer Graphics - Bresenham's lin... by Saikrishna Tanguturu 78050 views
- Bresenham circle by Taher Barodawala 25922 views
- Bresenham Line Drawing Algorithm by Mahesh Kodituwakku 8168 views
- Ellipses drawing algo. by Mohd Arif 20862 views
- Line drawing algo. by Mohd Arif 8987 views

No Downloads

Total views

2,687

On SlideShare

0

From Embeds

0

Number of Embeds

2

Shares

0

Downloads

70

Comments

0

Likes

1

No embeds

No notes for slide

- 1. Scan Converting a CircleA circle is a symmetric figure. Any circle generating algorithm can take advantage of the circle’s symmetry to plot eight points for each value that the algorithm calculates. Eight way symmetry is used by reflecting each calculated point around each 45 º axis.
- 2. y -y,x y,x-x,y x,y x-x,-y x,-y y,-x -y,-x
- 3. Scan Converting a Circle using Polynomialmethod:-This method defines a circle with secondorder polynomial equation y2 = r2 – x2where x, y = x & y coordinates, r = radiusWith this method, each x coordinate in thesector, from 90º to 45º, is found by steppingx from 0 to r / 2 , and each y coordinate is found byevaluating r2 – x2 for each step of x.
- 4. This is a very inefficient method, however, because for each point both x & r must be squared and subtracted from each other; then the square root of the result must be found. y P(x, r2 – x2 ) y r x 0 x
- 5. Scan Convert a Circle using trigonometricmethod:-This second method of defining a circle uses functions : x = r cos θ, y = r sin θ y P(r cos θ,r sin θ) r sin θ θ x r cos θ
- 6. θ = current angle, r = circle radius By this method θ is stepped from θ to π /4& each value of x & y is calculated.Computation of values of sin θ & cos θ arevery time consuming
- 7. Bresenham’s Circle AlgorithmWorking: If the eight-way symmetry of a circle isused to generate a circle, points will have to begenerated through 45º angle. And, if points aregenerated from 90º to 45º, moves will be made onlyin the +x and –y directions.If points are generated from 90º to 45º each new point closest to the true circle can be found by taking either of two actions:(1) Move in the x direction one unit or(2) Move in the x direction 1 unit & -ve y direction 1 unit.
- 8. y T (xi+1,yi) yi (xi+1,yi-1)yi -1 S r xi xi + 1 x
- 9. Assume that (xi, yi) are the coordinates of thelast scan-converted pixel upon entering step i.Let the distance from the origin to pixel T squared minus the distance to the true circle squared = D(T) = t2 – r2.And let the distance from the origin to pixel S squared minus the distance to the true circle squared = D(S) = s2 – r2.Coordinates of T are (xi +1, yi) S are (xi +1, yi – 1)
- 10. Following expressions can be developed:D(T) = (xi + 1)2 + yi2 – r2D(S) = (xi + 1)2 + (yi – 1)2 – r2 This function D provides a relativemeasurement of the distance from the centerof a pixel to the true circle. Since D(T) isalways +ve (T is outside the circle) & D(S)will always be –ve (S is inside the true circle),a decision variable di can be defined as:
- 11. di = D(T) – (-D(S)) = D(T) + D(S)Therefore, di = 2(xi + 1)2 + yi2 + (yi – 1)2 – 2r2When di<0, we have |D(T)|<|D(S)| and pixel Tis chosen.When di>0, we have |D(T)|>|D(S)| and pixel Sis selected. Decision variable for next step:di+1 = 2(xi+1 + 1)2 + yi+12 + (y i+1 – 1)2 – 2r2
- 12. Hence,di+1 – di = 2(xi+1 + 1)2 + yi+12 + (yi+1 – 1)2 - 2(xi + 1)2 - yi2 - (yi – 1)2Since xi+1 = xi + 1, we havedi+1 = di + 4xi + 2(yi+12 - yi2) – 2(yi+1 – yi) + 6If T is chosen pixel (meaning that di < 0) then yi+1 = yi and so di+1 = di + 4xi + 6If S is chosen (meaning that di > 0) then y i+1 = yi –1 and so di+1 = di + 4(xi-yi) + 10
- 13. Hence we havedi+1 = di + 4xi + 6 if di < 0 di + 4(xi-yi) + 10 if di > 0Finally, we set(0,r) to the starting pixel coordinates and compute d1 from the original definition of di: x = 0, y = rd1= 2(0 + 1)2 + r2 + (r-1)2 – 2r2 = 3 – 2r
- 14. Algorithm:For generating all the pixel coordinates in the90º to 45º octant that are needed when scan-converting a circle of radius r.(i) int x = 0, y = r, d = 3-2r(ii) while (x <= y) { setpixel(x,y) if (d < 0) d = d + 4x + 6
- 15. else { d = d + 4(x - y) + 10 y-- } x++}

No public clipboards found for this slide

×
### Save the most important slides with Clipping

Clipping is a handy way to collect and organize the most important slides from a presentation. You can keep your great finds in clipboards organized around topics.

Be the first to comment