retagged by
5,778 views
5 votes
5 votes

Consider the Breshenman's circle generation algorithm for plotting a circle with centre (0,0) and radius 'r' unit in first quadrant. If the current point is $(x_i, y_i)$ and decision parameter is $p_i$ then what will be the next point $(x_{i+1}, y_{i+1})$ and updates decision parameter $p_{i+1}$ for $p \geq 0$?

  1. $x_{i+1}=x_i+1; y_{i+1}=y_i; p_{i+1}=p_i+4x_i+6$
  2. $x_{i+1}=x_i+1; y_{i+1}=y_i-1; p_{i+1}=p_i+4(x_i-y_i)+10$
  3. $x_{i+1}=x_i; y_{i+1}=y_i-1; p_{i+1}=p_i+4(x_i-y_i)+6$
  4. $x_{i+1}=x_i-1; y_{i+1}=y_i; p_{i+1}=p_i+4x_i+10$
retagged by

1 Answer

Best answer
3 votes
3 votes

ans is B 

 

below  D is the decision parameter (given as  Pi ,Pi+1 in the question )

another link 

Bresenham’s Algorithm

We cannot display a continuous arc on the raster display. Instead, we have to choose the nearest pixel position to complete the arc.

From the following illustration, you can see that we have put the pixel at (X, Y) location and now need to decide where to put the next pixel − at N (X+1, Y) or at S (X+1, Y-1).

Bresenham’s Algorithm

This can be decided by the decision parameter d.

  • If d <= 0, then N(X+1, Y) is to be chosen as next pixel.
  • If d > 0, then S(X+1, Y-1) is to be chosen as the next pixel.

Algorithm

Step 1 − Get the coordinates of the center of the circle and radius, and store them in x, y, and R respectively. Set P=0 and Q=R.

Step 2 − Set decision parameter D = 3 – 2R.

Step 3 − Repeat through step-8 while X < Y.

Step 4 − Call Draw Circle (X, Y, P, Q).

Step 5 − Increment the value of P.

Step 6 − If D < 0 then D = D + 4x + 6.

Step 7 − Else Set Y = Y - 1, D = D + 4(X-Y) + 10.

Step 8 − Call Draw Circle (X, Y, P, Q).

selected by
Answer:

Related questions

4 votes
4 votes
2 answers
4
Meenakshi Sharma asked Aug 13, 2016
9,239 views
A point P(5,1) is rotated by 90$^o$ about a pivot point (2,2). What is the coordinate of new transformed point P'?(3,5)(5,3)(2,4)(1,5)