计算垂直于由点和真北航向描述的平面的 3d 矢量

发布于 2024-07-16 09:26:58 字数 472 浏览 3 评论 0原文

我在地球表面有一个点,我正在将其转换为来自地球中心的矢量。

我有一个以度为单位的真北航向,描述了该点在地球表面上行进的路径。

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

我尝试使用描述的方法计算路径上的任意点 这里 然后取两个向量的叉积,但是它似乎不够准确,并且似乎比必要的开销更多。

这与我的另一篇文章 ray-polygon-intersection 有关-球体表面上的点

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

七婞 2024-07-23 09:26:58

我假设你正在尝试计算一个位于路径平面中的向量,而不是垂直于它的向量(因为你已经有了一个向量 - 即从原点到你的点的向量) 。

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

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

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

由于类似的原因,

n = cross(e, P - O)

它将指向正北,并且与球体相切。

现在标准化ne,你就得到了你所在点的切线空间的正交基。 要找到 theta 方向的向量(例如,从正东轴逆时针旋转,以简化数学),只需取一点 e 和一点 >n:

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

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
帅哥哥的热头脑 2024-07-23 09:26:58

这是我对你的问题的理解:

  • 你在地球表面有一个点,指定为纬度/经度坐标
  • “真北”方向是一个人在该点到达(地理)北极最远的方向直接的可能路线。 也就是说,“真北矢量”在您选择的点处与地球表面相切,并且指向正北,与经线平行。
  • 该点的运动方向将(最初)与您选择的点处的地球表面相切。
  • 您有一个与正北的角度(以度为单位),它指定了该点将要移动的航向。
  • 该角度是“真北向量”与该点的运动方向之间的角度。
  • 您想要计算一个与该点处的地球表面相切但垂直于该点的运动方向的向量。

如果我正确理解了所有这些,您可以按如下方式执行:

  1. 纬度 lat 处的“真北矢量”,经度 lng 由 给出p>

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

  2. 垂直于“真北向量”的向量,该向量沿着纬度线(向东)指向,由下式给出:

    [-sin(lng), cos(lng), 0]< /pre>

  3. 由于这两个向量标识与地球表面相切的平面,并且指定点运动方向的向量也在该平面内,因此您的运动向量是前两个向量的线性组合:

    <前>[
    -(sin(lat) * cos(lng) * cos(th) + sin(lng) * sin(th))
    -(sin(lat) * sin(lng) * cos(th) - cos(lng) * sin(th))
    cos(纬度) * cos(日)
    ] 其中 th 是您的航向角。

  4. 要找到垂直于该运动矢量的矢量,您只需取半径矢量(即从地球中心指向您的点的矢量)的叉积即可,

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

    与运动矢量(这个数学会很混乱,最好让计算机处理它)

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)

盛夏已如深秋| 2024-07-23 09:26:58

您已经有 2 个向量:

N = (0,0,1) 从原点垂直向上的点。

P = (a,b,c) 从原点到您的点。

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

计算垂直于 U 和 N 的单位向量
E = UXN

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

T 现在指向正北,并且平行于与 P 处的球体相切的平面。

您现在有足够的信息来构造旋转矩阵 (R),因此您可以围绕 U 旋转 T。您可以了解如何为围绕 wikipedia 上的任何轴旋转:

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

A = RT

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文