> From: René Fournier [mailto:[EMAIL PROTECTED]
> Sent: Friday, July 16, 2004 3:59 PM
> To: Tim Van Wassenhove
> Cc: php
> Subject: Re: [PHP] Re: convert degrees to heading
>
>
> Works beautifully. Thanks!
>
> .Rene
>
> On Friday, July 16, 2004, at 04:36
Well, isn't north really about 340 to 020 degrees? Looks like if you threw
in a factor.
Warren Vail
-Original Message-
From: René Fournier [mailto:[EMAIL PROTECTED]
Sent: Friday, July 16, 2004 3:59 PM
To: Tim Van Wassenhove
Cc: php
Subject: Re: [PHP] Re: convert degrees to he
Works beautifully. Thanks!
...Rene
On Friday, July 16, 2004, at 04:36 PM, Tim Van Wassenhove wrote:
function degrees2compass($degrees)
{
$compass = array('N', 'NNW', 'NNE', 'NE', ...);
$index = $heading_degrees / sizeof($compass);
return $compass[$index];
}
--
PHP General Mailing List (
Here's a quick script I wrote for it:
$deg = $_GET['deg']; // get from URL, for testing atm
$deg %= 360; // make sure it doesn't break on eg 560 degrees
$deg = ((ceil(($deg-22.5)/45))*45+22.5); // break it up into parts we
know, there might be an easier way though, just too tired to see it.
swit
In article <[EMAIL PROTECTED]>, René fournier wrote:
> I have to write a little function to convert a direction from degrees
> to a compass -type heading. 0 = West. 90 = North. E.g.:
>
> from:
> 135 degrees
>
> to:
> NW
>
> Now, I was planning to write a series of if statements to evaluate e.g.
5 matches
Mail list logo