Bresenham’s algorithm

$30.00

Category: You will Instantly receive a download link for .zip solution file upon Payment || To Order Original Work Click Custom Order?

Description

5/5 - (2 votes)

Problem Statement:
4.1 Replace the drawLine method based on Bresenham’s algorithm and
listed near the end of Section 4.1 with an even faster version that
benefits from the symmetry of the two halves of the line. For example,
with endpoints P and Q satisfying Equation (4.1), and using the integer
value xMid halfway between xP and xQ, we can let the variable x run from xp
to xMid and also use a variable x2, which at the same time runs backward
from xQ to xMid. In each iteration of the loop, x is increased by 1 and x2 is
decreased by 1. Note that there will be either one point or two points in
the middle of the line, depending on the number of pixels to be plotted
being odd or even. Be sure that no pixel of the line is omitted and that no
pixel is put twice on the screen. To test the latter, you can use XOR
mode so that writing the same pixel twice would have the same effect as
omitting a pixel.