计算垂直于由Point和True North Heading描述的平面的3d矢量

时间:2022-09-10 20:38:11

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.

我需要计算一个Vector,它垂直于该点沿地球表面的路径所创建的平面。

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.

这与我在球面上的其他后期光线 - 多边形 - 交叉点相关。

3 个解决方案

#1


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

您首先需要计算位于该平面中指向正北和正东的向量。要做到这一点,让我们称P为你的点,O是原点,N =(0,0,R)是你球体顶部的点。然后

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.

是一个指向正东方的矢量,它与球体相切,因为它垂直于P - O,即球体的半径。

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:

现在将n和e标准化,并且你已经得到了切点空间的标准正交基础。要在方向θ上找到一个向量(比如,从正东轴逆时针方向,以简化数学运算),只需要取一点e和一点n:

v = cos(theta) * e + sin(theta) * n

#2


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

    纬度lat的“真北矢量”,经度lng由下式给出

    [-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)

#3


You already have 2 vectors:

你已经有2个向量:

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

N =(0,0,1)从原点直接指向。

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

P =(a,b,c)从原点指向你的点。

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

计算单位矢量到你的点U = P / | P |

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

计算垂直于U和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.

计算垂直于U和E的单位矢量(这将与球体相切)T = U X E T可以指向北或南,所以如果T.z <0,则将T乘以-1。

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

T现在指向正北,并且与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:

您现在有足够的信息来构造旋转矩阵(R),因此您可以围绕U旋转T.您可以找到如何在*上围绕任意轴旋转矩阵:

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

使用R,您可以计算指向行进方向的矢量。

A = RT

A = RT

A is the answer you are looking for.

A是您正在寻找的答案。

#1


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

您首先需要计算位于该平面中指向正北和正东的向量。要做到这一点,让我们称P为你的点,O是原点,N =(0,0,R)是你球体顶部的点。然后

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.

是一个指向正东方的矢量,它与球体相切,因为它垂直于P - O,即球体的半径。

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:

现在将n和e标准化,并且你已经得到了切点空间的标准正交基础。要在方向θ上找到一个向量(比如,从正东轴逆时针方向,以简化数学运算),只需要取一点e和一点n:

v = cos(theta) * e + sin(theta) * n

#2


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

    纬度lat的“真北矢量”,经度lng由下式给出

    [-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)

#3


You already have 2 vectors:

你已经有2个向量:

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

N =(0,0,1)从原点直接指向。

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

P =(a,b,c)从原点指向你的点。

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

计算单位矢量到你的点U = P / | P |

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

计算垂直于U和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.

计算垂直于U和E的单位矢量(这将与球体相切)T = U X E T可以指向北或南,所以如果T.z <0,则将T乘以-1。

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

T现在指向正北,并且与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:

您现在有足够的信息来构造旋转矩阵(R),因此您可以围绕U旋转T.您可以找到如何在*上围绕任意轴旋转矩阵:

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

使用R,您可以计算指向行进方向的矢量。

A = RT

A = RT

A is the answer you are looking for.

A是您正在寻找的答案。