#N canvas 445 91 443 482 10; #X obj 198 67 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 -1; #X obj 128 142 print dLon; #X msg 72 192 36.1234 128.139 36.1238 128.123; #X obj 318 142 print brng; #X obj 198 142 print y; #X obj 248 142 print x; #X obj 128 119 v dLon\$0; #X obj 198 119 v y\$0; #X obj 248 119 v x\$0; #X obj 318 119 v brng\$0; #X text 89 13 Calculate angle between two Latitude/Longitude points => https://stackoverflow.com/a/18738281; #X obj 20 37 inlet; #X obj 20 380 outlet; #X text 66 380 bearing (deg \, CCW); #X obj 20 262 expr brng\$0=fmod((brng\$0+360) \, 360) \; brng\$0=atan2(y\$0 \, x\$0)*360/6.28319 \; x\$0=cos($f1*6.28319/360)*sin($f3*6.28319/360)-sin($f1*6.28319/360)*cos($f3*6.28319/360)*cos(dLon\$0) \; y\$0=sin(dLon\$0)*cos($f3*6.28319/360) \; dLon\$0=($f4-$f2)*6.28319/360 ; #X connect 0 0 6 0; #X connect 0 0 7 0; #X connect 0 0 8 0; #X connect 0 0 9 0; #X connect 2 0 14 0; #X connect 6 0 1 0; #X connect 7 0 4 0; #X connect 8 0 5 0; #X connect 9 0 3 0; #X connect 11 0 14 0; #X connect 14 0 12 0;