File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Java in General
Joined: Nov 27, 2007
Jun 24, 2012 20:01:39
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.
Robert J. Liguori
OCA Java SE 7 Programmer I Study Guide (Exam 1Z0-803)
Joined: May 26, 2003
Jun 24, 2012 20:18:42
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, ....
How To Ask Questions The Smart Way
Blogging on Certs:
SCEA Part 1
Part 2 & 3
Core Spring 3
TOGAF part 1
I agree. Here's the link:
Question about sprite movement
coding problem : Mars rovers
WA #1.....word association
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014