Knowee
Questions
Features
Study Tools

re Bresenham and DDA line drawing algorithm with suitable example.

Question

re Bresenham and DDA line drawing algorithm with suitable example.

🧐 Not the exact question you are looking for?Go ask a question

Solution

Bresenham's Line Drawing Algorithm and DDA (Digital Differential Analyzer) Line Drawing Algorithm are two popular algorithms used in computer graphics to draw lines.

  1. DDA Line Drawing Algorithm:

    • DDA stands for Digital Differential Analyzer.
    • DDA algorithm uses floating point arithmetic which makes it less efficient.
    • It is an incremental method.
    • It uses the concept of the differential equation to draw a line.
    • It is not accurate as it deals with real numbers.
    • It is less efficient because it involves round off operations as well as floating point operations.

    Example: Let's draw a line from point (2, 2) to point (8, 10)

    • The difference in x coordinates, dx = 8 - 2 = 6
    • The difference in y coordinates, dy = 10 - 2 = 8
    • Since dy > dx, we increment y. The number of steps = dy = 8
    • The x increment = dx / dy = 6 / 8 = 0.75
    • Now we start from (2, 2) and in each step, increment x by 0.75 and y by 1, rounding off the x value.
  2. Bresenham's Line Drawing Algorithm:

    • Bresenham's algorithm uses only integer arithmetic which makes it more efficient.
    • It is also an incremental method.
    • It uses the concept of decision parameter to decide the next pixel.
    • It is more accurate as it deals with integers.
    • It is more efficient because it involves only addition and subtraction operations.

    Example: Let's draw a line from point (2, 2) to point (8, 10)

    • The difference in x coordinates, dx = 8 - 2 = 6
    • The difference in y coordinates, dy = 10 - 2 = 8
    • Since dy > dx, we increment y. The decision parameter, p = 2dx - dy = 2*6 - 8 = 4
    • Now we start from (2, 2) and in each step, increment y by 1. If p < 0, increment p by 2dx. If p >= 0, increment x by 1 and p by 2dx - 2dy.

In conclusion, Bresenham's algorithm is more efficient and accurate for line drawing in computer graphics.

This problem has been solved

Similar Questions

Bresenham’s Line Generation Algorithm

Explain with suitable example, Bresenham’s line algorithm

Write Advantages and disadvantages of Bresenham’s line algorithm

Which of the following algorithm is a faster method for calculating pixel positions?A.Mid-point algorithmB.Bresenham’s line algorithmC.Parallel line algorithmD.DDA line algorithm

Bresanham circle algorithm uses the approach ofMidpointPointLineNone of theseView answer

1/3

Upgrade your grade with Knowee

Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.