Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Here's my understanding of your problem:</p> <ul> <li>You have a point on the Earth's surface, specified as latitude/longitude coordinates</li> <li>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.</li> <li>The direction of the point's motion will be (initially) tangent to the Earth's surface at your chosen point.</li> <li>You have an angle in degrees from true north which specifies the heading at which this point is going to move.</li> <li>This angle is the angle between the "true north vector" and the direction of motion of the point.</li> <li>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.</li> </ul> <p>If I've understood all that correctly, you can do it as follows:</p> <ol> <li><p>The "true north vector" at latitude <code>lat</code>, longitude <code>lng</code> is given by <pre>[-sin(lat) * cos(lng), -sin(lat) * sin(lng), cos(lat)]</pre></p></li> <li><p>A vector perpendicular to the "true north vector" which points along a line of latitude (to the east) is given by <pre>[-sin(lng), cos(lng), 0]</pre></p></li> <li><p>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: <pre>[ -(sin(lat) * cos(lng) * cos(th) + sin(lng) * sin(th)) -(sin(lat) * sin(lng) * cos(th) - cos(lng) * sin(th)) cos(lat) * cos(th) ]</pre> where <code>th</code> is your heading angle.</p></li> <li><p>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,<pre>[cos(lat) * cos(lng), cos(lat) * sin(lng), sin(lat)]</pre> with the motion vector. (That math would be messy, best to let the computer handle it)</p></li> </ol>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload