确定球面三角形是否是钝角

发布于 2024-08-19 09:45:13 字数 478 浏览 5 评论 0原文

给定由经度和纬度定义的两个点 A 和 B,我想确定另一个点 C 是否位于 A 和 B 之间。我很难定义〜之间。我的意思不是在线——几乎可以肯定不会。

几何图 http://www.freeimagehosting.net/uploads/b5c5ebf480.jpg

中在该图中,点 C 位于 A 和 B 之间,因为它位于 A 点和 B 点的法线以及它们之间的线(法线用细线表示)之间。点 D 不在 A 和 B 之间,而是在 B 和 F 之间。

另一种说法是,我想确定三角形 ABC 和 ABD 是否是钝角三角形。

请注意,这些点将非常靠近 - 通常在 10 米之内。

我认为半正矢定律可能会有所帮助,但我不知道半正矢定律的逆是什么。

非常感谢您的帮助。

Given two points, A and B, defined by longitude and latitude I want to determine if another point C is ~between~ A and B. ~between~ is hard for me to define. I don't mean on the line - it almost certainly won't be.

Geometric diagram http://www.freeimagehosting.net/uploads/b5c5ebf480.jpg

In this diagram, point C is ~between~ A and B because it is between the normals of points A and B and the line between them (normals denoted by thin line). Point D is not ~between~ A and B but it is ~between~ B and F.

Another way of saying this is that I want to determine if the triangles ABC and ABD are obtuse or not.

Note that the points will be very close together - within 10s of metres normally.

I'm thinking that the law of haversines may help but I don't know what the inverse of haversine is.

Many thanks for all help.

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

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

发布评论

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

评论(2

我家小可爱 2024-08-26 09:45:13

首先,首先将点平移到局部切平面。我们将利用三角形比地球半径小得多的事实。 (切线空间使得两个坐标中的每个坐标中的相等增量对应于相等的距离)

这是通过将经度除以 sin(lat) 来完成的:

A_local_x = A_lat_rads;
A_local_y = A_lon_rads/sin(A_lat_rads);

然后,

计算长度:

double ABsquared = (A_local_x - B_local_x)*(A_local_x - B_local_x) + (A_local_y - B_local_y)*(A_local_y - B_local_y);
double BCsquared = ..., ACsquared.

最后:

bool obtuse = (ABsquared+BCsquared < ACsquared) || (ABsquared+ACsquared < BCsquared); 

钝角意味着“它不在直线内”,如下所示你说。我不是检查三角形ABC是否是钝角,而是检查B和A处的角是否是钝角。就是这样。

注意:我还没有测试过这段代码。请告诉我它是如何通过插入不同的点来工作的,如果有错误我会修复它。

First, start with translating your points to local tangent plane. We will use the fact that your triangles are much smaller than the earth's radius. (Tangent space is such that equal deltas in each of the two coordinates correspond to equal distances)

This is done by dividing longtitudes by sin(lat):

A_local_x = A_lat_rads;
A_local_y = A_lon_rads/sin(A_lat_rads);

Then,

Compute lengths:

double ABsquared = (A_local_x - B_local_x)*(A_local_x - B_local_x) + (A_local_y - B_local_y)*(A_local_y - B_local_y);
double BCsquared = ..., ACsquared.

Finally:

bool obtuse = (ABsquared+BCsquared < ACsquared) || (ABsquared+ACsquared < BCsquared); 

Obtuse means "it is not within the line", as you say. I am not checking whether triangle ABC is obtuse, but whether the angles at B and at A are obtuse. That's it.

note: I haven't tested this code. Please tell me how it works by plugging different points, if there's a bug I will fix it.

从﹋此江山别 2024-08-26 09:45:13

如果您的点非常接近(几十米就可以轻松满足要求),您可以将其近似为二维问题,只需计算角度 CAB、θ 和 CBA、φ(使用 点积)。如果 θ 和 φ 都小于 π/2,则 C 处于“介于”之间。

cos(θ) = (AC · AB) / (|AC| |AB|)

如果该近似值对你来说还不够好,你需要球面三角学,这也不太难。

请注意,如果我正确理解你的问题,你需要检查角 CAB 和 CBA 是否是锐角,而不是角 ACB 是钝角或锐角。

If your points are very close—10s of meters could easily qualify—you may be able to approximate it as a 2-d problem, and just calculate the angles CAB, θ and CBA, φ (using dot product). If both θ and φ are less than π/2, you C is "between".

cos(θ) = (AC · AB) / (|AC| |AB|)

If that approximation isn't good enough for you, you will need spherical trigonometry, which is also not too hard.

Note that if I understood your problem correctly, you need to check if the angles CAB and CBA are acute, not that the angle ACB is obtuse or acute.

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