Page namespace (page_namespace ) | 0 |
Page title without namespace (page_title ) | 'Digital differential analyzer (graphics algorithm)' |
Full page title (page_prefixedtitle ) | 'Digital differential analyzer (graphics algorithm)' |
Last ten users to contribute to the page (page_recent_contributors ) | [
0 => 'Widr',
1 => '122.173.230.111',
2 => '203.147.88.194',
3 => '59.180.8.241',
4 => 'Hgilbert',
5 => 'Kamal0807',
6 => 'Ijon',
7 => '61.16.194.18',
8 => 'Dicklyon',
9 => '27.4.168.190'
] |
Old page wikitext, before the edit (old_wikitext ) | '{{About|a graphics algorithm|the digital implementation of a Differential Analyzer|Digital Differential Analyzer}}
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 [(x<sub>start</sub>, y<sub>start</sub>), (x<sub>end</sub>, y<sub>end</sub>)] by computing for each x<sub>i</sub> the equations x<sub>i</sub> = x<sub>i−1</sub>+1/m, y<sub>i</sub> = y<sub>i−1</sub> + m, where Δx = x<sub>end</sub> − x<sub>start</sub> and Δy = y<sub>end</sub> − y<sub>start</sub> and m = Δy/Δx
== 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 [[Floating-point unit|FPU]] with fast add and rounding operation is available.
The [[Fixed-point arithmetic|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 of the line and ''c'' is the y intercept . this slope can be expressed in DDA
as
: <math>m = \frac{y_{end} -y_{start}}{x_{end}-x_{start}}</math>
in fact any two consecutive point(x,y) laying on this line segment should satisfy the equation.
== Algorithm ==
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 positive 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.
y value is rounded off to nearest integer to correspond to a screen pixel.
For lines with slope greater than 1, we reverse the role of x and y i.e. we sample at dy=1 and calculate consecutive x values as
: <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.
== See also ==
* [[Bresenham's line algorithm]] is an algorithm for line rendering.
* [[Xiaolin Wu's line algorithm]] is an algorithm for line anti-aliasing
== References ==
{{citations|date=June 2011}}
<references/>
* Alan Watt: ''3D Computer Graphics'', 3rd edition 2000, p. 184 (Rasterizing edges). ISBN 0-201-39855-9
[[Category:Computer graphics algorithms]]
[[Category:Digital geometry]]
[[Category:Articles with example C code]]' |
New page wikitext, after the edit (new_wikitext ) | '{{About|a graphics algorithm|the digital implementation of a Differential Analyzer|Digital Differential Analyzer}}
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 [(x<sub>start</sub>, y<sub>start</sub>), (x<sub>end</sub>, y<sub>end</sub>)] by computing for each x<sub>i</sub> the equations x<sub>i</sub> = x<sub>i−1</sub>+1/m, y<sub>i</sub> = y<sub>i−1</sub> + m, where Δx = x<sub>end</sub> − x<sub>start</sub> and Δy = y<sub>end</sub> − y<sub>start</sub> and m = Δy/Δx
== 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 [[Floating-point unit|FPU]] with fast add and rounding operation is available.
The [[Fixed-point arithmetic|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 of the line and ''c'' is the y intercept . this slope can be expressed in DDA
as
: <math>m = \frac{y_{end} -y_{start}}{x_{end}-x_{start}}</math>
in fact any two consecutive point(x,y) laying on this line segment should satisfy the equation.
== Algorithm ==
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 positive 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.
y value is rounded off to nearest integer to correspond to a screen pixel.
fuck off u bitch bloody ass hole in the earth
For lines with slope greater than 1, we reverse the role of x and y i.e. we sample at dy=1 and calculate consecutive x values as
: <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.
== See also ==
* [[Bresenham's line algorithm]] is an algorithm for line rendering.
* [[Xiaolin Wu's line algorithm]] is an algorithm for line anti-aliasing
== References ==
{{citations|date=June 2011}}
<references/>
* Alan Watt: ''3D Computer Graphics'', 3rd edition 2000, p. 184 (Rasterizing edges). ISBN 0-201-39855-9
[[Category:Computer graphics algorithms]]
[[Category:Digital geometry]]
[[Category:Articles with example C code]]' |
Unified diff of changes made by edit (edit_diff ) | '@@ -22,7 +22,7 @@
: <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.
y value is rounded off to nearest integer to correspond to a screen pixel.
-
+fuck off u bitch bloody ass hole in the earth
For lines with slope greater than 1, we reverse the role of x and y i.e. we sample at dy=1 and calculate consecutive x values as
: <math>x_{k+1} = x_k + \frac{1}{m}</math>
' |