计算垂直于由点和真北航向描述的平面的 3d 矢量
我在地球表面有一个点,我正在将其转换为来自地球中心的矢量。
我有一个以度为单位的真北航向,描述了该点在地球表面上行进的路径。
我需要计算一个垂直于该点沿地球表面的路径创建的平面的向量。
我尝试使用描述的方法计算路径上的任意点 这里 然后取两个向量的叉积,但是它似乎不够准确,并且似乎比必要的开销更多。
这与我的另一篇文章 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我假设你正在尝试计算一个位于路径平面中的向量,而不是垂直于它的向量(因为你已经有了一个向量 - 即从原点到你的点的向量) 。
您首先需要计算该平面上指向正北和正东的向量。 为此,我们将
P
称为您的点,O
称为原点,N = (0, 0, R)
是位于原点的点。你的球体的顶部。 然后是一个指向正东的向量,并且与球体相切,因为它垂直于球体的半径
P - O
。由于类似的原因,
它将指向正北,并且与球体相切。
现在标准化
n
和e
,你就得到了你所在点的切线空间的正交基。 要找到theta
方向的向量(例如,从正东轴逆时针旋转,以简化数学),只需取一点e
和一点>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, andN = (0, 0, R)
is the point at the top of your sphere. Thenis 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
will point due north, and will be tangent to the sphere.
Now normalize
n
ande
, and you've got an orthonormal basis for the tangent space at your point. To find a vector in a directiontheta
(say, counterclockwise from the positive east axis, to simplify the math), just take a little ofe
and a little ofn
:这是我对你的问题的理解:
如果我正确理解了所有这些,您可以按如下方式执行:
纬度
lat
处的“真北矢量”,经度lng
由 给出p>垂直于“真北向量”的向量,该向量沿着纬度线(向东)指向,由下式给出:
由于这两个向量标识与地球表面相切的平面,并且指定点运动方向的向量也在该平面内,因此您的运动向量是前两个向量的线性组合:
<前>[
-(sin(lat) * cos(lng) * cos(th) + sin(lng) * sin(th))
-(sin(lat) * sin(lng) * cos(th) - cos(lng) * sin(th))
cos(纬度) * cos(日)
] 其中
th
是您的航向角。要找到垂直于该运动矢量的矢量,您只需取半径矢量(即从地球中心指向您的点的矢量)的叉积即可,
与运动矢量(这个数学会很混乱,最好让计算机处理它)
Here's my understanding of your problem:
If I've understood all that correctly, you can do it as follows:
The "true north vector" at latitude
lat
, longitudelng
is given byA vector perpendicular to the "true north vector" which points along a line of latitude (to the east) is given by
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:
where
th
is your heading angle.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,
with the motion vector. (That math would be messy, best to let the computer handle it)
您已经有 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.