大圆和恒向线交点

发布于 2024-09-03 10:45:05 字数 1456 浏览 6 评论 0原文

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

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

发布评论

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

评论(2

如梦亦如幻 2024-09-10 10:45:05

简单的答案是肯定的——如果你从任何纬度/经度开始并继续沿着某个大圆旅行,你最终将穿过地球上任何和所有其他大圆。地球上的每两个大圆恰好在两个点上相互交叉(两个相同的大圆除外,它们在所有点上都相互交叉。)

但我猜你不仅仅是在问是/否问题。您可能想知道这两个大圆到底在哪里相交。我们可以使用以下策略来找出答案:

  1. 每个大圆都位于穿过地球中心的平面上。

  2. 这些平面的交集是一条线(假设它们不是完全相同的平面。)

  3. 这条相交线在两个点处穿过地球表面 - 正是我们的两个大圆相交的地方。

  4. 我们的任务是:(1)找到飞机。 (2)求它们的交线。 (3) 找到两个交点,最后,(4) 用纬度/经度表示这些交点。 (5) 计算出哪个交点更接近您开始时的纬度/经度的额外分数。

听起来不错吗?下面通过三角和向量数学来实现这一点。为了稍微简化数学,我们将:

  • 使用单位球体,即以(x,y,z) 坐标系的原点,半径为 1:x^2+y^2+z^2=1。
  • 我们假设地球是一个完美的球体。不是大地水准面。甚至不是一个扁平球体
  • 我们将忽略海拔。

第 1 步 - 找到平面:

我们真正关心的是平面法线< /a>.下面是我们找到它们的方法:

--一个大圆由地球上它穿过的两点定义

法线将是 从原点 (0,0,0) 开始的每个点的 (x,y,z) 向量的叉积。给定每个点的纬度/经度,使用球面坐标转换,对应的 (x,y, z) 是:

x=cos(lat)*sin(lon)
y=cos(lat)*cos(lon)
z=sin(lat)

有了这个,我们的两个点被指定为 lat1/lon1 和 lat2/lon2,我们可以找出向量 P1=(x1,y1,z1) 和 P2=(x2,y2,z2)。

第一个大圆法线是叉积:

N1=P1 x P2

--另一个大圆由地球上的一点和方位角定义

我们有一个点 P3 和一个方位角 T。我们会找到一个使用球面定律,沿着大圆在距离 PI/4 的方位角 T 处穿过 P3 的点 P4余弦为了我们的方便在这里也解决了):

lat4=asin(cos(lat3)*cos(T))
lon4=lon3+atan2(sin(T)*cos(lat3),-sin(lat3)*sin(lat4))

然后法线与之前一样:

N2=P3 x P4

第 2 步:找到平面相交线:

给定两个平面法线,他们的叉积定义了他们的相交线

L=N1 x N2

第3步:找到交点:

只需归一化向量 L 以获得单位球体上的交点之一。另一个点位于球体的另一侧:

X1=L/|L|
X2=-X1

第 4 步:用纬度/经度表示交点:

给定 X=(x,y,z),使用 球面坐标转换,并考虑到该点位于单位球体上:

lat=asin(z)
lon=atan2(y,x)

第 5 步:两点中哪一个更接近?

使用haversine 公式计算出你指向X1和X2,选择较近的一个。

The simple answer is yes -- if you start from any lat/lon and continue traveling along some great circle, you will eventually cross any and all other great circles on the earth. Every two great circles on earth cross each other in exactly two points (with the notable exception of two identical great circles, which, well, cross each other in all their points.)

But I guess you are not merely asking a yes/no question. You may be wondering where, exactly, those two great circles intersect. We can use the following strategy to find that out:

  1. Each great circle lies on a plane that goes through the center of the earth.

  2. The intersection of those planes is a line (assuming they are not both the exact same plane.)

  3. That intersecting line crosses the surface of the earth at two points -- exactly where our two great circles intersect.

  4. Our mission is thus: (1) find the planes. (2) find their intersection line. (3) find the two intersection points, and finally, (4) express those intersection points in terms of lat/long. (5) extra credit for figuring out which intersecting point is closer to the lat/lon you started at.

Sounds good? The following does this with trig and vector math. To simplify the math somewhat, we'll:

  • work with the unit sphere, the one centered at the origin of our (x,y,z) coordinate system, and has a radius of 1: x^2+y^2+z^2=1.
  • we'll assume the earth is a perfect sphere. Not a geoid. Not even a flattened sphere.
  • we'll ignore elevation.

Step 1 -- find the planes:

All we really care about is the plane normals. Here's how we go and find them:

--One great circle is defined by two points on the earth that it crosses

The normal will be the cross product of the (x,y,z) vectors of each point from the origin (0,0,0). Given the lat/lon of each point, using spherical coordinates conversion, the corresponding (x,y,z) are:

x=cos(lat)*sin(lon)
y=cos(lat)*cos(lon)
z=sin(lat)

With that, and our two points given as lat1/lon1 and lat2/lon2, we can find out the vectors P1=(x1,y1,z1) and P2=(x2,y2,z2).

The first great circle normal is then the cross product:

N1=P1 x P2

--The other great circle is defined by a point on the earth and an azimuth

We have a point P3 and an azimuth T. We'll find a point P4 along the great circle going through P3 at azimuth T at a distance of PI/4 by using the spherical law of cosines (also solved for our convenience here):

lat4=asin(cos(lat3)*cos(T))
lon4=lon3+atan2(sin(T)*cos(lat3),-sin(lat3)*sin(lat4))

Then the normal is as before:

N2=P3 x P4

Step 2: find the planes intersecting line:

Given the two plane normals, their cross product defines their intersecting line:

L=N1 x N2

Step 3: find the intersection points:

Just normalize the vector L to get one of the intersection points on the unit sphere. The other point is on the opposite side of the sphere:

X1=L/|L|
X2=-X1

Step 4: express the intersection points in terms of lat/lon:

Given X=(x,y,z), using spherical coordinate conversion again, and taking into account the point is on the unit sphere:

lat=asin(z)
lon=atan2(y,x)

Step 5: which of the two points is closer?

Use the haversine formula to figure out the distance from your point to X1 and X2, choose the nearer one.

趁年轻赶紧闹 2024-09-10 10:45:05

我认为你最好的选择是使用 立体投影 将问题从球体映射到平面。此投影非常有用,因为它将恒向线映射到 R=exp(θa) 形式的对数螺线(又名等角线),并将大圆映射到平面上的圆。因此,您的问题简化为找到对数螺线和圆的交点(之后映射回球体)。

这只是一个帮助您入门的草图。如果您需要更多详细信息,请询问。

I think your best bet is to use stereographic projection to map the problem from the sphere to the plane. This projection is very useful in that it maps your rhumb line to a logarithmic spiral of form R=exp(θa) (aka a loxodrome) and maps your great circle to a circle on the plane. So your problem reduces to finding the intersection of a logarithmic spiral and a circle (after which you map back to the sphere).

This is just a sketch to get you started. If you need more details, just ask.

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