This not work out so well. Trying to solve for the x-y plane results in:
atan((44.0-99.0)/(-16.0-32
0.853254986253752 degrees.
Main Topics
Browse All TopicsAssume you are in Cartesian space at coordinates {32, 99, -6}. You are traveling to coordinates {-16, 44, 36}. There are two headings (bearings/directions) to find, the angle at which you must move on the x and y axis towards your destination and the angle at which you must move up or down on the z axis to reach your destination. Angles for the x,y axes range from 0 to 360 degrees, whereas angles for the z axis range from 90 degrees (straight up) to -90 degrees (straight down). The distance between the previous two coordinates is 84.219 units. Assuming you have no acceleration (you move at 1 unit/second, there is no speeding up or slowing down), at which angles do I need to move on the x,y axis and which angle on the z axis if I move forwards 84.219 units and how do you calculate this?
Am I right in assuming I need to convert to spherical coordinates? Thanks!
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
First of all, with the values :
x1=99.0 y1=32.0
x2=44.0 y2=-16.0
you should get :
arctan((44.0-99.0)/(-16.0-
Which is off by 180 degrees of what it should be (228.888 degrees). The reason is that arctan generates values between -90 and 90 degrees.
You can add a simple check for that though, something like :
angle = arctan((y2-y1)/(x2-x1))
if (x2-x1) < 0 then add 180 to angle
if angle < 0 then add 360 to angle
Note that arctan will also have trouble if x2 is equal to x1, so :
if x2 equal to x1 then
if (y2-y1) >= 0 then angle = 90
else angle = -90
else
angle = arctan((y2-y1)/(x2-x1))
if (x2-x1) < 0 then add 180 to angle
if angle < 0 then add 360 to angle
Business Accounts
Answer for Membership
by: Infinity08Posted on 2008-02-18 at 01:27:07ID: 20918633
>> Am I right in assuming I need to convert to spherical coordinates?
1)² + (x2-x1)²)))
You could, but you don't need to.
Two points (x1,y1,z1) and (x2,y2,z2) gives :
1) angle in X-Y plane : arctan((y2-y1)/(x2-x1))
2) "vertical" angle : arctan((z2-z1)/(sqrt((y2-y
Verify these formulas before using, as I just quickly formed them in my head ;)