C Program To Generate Line Using Dda Algorithm

Posted on by admin

Aug 15, 2013 see-programming is a popular blog that. C program to implement dda line drawing. Write a C program to implement DDA line drawing algorithm. Nov 15, 2014 Implementation of DDA line drawing algorithm. /* Keep displaying untill the program is. Merge Sort Using Recursion in C; Implementation of DDA line.

C Program To Generate Line Using Dda AlgorithmProgram To Draw A Line Using Dda Algorithm

Here are some flaws in the current algorithm. • xdiff will have a roundoff error if x1-x2 is large in magnitude, likewise for the y variables. • slope is set to 1 for no reason, and then immediately reinitialized to something else. • slope is restricted to an integer, when most slopes will not be integral.

• It's impossible to justify setting the slope of a vertical line to 2. There are slopes greater than 2 that are not vertical lines. Of Microsoft Ppsspp Games Apk on this page. • In the line slope = (int)xdiff/ydiff;, casting is higher precedence than division, so this will first cast xdiff to an int, overflowing if xdiff >MAXINT, throwing away the fractional part if there is one, then dividing this int by ydiff. The odds of this being the actual slope are very small.

• startx and endx are initialized to 0 for no reason, then immediately reinitialized to somethiing else. • Roundoff errors will accumulate as you repeatedly add slope to y (or 1/slope to x). • What's the justification for the abs(y)?

If y changes sign in the range, this will cause a kink in the line. Similarly for x.