Subject: | friendly_bearing_to() |
Date: | Mon, 15 Jan 2007 14:39:37 -0000 |
To: | <bug-geo-postcode [...] rt.cpan.org> |
From: | "Carl Johnstone" <fade [...] fadetoblack.me.uk> |
Hi,
friendly_bearing_to returns a slightly wrong bearing, for example 359
degrees returns NNW when it's practically N.
I would suggest changing:
my @nicely = qw(N NNW NW WNW W WSW SW SSW S SSE SE ESE E ENE NE NNE);
my $i = int( $bearing/22.5 );
to:
my @nicely = qw(N NNW NW WNW W WSW SW SSW S SSE SE ESE E ENE NE NNE N);
my $i = int( ($bearing + 11.25)/22.5 );
Carl