Link to home
Start Free TrialLog in
Avatar of Tagyourareit
Tagyourareit

asked on

Get heading between two points

Hello,

Could someone please try and solve this math problem for me:

i have two coordinates A and B and i need to calculate heading between those two.

Now by heading i want to get direction i am facing if i go from point A to point B.


Now i have checked heading in application and it goes like this:

X1 = 67749,79
Y1 = -75603,24
Z1 = -2854,271

X2 = 67801,95
Y2= -75648,37
Z2 = -2823,197

Heading should be:  -7423

This i get from one application (i dont have source code for it so i dont know how heading is calculated but it should be correct).

tried with ATAN2 but it doesnt return same resoult.

Thank you!
Avatar of ozo
ozo
Flag of United States of America image

How are you expressing a direction in 3-D space?
What does a heading of -7423 mean?
Avatar of Tagyourareit
Tagyourareit

ASKER

Hello,

How are you expressing a direction in 3-D space?

Open in new window

What do u mean by that?

What does a heading of -7423 mean?

Open in new window

Its a short ... Signed 16-bit integer
I've requested that this question be deleted for the following reason:

Its a badly formulated question. Let me think about it and will post better one.
A direction in three-dimensional space is usually expressed with two or three real numbers.  e.g. as altitude&azimuth or as direction cosines or as a unit vector, ...
How are you describing a direction as a single integer?
Well function i have is like this:

  public static short GetHeading(float x, float y)
        {
            return (short) (Math.Atan2(y, x)*32768/Math.PI);
        }

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of ozo
ozo
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I will accept the answer its partially what i want.

Thank you for now.