(08-22-2024 04:03 AM)Geoff Quickfall Wrote: Well no, not that one as I wrote this program for my HP25 back in 79. I have many reference books on great circle distance and track and have created both the polar / rectangular routine as well as the sin / cos routines.
The books are in storage so I will have to dig them up. But the routines are created by me from standard math or navigation book formula.
Usually the classic formulas you mentioned in your documentation are used.
So I was a bit surprised that the same idea is used in the program: rotate the coordinate system so that the z-axis passes exactly through the first waypoint.
If you ever feel like publishing your sources, that would be very interesting to me.
In the meantime I was able to shorten your original program by a few bytes:
Code:
001 { 42 21 11 } f LBL A ; LOAD WAYPOINTS
002 { 42 7 4 } f FIX 4 ; λ_2 φ_2 λ_1 φ_1
003 { 43 2 } g ->H ; λ_2 φ_2 λ_1 φ_1
004 { 44 3 } STO 3 ; λ_2 φ_2 λ_1 φ_1
005 { 33 } Rv ; φ_2 λ_1 φ_1
006 { 43 2 } g ->H ; φ_2 λ_1 φ_1
007 { 44 2 } STO 2 ; φ_2 λ_1 φ_1
008 { 33 } Rv ; λ_1 φ_1
009 { 43 2 } g ->H ; λ_1 φ_1
010 { 44 1 } STO 1 ; λ_1 φ_1
011 { 33 } Rv ; φ_1
012 { 43 2 } g ->H ; φ_1
013 { 44 0 } STO 0 ; φ_1
014 { 43 32 } g RTN ;
015 { 42 21 12 } f LBL B ; GREAT CIRCLE
016 { 42 7 3 } f FIX 3 ;
017 { 45 2 } RCL 2 ; φ_2
018 { 1 } 1 ; 1 φ_2
019 { 42 1 } f ->R ; r=sin(c) w=cos(c)
020 { 45 1 } RCL 1 ; λ_1 r w
021 { 45 3 } RCL 3 ; λ_2 λ_1 r w
022 { 30 } - ; A=λ_1-λ_2 r w w
023 { 34 } X<=>Y ; r A w w
024 { 42 1 } f ->R ; u=r*cos(A) v=r*sin(A) w w
025 { 43 33 } g R^ ; w u v w
026 { 43 1 } g ->P ; r φ v w
027 { 34 } X<=>Y ; φ r v w
028 { 45 0 } RCL 0 ; φ_1 φ r v
029 { 40 } + ; φ+φ_1 r v v
030 { 34 } X<=>Y ; r φ+φ_1 v v
031 { 42 1 } f ->R ; x z y y
032 { 34 } X<=>Y ; z x y y
033 { 33 } Rv ; x y y z
034 { 43 1 } g ->P ; r t=C y z
035 { 43 33 } g R^ ; z r t
036 { 43 1 } g ->P ; 1 a t
037 { 33 } Rv ; a t
038 { 6 } 6 ; 6 a t
039 { 0 } 0 ; 60 a t
040 { 20 } * ; d=60a t
041 { 43 44 } g INT ; d t
042 { 34 } X<=>Y ; t d
043 { 43 30 2 } g TEST 2 ; t<0?
044 { 32 .0 } GSB 10 ; reverse heading
045 { 43 44 } g INT ; t d
046 { 26 } EEX ; 1 t d
047 { 3 } 3 ; 1e3 t d
048 { 10 } / ; .t d
049 { 40 } + ; d.t
050 { 31 } R/S ;
051 { 45 2 } RCL 2 ;
052 { 44 0 } STO 0 ;
053 { 45 3 } RCL 3 ;
054 { 44 1 } STO 1 ;
055 { 43 35 } g CLx ;
056 { 31 } R/S ;
057 { 43 2 } g ->H ;
058 { 44 3 } STO 3 ;
059 { 33 } Rv ;
060 { 43 2 } g ->H ;
061 { 44 2 } STO 2 ;
062 { 22 12 } GTO B ;
063 { 42 21 .0 } f LBL 10 ;
064 { 3 } 3 ;
065 { 6 } 6 ;
066 { 0 } 0 ;
067 { 40 } + ;
068 { 43 32 } g RTN ;
You may notice that register
9 is not used anymore.
For the rotation by \(\varphi_1\) it doesn't really matter which coordinates are in the
x- and
y-registers. But depending on the choice the value has to be added or subtracted.