#!/usr/bin/perl
# north_pass -- compute elevations of planes passing due north of me
# Simplified perl version
# Copyright: https://www.gnu.org/licenses/gpl.html
# Author: Dan Jacobson https://www.jidanni.org/
# Created: Mar 2003
# Last-Updated: 2024-06-13T19:10:35+0000
#      Update #: 78

use strict;
use warnings q!all!;
use Math::Trig;
my $meters2FL = 1 / 0.3048 / 100;    # Meters to Flight Levels (100s of feet)
my $mylat     = 24.18170479; #my latitude, also the elevation of the pole (star)
## Horizontal distance M-750 air route passes north of me, in FLs:
my $north = 9338.0 * $meters2FL;
my $my_FL = 777 * $meters2FL;      #My Flight Level
printf "%-4s%s$/", qw/FL Angle/;
for ( my $FL = 100 ; $FL <= 440 ; $FL += 20 ) {
    my $angle = rad2deg atan2( $FL - $my_FL, $north );
    printf "%d %.1f%2s$/", $FL, $angle, $angle < $mylat ? "v" : "^";
}
