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
Robert James Liguori
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
. I'm using Math.atan2(), but am missing a bunch of logic.
My Blog (I frequently post on Java, JSF and NetBeans)
author & internet detective
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
WA #1.....word association
coding problem : Mars rovers
Question about sprite movement
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014