| Author |
Heading/Bearing
|
Robert Liguori
Author
Ranch Hand
Joined: Nov 27, 2007
Posts: 426
|
|
I have two coordinates (original and new).
I need to get the bearing/heading from these two coordinates (e.g., NORTH, NORTHEAST, etc).
Can anyone point me in the right direction so I can code this up in Java. I'm using Math.atan2(), but am missing a bunch of logic.
Thanks, Robert
|
Robert J. Liguori - OCA Java SE 7 Programmer I Study Guide (Exam 1Z0-803)
|
 |
Jeanne Boyarsky
internet detective
Marshal
Joined: May 26, 2003
Posts: 26201
|
|
How accurate do you need to be? If the answer is it needs to be one of north, south, east, west, northeast, northwest, southeast, southwest - it seems like this could be done without any trig.
If the x is smaller on the first one than the second, you know it is north, northeast or northwest. If the y is smaller, ....
|
[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
|
 |
 |
|
|
subject: Heading/Bearing
|
|
|