#!/usr/bin/perl
# Path in my view of the sky of various air routes
# Copyright       : http://www.fsf.org/copyleft/gpl.html
# Author          : Dan Jacobson -- http://jidanni.org/comm/air/m750/programs/
# Created On      : Mon Dec 23 19:42:05 2013
# Last Modified On: Mon Mar 31 11:14:53 2014
# Update Count    : 12

die "PROGRAM NOT READY";

use strict;
use warnings FATAL => 'all';
use Math::Trig qw/:great_circle deg2rad rad2deg/;
## http://eaip.caa.gov.tw/eaip/history/2013-02-07-AIRAC/html/eAIP/RC-ENR-3.3-en-TW.html#ID_938306
my @ANLOT   =( 120.486944, 23.907222 );
my @PILOX=( 121.024722, 24.415000 );
my @JIDANNI =( 120.86620,  24.18169); #Me
#	       LUCAS
#	       ANBU=>
#		   TNN=> #Xigang
my @FL      = qw/0 270 290 310 330 350 370 390 410/;
#use constant MetersPerFoot => 0.3048;

## RIGHT ANGLED SPHERICAL TRIANGLE
## E.g., A=JIDANNI B=PILOX C=nearest point to JIDANNI lying on PILOX~ANLOT
## Have β, c, want b, α
## sin β * sin c = sin α
## cos α = tan b / tan c
## β is bearing of a - bearing of c; i.e., bearing of BC - bearing of BA
use Math::Trig 'great_circle_bearing';
use Math::Trig qw(great_circle_distance deg2rad);
$A{lonlat}=@PILOX;
$C{lonlat}=@ANLOT;#actually beyond C!
sub NESW { deg2rad($_[0]), deg2rad(90 - $_[1]) }
my @L = NESW( -0.5, 51.3);
           my @T = NESW(139.8, 35.7);
           my $km = great_circle_distance(@L, @T, 6378); # About 9600 km.

       The direction you would have to go from London to Tokyo (in radians,
       straight north being zero, straight east being pi/2).

           use Math::Trig qw(great_circle_direction);

           my $rad = great_circle_direction(@L, @T); # About 0.547 or 0.174 pi.




my $a{direction}= great_circle_bearing($theta0, $phi0, $theta1, $phi1);
##c is length from A to B




sub NESW   { deg2rad(shift), deg2rad( 90 - shift ) }
sub unNESW { rad2deg(shift), 90 - rad2deg(shift) }
for my $route (@routes){
	print "$route\n";
	
	for my $FL (@FL){
	    print "FL 
	for azimuth (90, alpha bearing, 0)....
