This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Math::Trig: make the great_circle_midpoint() example more complete
author積丹尼 Dan Jacobson <jidanni@jidanni.org>
Fri, 24 Feb 2023 07:34:46 +0000 (15:34 +0800)
committerTony Cook <tony@develop-help.com>
Tue, 28 Feb 2023 22:46:50 +0000 (09:46 +1100)
Yes, "or about 69 N 89 E, in the frozen wastes of Siberia."
but must reveal the crucial missing step involved!

dist/Math-Complex/lib/Math/Trig.pm

index fbcb973..5745ae1 100644 (file)
@@ -669,9 +669,11 @@ straight north being zero, straight east being pi/2).
 
 The midpoint between London and Tokyo being
 
-    use Math::Trig qw(great_circle_midpoint);
+    use Math::Trig qw(great_circle_midpoint rad2deg);
 
     my @M = great_circle_midpoint(@L, @T);
+    sub SWNE { rad2deg( $_[0] ), 90 - rad2deg( $_[1] ) }
+    my @lonlat = SWNE(@M);
 
 or about 69 N 89 E, in the frozen wastes of Siberia.