Bitmap/Bresenham's line algorithm: Difference between revisions
Content added Content deleted
m (→{{header|REXX}}: addes REXX to the LANG html tag.) |
No edit summary |
||
Line 374: | Line 374: | ||
} |
} |
||
}</lang> |
}</lang> |
||
=={{header|AutoIt Script}}== |
|||
<lang AutoHotkey>Local $var = drawBresenhamLine(2, 3, 2, 6) |
|||
Func drawBresenhamLine($iX0, $iY0, $iX1, $iY1) |
|||
Local $iDx = Abs($iX1 - $iX0) |
|||
Local $iSx = $iX0 < $iX1 ? 1 : -1 |
|||
Local $iDy = Abs($iY1 - $iY0) |
|||
Local $iSy = $iY0 < $iY1 ? 1 : -1 |
|||
Local $iErr = ($iDx > $iDy ? $iDx : -$iDy) / 2, $e2 |
|||
While $iX0 <= $iX1 |
|||
ConsoleWrite("plot( $x=" & $iX0 & ", $y=" & $iY0 & " )" & @LF) |
|||
If ($iX0 = $iX1) And ($iY0 = $iY1) Then Return |
|||
$e2 = $iErr |
|||
If ($e2 > -$iDx) Then |
|||
$iErr -= $iDy |
|||
$iX0 += $iSx |
|||
EndIf |
|||
If ($e2 < $iDy) Then |
|||
$iErr += $iDx |
|||
$iY0 += $iSy |
|||
EndIf |
|||
WEnd |
|||
EndFunc ;==>drawBresenhamLine</lang> |
|||
=={{header|BASIC}}== |
=={{header|BASIC}}== |