fb:porticula NoPaste
Höhenzug
Uploader: | Muttonhead |
Datum/Zeit: | 17.02.2014 12:33:40 |
'******************************************************************************
const as single pi =atn (1) * 4
const as single doublepi=pi*2
const as single halfpi=pi/2
'******************************************************************************
'******************************************************************************
'******************************************************************************
Screen 19,32
dim as integer LenGraph,Xo,Yo
dim as integer PixelCenterHeight,PixelEastHeight,PixelNorthHeight,PixelWestHeight,PixelSouthHeight
dim as single Rad,RadStep
dim as integer Quadrant
dim as integer QStartHeight,QEndHeight,QDiffHeights'Start und Endhöhe und Differenz im jeweiligen Quadranten
dim as single QRad'separates Bogenmaß im jeweiligen Quadranten 0 bis pi/4
dim as single QLineHeight,QCurvedHeight'"interpolierte" Höhen im jeweiligen Quadranten
dim as single HorizonHeight'Höhe Horizont ausgehend von der Höhe des CenterPixels
Xo=10
Yo=260
LenGraph=780
RadStep=doublepi/LenGraph
'alle Höhen 0 bis 255
'Höhe Pixel um das es eigentlich geht
PixelCenterHeight=127
'Höhen der vier Nachbarpixel
'ost->Azimut 0 grd, 0
PixelEastHeight=30
'nord->Azimut 90 grd, pi/2
PixelNorthHeight=255
'west->Azimut 180 grd, pi
PixelWestHeight=150
'süd->Azimut 270 grd, pi*1.5
PixelWestHeight=200
for i as integer=0 to LenGraph-1
Rad=RadStep*i
Quadrant=int((Rad/halfpi)+1)
select case Quadrant
case 1
QStartHeight=PixelEastHeight
QEndHeight=PixelNorthHeight
QRad=Rad
case 2
QStartHeight=PixelNorthHeight
QEndHeight=PixelWestHeight
QRad=Rad-halfpi
case 3
QStartHeight=PixelWestHeight
QEndHeight=PixelSouthHeight
QRad=Rad-pi
case 4
QStartHeight=PixelSouthHeight
QEndHeight=PixelEastHeight
QRad=Rad-(pi+halfpi)
end select
'print quadrant,rad,qrad
QDiffHeights=QEndHeight-QStartHeight
'geradlinige Berechnung der "Zwischenhöhen"
QLineHeight=QStartHeight + QDiffHeights*QRad/halfpi
pset(Xo+i,Yo-QLineHeight),&HFFFFFF
'kurvige Berechnung der "Zwischenhöhen"
QCurvedHeight=QStartHeight + (sin(QRad*2-halfpi)+1)/2*QDiffHeights
pset(Xo+i,Yo-QCurvedHeight),&HFFFF00
'Horizonthöhe
HorizonHeight=QCurvedHeight-PixelCenterHeight
pset(Xo+i,Yo-HorizonHeight),&H00FFFF
pset(Xo+i,Yo),&H007F00'Koordinatenachse X
next i
sleep