File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Heading/Bearing

 
Robert James Liguori
Author
Ranch Hand
Posts: 551
5
Java Netbeans IDE Oracle
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 33697
316
Eclipse IDE Java VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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, ....
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic