Digital differential analyzer (graphics algorithm): Difference between revisions

Content deleted Content added
m Reverting possible vandalism by 112.133.203.58 to version by Mindmatrix. False positive? Report it. Thanks, ClueBot NG. (2030608) (Bot)
Line 19:
The DDA starts by calculating the smaller of dy or dx for a unit increment of the other. A line is then sampled at unit intervals in one coordinate and corresponding integer values nearest the line path are determined for the other coordinate.
 
Considering a line with equalpositive slope, if the slope is less than or equal to 1, we sample at unit x intervals (dx=1) and compute successive y values as
: <math>y_{k+1} = y_k + m</math>
Subscript k takes integer values starting from 0, for the 1st point and increases by 1 until endpoint is reached.
Line 27:
: <math>x_{k+1} = x_k + \frac{1}{m}</math>
 
Similar calculations are carried out to determine pixel positions along a line with negative slope. Thus, if the absolute value of the slope is less than 1, we set dx=1 if <math> x_{start}<x_{end}</math> i.e. the starting extreme point is at the left.hemant sethi teri maa ka loda saale gaandu....
 
== See also ==