Compass heading from cartesian vectors?

Artlav
Messages
161
Reaction score
1
Hello,

How can i calculate compass heading from cartesian vectors?

Specifically, a planet of radius R is located at (0,0,0), with north pole being at (0,R,0). An airplane is located at POS, and is flying in DIR direction.
How can i determine the (true north) compass heading of the plane?
DIR might not be parallel to the surface of the planet.
 
Mathematics news on Phys.org
you know how to project one vector on another?

The projection of v onto u, where u and v are both vectors in the same dimension euclidean vector space is:

\frac {u \cdot v}{ {|u|}^2}} u


You can use this to project the velocity vector (vx, vy, vz) on the position vector (x,y,z)

(x,y,z) points straight up (away from the center of the planet), so the projection of the velocity
vector on this vector gives the upward component of the velocity. Subtract this from the velocity
vector to get the horizontal velocity (along the surface). v_{hor}

what you then need to do is find a vector that points due east from the point (x, y, z)

you can then compute the angle between this vector and v_{hor} to get the angle away from due east, and use the sign of vy to see if the direction is in the northern half of the compass.
 
So, projecting direction vector on the position vector, then subtracting it from the direction vector effectively projects the direction onto the local surface plane. Do the same thing with a vector pointing to the north pole, and you get the north-south part of the heading. Then, vector product of these two will give the direction east, allowing to find the full 360* angle.

Interesting. Thank you for the idea, it works.
 

Similar threads

  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 30 ·
2
Replies
30
Views
2K
  • · Replies 2 ·
Replies
2
Views
4K
  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 7 ·
Replies
7
Views
2K
  • · Replies 11 ·
Replies
11
Views
3K
  • · Replies 30 ·
2
Replies
30
Views
6K