Computer graphics – bresenham line drawing algorithm DERIVATION • Starting from the left endpoint (x0, y0) of a given line, we step to each. Assumption: Y=mX+b where b is the intercept cut by line at Y axis and m is the slope of line (0 Derivation: Initially we have plotted a. To derive Bresenham’s algorithm, two steps must be taken. and then using this new equation for a line to draw a line based on the.
|Published (Last):||14 January 2007|
|PDF File Size:||9.32 Mb|
|ePub File Size:||14.64 Mb|
|Price:||Free* [*Free Regsitration Required]|
This algorithm was developed to draw lines on digital plotters, but has found wide-spread usage in computer graphics.
The algorithm is fast — it can be implemented with integer calculations only — and very simple to describe. Consider a line with initial point x1y1 and terminal point x2y2 in device space.
Bresenham’s line algorithm
Within the main loop of the algorithm, the coordinate corresponding to the DA is incremented by one unit. The coordinate corresponding to the other axis usually denoted the passive axis or PA is only incremented as needed. The choice for the start point is purely arbitrary, it can be either of X1,Y1 and X2,Y2 points. These pixels represent the one just to the right and the one to the right and one up pixel, respectively as shown.
derivation of bresenham line algorithm | Saloni Baweja
To find the best “next pixel”, first we must find the distances to the two available choices from the ideal location of the real line. Distance between pixel-to-right and ideal pixel is:.
In order to develop a fast way of doing this, we will not be comparing these values in such a manner, instead we will create a decision variable that can be used to quickly determine pine point to use.
Instead of comparing the two values to each other, we can simply evaluate d1-d2 and test the sign to determine which to choose. Note that the underlined part is constant it does not change during iterationdrawibg call it c, i.
Note that the loop will only include integer arithmetic. There are now 6 multiplications, two additions and one selection in each turn of the loop. However, we can do better than breeenham, by defining pi recursively.
Therefore the final recursive definition for pi defivation be based on choice, as follows remember that the sign of pi is the same as the sign of d1 — d At this stage the basic algorithm is defined. We only need to calculate the initial value for parameter pi. Skip to content Home Posts tagged ‘derivation of bresenham line algorithm’.
CoolTech: Derivation of BRESENHAM’S Line Drawing Algorithm.
Fig-3 To find the best “next pixel”, first we must find the distances to the two available choices from algoritnm ideal location of the real line. Distance between pixel-to-right and ideal pixel is: If d1-d2 is negative or zero, we will choose pixel-to-right.
To find out more, including how to control cookies, see here: