answersLogoWhite
Computers
Computer Programming
C Programming

DDA line algorithm?


Top Answer
User Avatar
Wiki User
Answered 2009-09-17 15:00:51

DDA Line Drawing Algorithm

Step 1:[Determine The Dx & Dy]

Dx=Xb-Xa

Dy=Yb-Ya

Step 2:[Determine Slope is Gentle or Sharp]

If |Dx|>|Dy| then

Gentle Slope

M=Dy/Dx

Set The Starting Point

If Dx>0 Then

C=CELING(Xb)

D=Yb+M*(C-Xb)

F=FLOOR(Xa)

R=FLOOR(D+0.5)

H=R-D+M

IF M>0 Then

Positive Gentle Slope

M1=M-1

Now Step Through The Columns

WHILE C<=F

C Programming Coding For DDA Algorithm
void linedda(int xa,int ya,int xb,int yb) {

int dx=xb-xa,dy=yb-ya,steps,k;
float xincrement,yincrement,x=xa,y=ya;

if(abs(dx)>abs(dy)) steps=abs(dx);
else steps=abs(dy);

xincrement=dx/(float)steps;
yincrement=dy/(float)steps;

putpixel(round(x),round(y),2)

for(k=0;kx+=xincrement;
y+=yincrement;
putpixel(round(x),round(y),2);
}
}
More Informationhttp://knol.Google.com/k/thiyagaraaj-m/dda-line-algorithm/1lfp8o9xxpx13/78#
http://i.thiyagaraaj.com/articles/articles/dda-line-algorithm
001
๐Ÿ™
0
๐Ÿคจ
0
๐Ÿ˜ฎ
0
๐Ÿ˜‚
0
User Avatar

Your Answer

Loading...

Still Have Questions?

Related Questions

Which modifications are necessary to generate dda dotted line code from dda algorithm?

What is the advantage of bresenham algorithm over dda algorithm?Read more: What_is_the_advantage_of_bresenham_algorithm_over_dda_algorithm


Which line drawing algorithm is better dda or bresenhams?

Bresenhams' algorithm is better


What is the limitation of DDA line generation algorithm?

yes


What is the difference between Bresenham's line algorithm and dda line algorithms?

dda is not much efficient whereas bresnham algothm is much efficient than dda.


Line drawing algorithm in c language?

dda algorithm,bresenham's algorithm,midpoint algorithm..These are the few that are useful in my opinion.


Make a comparison between Bresenham and DDA line drawing algorithms?

Difference Between DDA and Bresenham Algorithm&bull; DDA uses floating points where as Bresenham algorithm use fixed points.&bull; DDA round off the coordinates to nearest integer but Bresenham algorithm does not.&bull; Bresenham algorithm is much accurate and efficient than DDA.&bull; Bresenham algorithm can draw circles and curves with much more accuracy than DDA.&bull; DDA uses multiplication and division of equation but Bresenham algorithm uses subtraction and addition only.


Difference between simple and symmetrical dda line drawing algorithm?

"Simple DDA" does not require special skills for implementation.


Implement DDa line drawing algorithm using c language?

automobile programming language implementation by algorithm


DDA Algorithm Explanation?

DDA is one of the algorithms used to draw lines via linear interpolation of variables in computer graphics. DDA stands for Digital Differential Analyzer.


Advantages of DDA line drawing algorithm?

Advantages of DDA Algorithm:1. It is the simplest algorithm and it does not require special skills for implementation.2. It is a faster method for calculating pixel positions than the direct use of equation y=mx + b. It eliminates the multiplication in the equation by making use of raster characteristics, so that appropriate increments are applied in the x or y direction to find the pixel positions along the line path.


What are the advantages of bresenhams's line drawing algorithm over the cartesian slope ana ddadigitial defrantial analyser?

First off, DDA uses float numbers and operators. While Bresenham's line drawing algorithm uses ints and only additions and subtraction.


What is the advantage of bresenham algorithm over dda algorithm?

DDA uses float numbers and uses operators such as division and multiplication in its calculation. Bresgenham's algorithm uses ints and only uses addition and subtraction. Due to the use of only addition subtraction and bit shifting (multiplication and division use more resources and processor power) bresenhams algorithm is faster than DDA in producing the line. Im not sure, though if i remember right, they still produce the same line in the end. One note concerning efficiency: Fixed point DDA algorithms are generally superior to Bresenhams algorithm on modern computers. The reason is that Bresenhams algorithm uses a conditional branch in the loop, and this results in frequent branch mispredictions in the CPU. Fixed point DDA also has fewer instructions in the loop body (one bit shift, one increment and one addition to be exact. In addition to the loop instructions and the actual plotting). As CPU pipelines become deeper, mispredictions penalties will become more severe. Since DDA uses rounding off of the pixel position obtained by multiplication or division, causes an accumulation of error in the proceeding pixels whereas in Bresenhams line algorithm the new pixel is calculated with a small unit change in one direction and checking of nearest pixel with the decision variable satisfying the line equation.


Difference between DDA and Bresenham's line drawing algorithm?

DDA uses float numbers and uses operators such as division and multiplication in its calculation. Bresenhams algorithm uses ints and only uses addition and subtraction. Due to the use of only addition subtraction and bit shifting (multiplication and division use more resources and processor power) bresenhams algorithm is faster than DDA in producing the line. Im not sure, though if i remember right, they still produce the same line in the end. One note concerning efficiency: Fixed point DDA algorithms are generally superior to Bresenhams algorithm on modern computers. The reason is that Bresenhams algorithm uses a conditional branch in the loop, and this results in frequent branch mispredictions in the CPU. Fixed point DDA also has fewer instructions in the loop body (one bit shift, one increment and one addition to be exact. In addition to the loop instructions and the actual plotting). As CPU pipelines become deeper, mispredictions penalties will become more Severe.


Disadvantages of DDA line drawing algorithm?

1.It drift away from the actual line path because of rounding off float values to integer2.It causes jaggies or stair-step effect----------------------------------------------------------------------------------------------------------------Disadvantage:The accumulation of round of error is successive addition of the floating point increments is used to find the pixel position but it take lot of time to compute the pixel position. ----------------------------------------------------------------------------------------------------------------More Informationhttp://knol.google.com/k/thiyagaraaj-m/dda-line-algorithm/1lfp8o9xxpx13/78# http://i.thiyagaraaj.com/articles/articles/dda-line-algorithm----------------------------------------------------------------------------------------------------------------the standard version of dda given as in one of its steps asif(abs(dx)>abs(dy)) steps=abs(dx);else steps=abs(dy);this part just supports the positive slop with starting point on left side. Take an example of any other end points as {(8,3) to (2,2) or (4,5) to ( 8,2) or (8,3) to (5,5) } where the slop needs to be negative( for the last two cases) only.can anyone correct me by suggesting the accurate version of DDA? Or is this the actual DDA??.


DDA line algorithm to be executed in C?

C Programming Coding For DDA Algorithmvoid linedda(int xa,int ya,int xb,int yb) {int dx=xb-xa,dy=yb-ya,steps,k;float xincrement,yincrement,x=xa,y=ya;if(abs(dx)>abs(dy)) steps=abs(dx);else steps=abs(dy);xincrement=dx/(float)steps;yincrement=dy/(float)steps;putpixel(round(x),round(y),2)for(k=0;kx+=xincrement;y+=yincrement;putpixel(round(x),round(y),2);}}More Informationhttp://knol.google.com/k/thiyagaraaj-m/dda-line-algorithm/1lfp8o9xxpx13/78#http://i.thiyagaraaj.com/articles/articles/dda-line-algorithm


Use dda line algorithm in c create?

C Programming Coding For DDA Algorithmvoid linedda(int xa,int ya,int xb,int yb) {int dx=xb-xa,dy=yb-ya,steps,k;float xincrement,yincrement,x=xa,y=ya;if(abs(dx)>abs(dy)) steps=abs(dx);else steps=abs(dy);xincrement=dx/(float)steps;yincrement=dy/(float)steps;putpixel(round(x),round(y),2)for(k=0;kx+=xincrement;y+=yincrement;putpixel(round(x),round(y),2);}}More Informationhttp://knol.google.com/k/thiyagaraaj-m/dda-line-algorithm/1lfp8o9xxpx13/78#http://i.thiyagaraaj.com/articles/articles/dda-line-algorithm


C program for dda algorithm?

ygfgdcvhg jhc bcjhfdhvchv jchvhd bfg vuj uukyhikyhkhg hjhikfdhkh kjhkjh


What is dda algorithm?

digital differential analyzer is a scan conversion incrementing line drawing algorithmwhich is based on calculating either delta x or delta y. increment along one axisi.e either along x or y is set to unity and along other axis is calculated dependingon the slope of line...by-sweet n gorgeous gal...


Differences between digital differential analyzer and bresenham algorithm?

AnswerDDA uses float numbers and uses operators such as division and multiplication in its calculation. Bresenhams algorithm uses ints and only uses addition and subtraction. Due to the use of only addition subtraction and bit shifting (multiplication and division use more resources and processor power) bresenhams algorithm is faster than DDA in producing the line. Im not sure, though if i remember right, they still produce the same line in the end.One note concerning efficiency: Fixed point DDA algorithms are generally superior to Bresenhams algorithm on modern computers. The reason is that Bresenhams algorithm uses a conditional branch in the loop, and this results in frequent branch mispredictions in the CPU. Fixed point DDA also has fewer instructions in the loop body (one bit shift, one increment and one addition to be exact. In addition to the loop instructions and the actual plotting). As CPU pipelines become deeper, mispredictions penalties will become more severe.Since DDA uses rounding off of the pixel position obtained by multiplication or division, causes an accumulation of error in the proceeding pixels whereas in Bresenhams line algorithm the new pixel is calculated with a small unit change in one direction and checking of nearest pixel with the decision variable satisfying the line equation.BUT this error can be calculated and will not cause problems for typical line drawing applications. Lines longer than what fits on a typical computer screen (a few thousand pixels) will be identical to Bresenham lines when using 32 bit integers. Fixed point DDA also has another advantage: Since it does not require conditional jumps, you can compute several lines in parallel with SIMD (Single Instruction Multiple Data) techniques.


Write a program to draw a polygon using dda algorithm in c language?

You will need to have some computer knowledge to start this. You can find some examples to help out online.


What is simple dda?

DDA stands for Digital Differential Analyzer. With that in mind, simple DDA just means that it is simplified.


Disadvantages of DDA algorithm?

1. Division logic is needed which switches it towards hardware logic. 2. Floor integer values are used in place of normal integer values which may different result. 3. Floating point arithmetic is needed thus it is line consuming


When did Hywel Dda die?

Hywel Dda died in 950.


How do you find your dda number?

were is the dda number on a check


What are DDA responsible for?

The DDA is responsible for ensuring that disabled people are not discriminated against in the workplace, school, or housing. DDA stands for Disability Discrimination Act.