views:

3778

answers:

3

I have a Point on the surface of the earth which I am converting to a Vector from Earth Center.

I have a True North Heading in degrees describing the path the point will travel on the surface of the earth.

I need to calculate a Vector which is perpendicular to the plane created by the path of this point along the earths surface.

I have tried calculating an arbitrary point along the path using the method described here and then taking the cross product of the two vectors however it does not seem to be quite accurate enough and seems like more overhead than is necessary.

This is related to my other post ray-polygon-intersection-point-on-the-surface-of-a-sphere.

+2  A: 

I'm assuming you're trying to compute a vector lying in the plane of the path, not perpendicular to it (since you've already got one - namely the vector from the origin to your point).

You first need to compute vectors lying in that plane that point due north and due east. To do this, let's call P your point, O the origin, and N = (0, 0, R) is the point at the top of your sphere. Then

e = cross(N - P, P - O)

is a vector that points due east, and is tangent to the sphere because it's perpendicular to P - O, a radius of the sphere.

For similar reasons

n = cross(e, P - O)

will point due north, and will be tangent to the sphere.

Now normalize n and e, and you've got an orthonormal basis for the tangent space at your point. To find a vector in a direction theta (say, counterclockwise from the positive east axis, to simplify the math), just take a little of e and a little of n:

v = cos(theta) * e + sin(theta) * n
Jesse Beder
+1 nice explanation :-)
David Zaslavsky
I finally got the same conclusion and couldn't have it explained better. +1
Daniel Brückner
A: 

Here's my understanding of your problem:

  • You have a point on the Earth's surface, specified as latitude/longitude coordinates
  • The direction "true north" is the direction that a person at that point would travel to reach the (geographic) North Pole by the most direct possible route. That is, the "true north vector" is tangent to the Earth's surface at your chosen point and points directly north, parallel to a line of longitude.
  • The direction of the point's motion will be (initially) tangent to the Earth's surface at your chosen point.
  • You have an angle in degrees from true north which specifies the heading at which this point is going to move.
  • This angle is the angle between the "true north vector" and the direction of motion of the point.
  • You want to calculate a vector that is tangent to the Earth's surface at that point but perpendicular to the direction of motion of the point.

If I've understood all that correctly, you can do it as follows:

  1. The "true north vector" at latitude lat, longitude lng is given by

    [-sin(lat) * cos(lng), -sin(lat) * sin(lng), cos(lat)]

  2. A vector perpendicular to the "true north vector" which points along a line of latitude (to the east) is given by

    [-sin(lng), cos(lng), 0]

  3. Since these two vectors identify the plane tangent to the Earth's surface, and the vector specifying the direction of motion of your point is also in that plane, your motion vector is a linear combination of the previous two:

    [
    -(sin(lat) * cos(lng) * cos(th) + sin(lng) * sin(th))
    -(sin(lat) * sin(lng) * cos(th) - cos(lng) * sin(th))
    cos(lat) * cos(th)
    ]
    where th is your heading angle.

  4. To find a vector perpendicular to that motion vector, you can just take the cross product of the radius vector (that is, the vector pointing from the center of the Earth to your point,

    [cos(lat) * cos(lng), cos(lat) * sin(lng), sin(lat)]
    with the motion vector. (That math would be messy, best to let the computer handle it)

David Zaslavsky
A: 

You already have 2 vectors:

N = (0,0,1) points straight up from the origin.

P = (a,b,c) points from the origin to your point.

Calculate the unit vector to your point U = P/|P|

Calculate a unit vector perpendicular to U and N E = U X N

Calculate a unit vector perpendicular to U and E (this will be tangent to the sphere) T = U X E T could be pointing either North or South, so if T.z < 0, multiply T by -1.

T now points due north, and is parallel to the plane tangent to the sphere at P.

You now have enough information to construct a rotation matrix (R), so you can rotate T around U. You can find how to make a matrix for rotation around any axis on wikipedia:

Using R, you can calculate a vector pointing in the direction of travel.

A = RT

A is the answer you are looking for.