Java 计算地质点间夹角的正确方法
我对连接三个地质点创建的线之间的计算角度有问题Java 计算地质点间夹角的正确方法,java,math,geolocation,Java,Math,Geolocation,我对连接三个地质点创建的线之间的计算角度有问题 p1 \ p2 \ / p3 我实施了许多解决方案,但没有给我预期的结果。例如,我使用余弦定律。 我也用了这个等式 angle = atan2(vector2.y, vector2.x) - atan2(vector1.y, vector1.x). 每个方法都返回相同的increct结果 例如,我有三点: p3纬度=52.66346360584388,19.0561087322273625 p1纬度=52.6
p1
\ p2
\ /
p3
我实施了许多解决方案,但没有给我预期的结果。例如,我使用余弦定律。
我也用了这个等式
angle = atan2(vector2.y, vector2.x) - atan2(vector1.y, vector1.x).
每个方法都返回相同的increct结果
例如,我有三点:
p3纬度=52.66346360584388,19.0561087322273625
p1纬度=52.66321959338828,19.0563798488714
p2纬度=52.66348185383115,19.05648061759354
余弦定律和atan2返回角44.797度。当我在谷歌地图上标记这些点并在gimp程序中测量角度时,我有大约57度。在其他点集中,差异相同或更大。我做错了什么
对于球形几何体,需要使用特殊公式 查看轴承截面,计算从p3到p2和从p3到p1的轴承,并找出它们的差异
Formula:
θ = atan2( sin Δλ ⋅ cos φ2 , cos φ1 ⋅ sin φ2 − sin φ1 ⋅ cos φ2 ⋅ cos Δλ )
where φ1,λ1 is the start point,
φ2,λ2 the end point (Δλ is the difference in longitude)
JavaScript: (all angles in radians)
var y = Math.sin(λ2-λ1) * Math.cos(φ2);
var x = Math.cos(φ1)*Math.sin(φ2) -
Math.sin(φ1)*Math.cos(φ2)*Math.cos(λ2-λ1);
var brng = Math.atan2(y, x).toDegrees();
使用球坐标。非常感谢。你的回答解决了我的问题。