Data update
This commit is contained in:
parent
5150844a7d
commit
4bb20c9b71
7735 changed files with 38060 additions and 199180 deletions
|
|
@ -1,40 +0,0 @@
|
|||
procedure Line (Picture : in out Image; Start, Stop : Point; Color : Pixel) is
|
||||
DX : constant Float := abs Float (Stop.X - Start.X);
|
||||
DY : constant Float := abs Float (Stop.Y - Start.Y);
|
||||
Err : Float;
|
||||
X : Positive := Start.X;
|
||||
Y : Positive := Start.Y;
|
||||
Step_X : Integer := 1;
|
||||
Step_Y : Integer := 1;
|
||||
begin
|
||||
if Start.X > Stop.X then
|
||||
Step_X := -1;
|
||||
end if;
|
||||
if Start.Y > Stop.Y then
|
||||
Step_Y := -1;
|
||||
end if;
|
||||
if DX > DY then
|
||||
Err := DX / 2.0;
|
||||
while X /= Stop.X loop
|
||||
Picture (X, Y) := Color;
|
||||
Err := Err - DY;
|
||||
if Err < 0.0 then
|
||||
Y := Y + Step_Y;
|
||||
Err := Err + DX;
|
||||
end if;
|
||||
X := X + Step_X;
|
||||
end loop;
|
||||
else
|
||||
Err := DY / 2.0;
|
||||
while Y /= Stop.Y loop
|
||||
Picture (X, Y) := Color;
|
||||
Err := Err - DX;
|
||||
if Err < 0.0 then
|
||||
X := X + Step_X;
|
||||
Err := Err + DY;
|
||||
end if;
|
||||
Y := Y + Step_Y;
|
||||
end loop;
|
||||
end if;
|
||||
Picture (X, Y) := Color; -- Ensure dots to be drawn
|
||||
end Line;
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
X : Image (1..16, 1..16);
|
||||
begin
|
||||
Fill (X, White);
|
||||
Line (X, ( 1, 8), ( 8,16), Black);
|
||||
Line (X, ( 8,16), (16, 8), Black);
|
||||
Line (X, (16, 8), ( 8, 1), Black);
|
||||
Line (X, ( 8, 1), ( 1, 8), Black);
|
||||
Print (X);
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
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
|
||||
|
|
@ -1,115 +0,0 @@
|
|||
include std/console.e
|
||||
include std/graphics.e
|
||||
include std/math.e
|
||||
|
||||
-- the new_image function and related code in the 25 or so
|
||||
-- lines below are from http://rosettacode.org/wiki/Basic_bitmap_storage#Euphoria
|
||||
-- as of friday, march 2, 2012
|
||||
|
||||
-- Some color constants:
|
||||
constant
|
||||
black = #000000,
|
||||
white = #FFFFFF,
|
||||
red = #FF0000,
|
||||
green = #00FF00,
|
||||
blue = #0000FF
|
||||
|
||||
-- Create new image filled with some color
|
||||
function new_image(integer width, integer height, atom fill_color)
|
||||
return repeat(repeat(fill_color,height),width)
|
||||
end function
|
||||
|
||||
--grid used for drawing lines in this program
|
||||
sequence screenData = new_image(16,16,black)
|
||||
|
||||
--the line algorithm
|
||||
function bresLine(sequence screenData, integer x0, integer y0, integer x1, integer y1, integer color)
|
||||
|
||||
integer deltaX = abs(x1 - x0), deltaY = abs(y1 - y0)
|
||||
integer stepX, stepY, lineError, error2
|
||||
|
||||
if x0 < x1 then
|
||||
stepX = 1
|
||||
else
|
||||
stepX = -1
|
||||
end if
|
||||
|
||||
if y0 < y1 then
|
||||
stepY = 1
|
||||
else
|
||||
stepY = -1
|
||||
end if
|
||||
|
||||
if deltaX > deltaY then
|
||||
lineError = deltaX
|
||||
else
|
||||
lineError = -deltaY
|
||||
end if
|
||||
|
||||
lineError = round(lineError / 2, 1)
|
||||
|
||||
while 1 do
|
||||
|
||||
screenData[x0][y0] = color
|
||||
|
||||
if (x0 = x1 and y0 = y1) then
|
||||
exit
|
||||
end if
|
||||
|
||||
error2 = lineError
|
||||
|
||||
if error2 > -deltaX then
|
||||
lineError -= deltaY
|
||||
x0 += stepX
|
||||
end if
|
||||
if error2 < deltaY then
|
||||
lineError += deltaX
|
||||
y0 += stepY
|
||||
end if
|
||||
end while
|
||||
return screenData -- return modified version of the screenData sequence
|
||||
end function
|
||||
|
||||
--prevents console output wrapping to next line if it is too big for the screen
|
||||
wrap(0)
|
||||
--outer diamond
|
||||
screenData = bresLine(screenData,8,1,16,8,white)
|
||||
screenData = bresLine(screenData,16,8,8,16,white)
|
||||
screenData = bresLine(screenData,8,16,1,8,white)
|
||||
screenData = bresLine(screenData,1,8,8,1,white)
|
||||
--inner diamond
|
||||
screenData = bresLine(screenData,8,4,12,8,white)
|
||||
screenData = bresLine(screenData,12,8,8,12,white)
|
||||
screenData = bresLine(screenData,8,12,4,8,white)
|
||||
screenData = bresLine(screenData,4,8,8,4,white)
|
||||
-- center lines drawing from left to right, and the next from right to left.
|
||||
screenData = bresLine(screenData,7,7,9,7,white)
|
||||
screenData = bresLine(screenData,9,9,7,9,white)
|
||||
--center dot
|
||||
screenData = bresLine(screenData,8,8,8,8,white)
|
||||
|
||||
--print to the standard console output
|
||||
for i = 1 to 16 do
|
||||
puts(1,"\n")
|
||||
for j = 1 to 16 do
|
||||
if screenData[j][i] = black then
|
||||
printf(1, "%s", ".")
|
||||
else
|
||||
printf(1, "%s", "#")
|
||||
end if
|
||||
end for
|
||||
end for
|
||||
|
||||
puts(1,"\n\n")
|
||||
any_key()
|
||||
|
||||
--/*
|
||||
--output was edited to replace the color's hex digits for clearer output graphics.
|
||||
--to output all the hex digits, use printf(1,"%06x", screenData[j][i])
|
||||
--to output 'shortened' hex digits, use :
|
||||
--printf(1, "%x", ( abs( ( (screenData[j][i] / #FFFFF) - 1 ) ) - 1 ) )
|
||||
--and
|
||||
--printf(1,"%x", abs( ( (screenData[j][i] / #FFFFF) - 1 ) ) )
|
||||
--
|
||||
--,respectively in the last if check.
|
||||
--*/
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
local canvas = require "canvas"
|
||||
|
||||
local function line(c, x0, y0, x1, y1, col)
|
||||
local dx = math.abs(x1 - x0)
|
||||
local dy = math.abs(y1 - y0)
|
||||
local sx = (x0 < x1) ? 1 : -1
|
||||
local sy = (y0 < y1) ? 1 : -1
|
||||
local err = (dx > dy ? dx : - dy) // 2
|
||||
while true do
|
||||
c:set(x0, y0, col)
|
||||
if x0 == x1 and y0 == y1 then break end
|
||||
local e2 = err
|
||||
if e2 > -dx then
|
||||
err -= dy
|
||||
x0 += sx
|
||||
end
|
||||
if e2 < dy then
|
||||
err += dx
|
||||
y0 += sy
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local c = canvas.new(400, 400)
|
||||
c:fill(0xffffff) -- white background
|
||||
line(c, 0, 0, 399, 399, 0x0000ff) -- draw a red diagonal
|
||||
io.contents("mybmp.bmp", c:tobmp()) -- save to a bitmap file
|
||||
|
|
@ -1,53 +0,0 @@
|
|||
'Bitmap/Bresenham's line algorithm - VBScript - 13/05/2019
|
||||
Dim map(48,40), list(10), ox, oy
|
||||
data=Array(1,8, 8,16, 16,8, 8,1, 1,8)
|
||||
For i=0 To UBound(map,1): For j=0 To UBound(map,2)
|
||||
map(i,j)="."
|
||||
Next: Next 'j, i
|
||||
points=(UBound(data)+1)/2
|
||||
For p=1 To points
|
||||
x=data((p-1)*2)
|
||||
y=data((p-1)*2+1)
|
||||
list(p)=Array(x,y)
|
||||
If p=1 Then minX=x: maxX=x: minY=y: maxY=y
|
||||
If x<minX Then minX=x
|
||||
If x>maxX Then maxX=x
|
||||
If y<minY Then minY=y
|
||||
If y>maxY Then maxY=y
|
||||
Next 'p
|
||||
border=2
|
||||
minX=minX-border*2 : maxX=maxX+border*2
|
||||
minY=minY-border : maxY=maxY+border
|
||||
ox =-minX : oy =-minY
|
||||
wx=UBound(map,1)-ox : If maxX>wx Then maxX=wx
|
||||
wy=UBound(map,2)-oy : If maxY>wy Then maxY=wy
|
||||
For x=minX To maxX: map(x+ox,0+oy)="-": Next 'x
|
||||
For y=minY To maxY: map(0+ox,y+oy)="|": Next 'y
|
||||
map(ox,oy)="+"
|
||||
For p=1 To points-1
|
||||
draw_line list(p), list(p+1)
|
||||
Next 'p
|
||||
For y=maxY To minY Step -1
|
||||
line=""
|
||||
For x=minX To maxX
|
||||
line=line & map(x+ox,y+oy)
|
||||
Next 'x
|
||||
Wscript.Echo line
|
||||
Next 'y
|
||||
|
||||
Sub draw_line(p1, p2)
|
||||
Dim x,y,xf,yf,dx,dy,sx,sy,err,err2
|
||||
x =p1(0) : y =p1(1)
|
||||
xf=p2(0) : yf=p2(1)
|
||||
dx=Abs(xf-x) : dy=Abs(yf-y)
|
||||
If x<xf Then sx=+1: Else sx=-1
|
||||
If y<yf Then sy=+1: Else sy=-1
|
||||
err=dx-dy
|
||||
Do
|
||||
map(x+ox,y+oy)="X"
|
||||
If x=xf And y=yf Then Exit Do
|
||||
err2=err+err
|
||||
If err2>-dy Then err=err-dy: x=x+sx
|
||||
If err2< dx Then err=err+dx: y=y+sy
|
||||
Loop
|
||||
End Sub 'draw_line
|
||||
Loading…
Add table
Add a link
Reference in a new issue