Bresenham’s-Algorithm
December 26, 2024Bresenham’s-Algorithm
December 26, 2024Computer-Graphics
Question 7 |
Below are the few steps given for scan-converting a circle using Bresenham’s Algorithm. Which of the given steps is not correct ?
Compute d = 3 – 2r (where r is radius) | |
Stop if x > y | |
If d < 0, then d = 4x + 6 and x = x + 1 | |
If d ≥, then d = 4 * (x – y) + 10, x = x + 1 and y = y + 1 |
Question 7 Explanation:
Scan converting a circle using Bresenham’s algorithm:
1 Initially X = 0 , Y = R and D = 3 – 2R
1 Initially X = 0 , Y = R and D = 3 – 2R
2. While (X < Y)
3. Call Draw Circle(Xc, Yc, X, Y)
4. Set X = X + 1
5. If (D < 0) Then
6. D = D + 4X + 6
7. Else
8. Set Y = Y – 1
9. D = D + 4(X – Y) + 10
10. End If
11. Draw Circle(Xc, Yc, X, Y) /* calling function call */
12. End While
Correct Answer: D
Question 7 Explanation:
Scan converting a circle using Bresenham’s algorithm:
1 Initially X = 0 , Y = R and D = 3 – 2R
1 Initially X = 0 , Y = R and D = 3 – 2R
2. While (X < Y)
3. Call Draw Circle(Xc, Yc, X, Y)
4. Set X = X + 1
5. If (D < 0) Then
6. D = D + 4X + 6
7. Else
8. Set Y = Y – 1
9. D = D + 4(X – Y) + 10
10. End If
11. Draw Circle(Xc, Yc, X, Y) /* calling function call */
12. End While