Dda Circle Drawing Algorithm in Computer Graphics Ppt

bresenham circle drawing algorithm n.
Download

Skip this Video

Loading SlideShow in 5 Seconds..

Bresenham Circle Drawing Algorithm, PowerPoint Presentation

Bresenham Circle Drawing Algorithm,

Download Presentation

Bresenham Circumvolve Cartoon Algorithm,

- - - - - - - - - - - - - - - - - - - - - - - - - - - E Northward D - - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript

  1. BresenhamCircle Cartoon Algorithm,

  2. Contents • In today'due south lecture we'll have a look at: • Bresenham's Circumvolve drawing algorithm • Practice using Bresenham'due south algorithm

  3. Circle • The set of points that are all at a given distance 'r' from a center position (Xc,Yc).

  4. A Unproblematic Circle Cartoon Algorithm • The equation for a circumvolve is: • where r is the radius of the circumvolve • So, we can write a simple circle drawing algorithm by solving the equation for y at unit x intervals using:

  5. A Simple Circle Drawing Algorithm (cont…)

  6. A Uncomplicated Circumvolve Drawing Algorithm (cont…) • All the same, unsurprisingly this is non a brilliant solution! • Firstly, the resulting circle has large gaps where the slope approaches the vertical • Secondly, the calculations are not very efficient • The square (multiply) operations • The square root performance – try really difficult to avert these! • We demand a more efficient, more authentic solution

  7. 8-Mode Symmetry (-x, y) (ten, y) (-y, x) (y, 10) (-y, -x) (y, -x) (-x, -y) (x, -y) • The beginning affair nosotros can detect to brand our circle drawing algorithm more efficient is that circles centred at (0, 0) accept viii-way symmetry

  8. Mid-Betoken Circle Algorithm • Similarly to the case with lines, in that location is an incremental algorithm for drawing circles – the mid-point circumvolve algorithm • In the mid-point circle algorithm we apply eight-way symmetry so only e'er calculate the points for the top right 8th of a circle, and and so use symmetry to get the rest of the points The mid-betoken circle algorithm was developed by Jack Bresenham, who we heard virtually earlier.

  9. Mid-Point Circle Algorithm (cont…) (xk+1, yk) (xk, yk) (xk+ane, yk-1) • Assume that we take merely plotted indicate (xk, yk) • The side by side point is a choice between (xk+i, yk) and (xk+1, yk-1) • We would like to choose the signal that is nearest to the actual circumvolve • So how practice nosotros brand this choice?

  10. Mid-Indicate Circle Algorithm (cont…) • Let'south re-jig the equation of the circumvolve slightly to give us: • …(one) • The equation evaluates as follows: • By evaluating this role at the midpoint between the candidate pixels nosotros can make our decision

  11. Mid-Point Circumvolve Algorithm (cont…) • Bold we take just plotted the pixel at (xk,yk) so we need to choose betwixt (xk+1,yk) and (xk+ane,yk-1) • Our decision variable tin be divers every bit:mid point b/w 2 points (xk+1,Yk) and (Xk+1, Yk-1) is [xk+1, yk-1/2] • ...two • If pk < 0 the midpoint is within the circumvolve and the pixel at yk is closer to the circle • Otherwise the midpoint is exterior and yk-one is closer

  12. Mid-Point Circumvolve Algorithm (cont…) • To ensure things are as efficient as possible we tin do all of our calculations incrementally • Beginning consider: ( since Xk+1 = Xk+one) • or: • where yk+1 is either yk or yk-i depending on the sign of pk

  13. the initial value of Pk is given by the circumvolve function at the position (0,r) every bit, • Substituting k=0,Xk=0,Yk=r in the above part results in,

  14. Mid-Bespeak Circumvolve Algorithm (cont…) • The get-go determination variable is given as: • if r is an integer, and so Po can be rounded to P0= 1 – r. • Then if pk < 0 then the next decision variable is given as: • If pk > 0 then the decision variable is:

  15. The Mid-Point Circle Algorithm • MID-Point CIRCLE ALGORITHM • Input radius r and circumvolve centre (xc, yc), then set the coordinates for the commencement point on the circumference of a circle centred on the origin every bit: • Calculate the initial value of the decision parameter as: • Perform the test, Starting with k = 0 at each position xk, perform the following test. • (i) If pk < 0, the next bespeak along the circle centred on (0, 0) is (xk+i, yk) and:

  16. The Mid-Point Circumvolve Algorithm (cont…) • (ii) If Pk >0 then the next signal along the circumvolve is (xk+ane, yk-1) and: • where = 2Xk+2 and = 2Yk – 2 • Identify the symmetry points in the other 7 octants • Move (ten, y) according to: • Echo steps iii to 5 until x >= y

  17. Mid-Bespeak Circle Algorithm Example • To meet the mid-point circumvolve algorithm in action lets use it to draw a circle centred at (0,0) with radius ten • Determine the positions forth the circle octant in the commencement quadrant from x=0 to x=y. • The intial value of the decision parameter is • P0 = 1-r = 1-10 = -9 • For circle centred on the coordinate origin, the initial point is (X0,Y0)=(0,10) and initial increment terms for calculating the decision parameters are • 2X0 =0 and 2Y0 = twenty

  18. K=0 and P0 = -9 (i,10) • (pk<0) • K=1, P1=P0+2Xk+i => -9+two(1)+ane =-9+iii=-half-dozen (2,ten) • Thousand=2, P2= P1 +2(ii)+one = -6+4+1 = -ane (3,10) • K=iii P3=P2+2(three)+i = -1+7= vi (4,9) • K=4 (Pk>0) • P4= P3+ii(4)+1-two(9) => half dozen+8+1-18 = -iii (5,9) • K=5 p5= p4+two(five)+1 => -iii+10+1 = 8 (half-dozen,eight) • 1000=6 p6=8+2(6)+ane-two(viii) => 8+12+1-xvi = five (vii,7) • K=7 p7= 6 (viii,6) • K=8 p8=xi (ix,five) • Thou=9 p9 =20 (10,four)

  19. Mid-Point Circumvolve Algorithm Case (cont…) 10 ix 8 seven 6 5 four 3 2 1 0 0 1 2 3 4 5 6 7 8 9 10

  20. Mid-Betoken Circle Algorithm Exercise • Use the mid-point circle algorithm to draw the circle centred at (0,0) with radius 15

  21. Mid-Indicate Circle Algorithm Instance (cont…) sixteen 15 14 13 12 eleven 10 9 8 seven half-dozen 5 iv 3 ii 1 0 11 12 13 14 15 16 0 1 2 3 iv v 6 7 eight nine ten

  22. Mid-Point Circumvolve Algorithm Summary • The key insights in the mid-point circle algorithm are: • Eight-way symmetry tin can hugely reduce the work in cartoon a circle • Moving in unit steps along the x axis at each indicate along the circle'south border we demand to choose between two possible y coordinates

  23. Mid-Point Circle Algorithm (cont…) vi 5 4 3 1 2 3 iv

  24. Mid-Point Circle Algorithm (cont…) vi v iv 3 1 2 three 4

  25. Mid-Point Circumvolve Algorithm (cont…) 6 G 5 4 3 ane 2 3 4

  26. Mid-Indicate Circle Algorithm (cont…) 6 G 5 4 three 1 two iii 4

  27. Mid-Point Circumvolve Algorithm (cont…) 6 M 5 4 iii 1 2 3 four

  28. Blank Grid

  29. Blank Grid

  30. Bare Filigree 10 ix 8 7 6 v 4 iii 2 1 0 0 1 ii 3 4 5 vi vii 8 9 10

  31. Blank Grid

tuttlewhichisatur.blogspot.com

Source: https://www.slideserve.com/happy/bresenham-circle-drawing-algorithm

0 Response to "Dda Circle Drawing Algorithm in Computer Graphics Ppt"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel