realbasic-games
[Top] [All Lists]

Re: Incrementing or decrementing a heading in radians

To: <realbasic-games at lists dot realsoftware dot com>
Subject: Re: Incrementing or decrementing a heading in radians
From: "Martin Dillon" <martin dot dillon at optusnet dot com dot au>
Date: Thu, 1 Sep 2005 06:55:30 +1000
Delivered-to: realbasic-games at lists dot realsoftware dot com
>>> Using ATan2, right? 

>> Actually I'm using ATan. I then parse the result depending on the quadrant
>> that x2,y2 falls in relative to x1,y1, but I eventually get the right answer
>> (i.e. D the direction from x1,y1 to x2,y2). 

> If you need the heading from (x1, y1) to (x2, y2), could you not say:
> angle = atan2(x2 - x1, y2 - y1)
> 
> ?

OK this works if I reverse the parameters as per the language reference to
angle = Atan2(y2-y1,x2-x1)
- Thanks Asher.

But the result of Atan2 assumes the x axis is pointing towards zero degrees.
Is this the standard orientation that people use?
If so, maybe I should overhaul my code to match this?

Martin
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

<Prev in Thread] Current Thread [Next in Thread>