Knowee
Questions
Features
Study Tools

Given a line AB from (3,3) to (14,20). Plot all possible points using Bresenham linedrawing algorithm.

Question

Given a line AB from (3,3) to (14,20).

Plot all possible points using Bresenham linedrawing algorithm.

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

Solution

The Bresenham line algorithm is an algorithm that determines the points of an n-dimensional raster that should be selected in order to form a close approximation to a straight line between two points. Here's how you can use it to plot all possible points from (3,3) to (14,20):

  1. Start from the point (3,3). This is your initial point.

  2. Calculate the difference in x and y coordinates. dx = 14 - 3 = 11 dy = 20 - 3 = 17

  3. Determine the steps. The steps are equal to the absolute difference in dx and dy. In this case, steps = 17 as it is greater than 11.

  4. Calculate the initial decision parameter (p) as follows: p = 2dx - dy = 211 - 17 = 5

  5. Initialize x and y as the starting point coordinates (3,3).

  6. For each step from 0 to 17, do the following:

    • Plot the point (x, y).
    • If p < 0, then the next point to plot is (x, y+1) and p = p + 2*dx.
    • If p >= 0, then the next point to plot is (x+1, y+1) and p = p + 2dx - 2dy.
    • Increment y by 1 for the next iteration.
  7. Repeat step 6 until you reach the point (14,20).

By following these steps, you will have plotted all possible points from (3,3) to (14,20) using the Bresenham line drawing algorithm.

This problem has been solved

Similar Questions

Bresanham circle algorithm uses the approach ofMidpointPointLineNone of theseView answer

Derive the formula for initial decision parameter of Bresenham’s Line Drawingalgorithm.

If the point P (2, 1) lies on the line segment joining points A (4, 2) and B (8, 4),then(A) AP = 13 AB (B) AP = PB (C) PB = 13 AB (D) AP = 12 AB

Find the midpoint of a segment AB is (5, 3).  What is the missing coordinates.  A = (2, 5) and B = (8, y)Group of answer choicesy = 3y = -2y = 1y = 5

A line passes through the points (–2,–1) and (19,14). Write its equation in slope-intercept form.

1/1

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.