## Symmetrical DDA !

Symmetrical DDA (digital differential analyzer) generates lines from their differential equations. It is important to note that DDAs can also be used to generate arcs and other curves.

We know that the differential equation of a straight line is Dxf(x)=c or dy/dx=c if a variable y represents f(x). If we replace dy/dx by deltay/deltax (change in y over the change in x) the relation still holds true. The quotient of the increments must be equal to the line's slope (or its derivative). So for example if we have f(x)=3x+5, then Dxf(x)=3, which we know to be the slope of the line also. With this in mind, the DDA works on the principle that given a starting point (x,y), x and y are incremented by small steps proportional to deltax and deltay until we get to the end point in which case the DDA terminates. So in general, given a start point and end point we can generate a line by proceeding as follows:

1).Calculate the derivative

2).Chose incremental values for deltax and deltay

3).Plot the first point (start point)

4).Increment x by deltax

5).Increment y by deltay

6).Do some kind of rounding since the coordinates might not be integral

7).Plot this pixel

Basically we proceed in this fashion. In general we have:

1).Xn+1 = Xn + deltax

2).Yn+1 = Yn + deltay

3).Plot_pixel(round(Xn+1),round(Yn+1))

Notice that the exact points are the nonrounded points but due to the noninfinite nature of the display, we plot the rounded (integral) points. In the case of an infinite precision display, we could generate a line by incrementing x by some e(deltax) and y by some e(deltay) where e is epsilon and is some small quantity. Visually, we have the following: