Bitmap/Bresenham's line algorithm: Difference between revisions
m
→ksh: fix category
m (→ksh: fix category) |
|||
Line 2,412:
Gray{Float64}(255.0) Gray{Float64}(255.0) Gray{Float64}(255.0) Gray{Float64}(0.0) Gray{Float64}(255.0)
Gray{Float64}(255.0) Gray{Float64}(255.0) Gray{Float64}(255.0) Gray{Float64}(255.0) Gray{Float64}(0.0) </pre>
=={{header|Korn Shell}}==▼
<syntaxhighlight lang="
typeset x0=$1
if ((
then
((dx = x0 - x1)); ((sx = -1))
Line 2,424:
fi
if ((
then
((dy = y0 - y1)); ((sy = -1))
Line 2,431:
fi
if ((
then
((err = dx))
Line 2,439:
((err /= 2)); ((e2 = 0))
while
do
echo $x0 $y0
((
((e2 = err))
((
((
done
}</syntaxhighlight>
▲Output from the statement:-
line 0 0 3 4
(which could be piped to another program)
<pre>0 0
1 1
1 2
2 3
3 4</
=={{header|Lua}}==
{{trans|C}}
|