home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Magazyn Exec 5
/
CD_Magazyn_EXEC_nr_5.iso
/
Recent
/
dev
/
amos
/
Distance2.lzh
/
Distance2.bas
< prev
next >
Wrap
BASIC Source File
|
2000-10-28
|
1KB
|
40 lines
Set Double Precision
Def Fn DM#(A#)=((Abs(A#)-Int(Abs(A#)))/60.0*100.0+Int(Abs(A#)))*Sgn(A#)
Rem:New-in-version-2:You-can-enter-points-using-degrees-and-minutes.
Rem:So-when-you-wish-to-enter-60-degrees-and-30-minutes,just-enter-60.30!
Palette $C0,$0
Rem:Good old times style screen
Cls 1 : Pen 0
Rem An Amos program to calculate distance between two points
Rem on Earth when their latitude and longitude are given.
Rem:Due to the notorious arithemtics of Amos,this program makes often
Rem:errors from 0-to20km,but it is not my fault,but Amos`.
Rem:Buy a better Basic inter-
Rem:preter/compiler!:-)
RZ$="######"
10 Degree
Rem:Because this is very standard basic,this should work in the
Rem:most of Basics,specially in STOS,but I have not tried.
Rem:Only minor changes would needed
R#=6378.15 : Rem Earth radius in kilometers
Rem:You can change this to miles,so you get the result in miles, too.
Print "Point 1"
Print "Give latitude and longitude (in degrees and minutes , +=North/West, -=South/East) "
Input LA1#,LO1#
LA1#= Fn DM#(LA1#) : LO1#= Fn DM#(LO1#)
Print "Point 2"
Print "Give latitude and longitude "
Input LA2#,LO2#
LA2#= Fn DM#(LA2#) : LO2#= Fn DM#(LO2#)
KOSALFA#=Cos(LA1#)*Cos(LO1#)*Cos(LA2#)*Cos(LO2#)+Cos(LA1#)*Sin(LO1#)*Cos(LA2#)*Sin(LO2#)+Sin(LA1#)*Sin(LA2#)
Radian
ALFA#=Acos(KOSALFA#)
DISTANCEKM#=ALFA#*R#
Print "Distance:";
Print Using RZ$;DISTANCEKM#;" km."
Input "Again (Y/N)";Q$
If Upper$(Q$)="Y" Then Goto 10