Digital differential analyzer (graphics algorithm)

From Wikipedia, the free encyclopedia
Jump to: navigation, search

In computer graphics, a hardware or software implementation of a digital differential analyzer (DDA) is used for linear interpolation of variables over an interval between start and end point. DDAs are used for rasterization of lines, triangles and polygons. In its simplest implementation the DDA algorithm interpolates values in interval [(xstart, ystart), (xend, yend)] by computing for each xi the equations xi = xi−1+1/m, yi = yi−1 + m, where Δx = xend − xstart and Δy = yend − ystart and m = Δy/Δx

Contents

[edit] Performance

The DDA method can be implemented using floating-point or integer arithmetic. The native floating-point implementation requires one addition and one rounding operation per interpolated value (e.g. coordinate x, y, depth, color component etc.) and output result. This process is only efficient when an FPU with fast add and rounding operation is available.

The fixed-point integer operation requires two additions per output cycle, and in case of fractional part overflow, one additional increment and subtraction. The probability of fractional part overflows is proportional to the ratio m of the interpolated start/end values.

DDAs are well suited for hardware implementation and can be pipelined for maximized throughput.

where m represents the slope the line and c is the y intercept . this slope can be expressed in DDA as

      yend-ystart
  m= -----------   
      xend-xstart

in fact any two consecutive point(x,y) laying on this line segment should satisfy the equation.

[edit] Algorithm

Step 1: Read the end points of line

Step 2:

       dx=|x2-x1|
       dy=|y2-y1|

Step 3:

       if dx>=dy
       Length = dx
       else
       Length = dy
       End if

[edit] See also

[edit] References


[edit] Literature

  • Alan Watt: 3D Computer Graphics, 3rd edition 2000, p. 184 (Rasterizing edges). ISBN 0-201-39855-9
Personal tools
Namespaces
Variants
Actions
Navigation
Interaction
Toolbox
Print/export
Languages