1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Compass heading from cartesian vectors?

  1. Sep 19, 2009 #1

    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.
  2. jcsd
  3. Sep 21, 2009 #2
    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:

    [tex] \frac {u \cdot v}{ {|u|}^2}} u [/tex]

    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). [itex] v_{hor} [/itex]

    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 [itex] v_{hor} [/itex] 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.
  4. Sep 21, 2009 #3
    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.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook