查找交叉路口和预计到达时间
我有 2 个坐标点 A,B,我想知道计算交点的公式(如果存在)。
假设我有一架飞机在纬度:42.68543 经度:16.9880 以 196 度以 430 公里/小时的速度移动,另一架飞机在纬度:36.72348 经度:20.76236 以 269 度以 670 公里/小时的速度移动
1)我想计算交点(如果存在)
2)如果存在交集我需要知道估计每艘船需要的时间以及到交叉点的距离,
您能帮我用一个 Java 示例来说明如何找到它吗?
I have 2 coordinate points A,B and I want to know the formula to calculate the intersection point if that exist.
Let's say I have an airplane at Lat: 42.68543 Lon: 16.9880 moving at 196 deg with 430km/h and another one at Lat: 36.72348 Lon: 20.76236 moving at 269 deg with 670km/h
1) I want to calculate the intersection point (if exist)
2) If intersection exist I need to know the estimate time that each craft needs and the distance to the intersection point
Can you help me with a Java example on how can I find it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您有位置向量
A=(xa,ya)
和B=(xb,yb)
以及相应的速度Va
和Vb
,您正在尝试求解A+s*Va=B+t*Vb
。这是任何坐标系的解决方案,但首先您必须选择一个坐标系。让我们首先解决欧几里得空间的问题...
为每个分量 x 和 y 写出这个。您现在有两个变量的两个联立方程,并且可以求解
s
和t
。如果s==t
(或者“接近”),它们将会发生碰撞。当 Va 和 Vb 平行时,请注意被零除以及数值不稳定。对于球面解,考虑在圆的圆周上移动的两个点,方程的形式相同,尽管 A 和 B 是角度,Va 和 Vb 是角速度。要获得圆,请随时计算欧几里德 Va 和 Vb,这与欧几里德 A 和 B(假设地球以 0 为中心)一起计算,告诉您正在工作的平面,投影到该平面即可得到二维问题分别为每个平面。
If you have position vectors
A=(xa,ya)
andB=(xb,yb)
and corresponding velocitiesVa
andVb
, you are trying to solveA+s*Va=B+t*Vb
. This is the solution for any coordinate system, but first you have to choose a coordinate system.Let's solve it first for Euclidian space...
Write this out for each component x and y. You now have two simultaneous equations in two variables and can solve for both
s
andt
. They will collide ifs==t
(or is 'close'). Watch out for divide-by-zero when Va and Vb are parallel, and numerical instabilities.For a spherical solution, consider two points moving on the circumferences of circles, the equations are the same form although A and B will be angles and Va and Vb will be angular velocities. To get the circles, calculate Euclidian Va and Vb instantaneously at any time, this taken with the Euclidian A and B (assuming Earth is centred at 0) tell you what plane you're working in, project into this plane to get a 2D problem for each plane separately.