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!
TagyourareitAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ozoCommented:
How are you expressing a direction in 3-D space?
What does a heading of -7423 mean?
0
TagyourareitAuthor Commented:
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
0
TagyourareitAuthor Commented:
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.
0
Rowby Goren Makes an Impact on Screen and Online

Learn about longtime user Rowby Goren and his great contributions to the site. We explore his method for posing questions that are likely to yield a solution, and take a look at how his career transformed from a Hollywood writer to a website entrepreneur.

ozoCommented:
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?
0
TagyourareitAuthor Commented:
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

0
ozoCommented:
That's a two dimensional direction on a circle divided into 65536 sectors , whereas your points had 3 dimensions.
If you ignore the Z you can sort of close to -7423 by applying your function to  GetHeading(X2-X1,Y2-Y1), but if you head in that direction from
X1 = 67749,79
Y1 = -75603,24
Z1 = -2854,271
you would not go to
X2 = 67801,95
Y2= -75648,37
Z2 = -2823,197
because you would still be at
Z1 = -2854,271
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
TagyourareitAuthor Commented:
I will accept the answer its partially what i want.

Thank you for now.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Math / Science

From novice to tech pro — start learning today.