Objective-c 中的方位角/方位角计算
我一直在尝试这个公式来获取地图上两点的方位角/方位角。
我的意思是,获得用两个坐标完成的矢量的真实北向。
θ = atan2(sin(Δlong).cos(lat2),cos(lat1).sin(lat2)−sin(lat1).cos(lat2).cos(Δlong))
方位角=θ*180/M_PI;
方位角=(方位角+360)MOD 360;
我从这个网页(http://www.yourhomenow.com/house/havesine.html)获得了这个公式,但我从未得到相同的结果。
还有其他方法可以获得两点的方位角吗?
谢谢!
I have been trying this formula to obtain the azimut/bearing of two points of the map.
I mean, to obtain the real north direction of the vector done with the two coordinates.
θ =atan2(sin(Δlong).cos(lat2),cos(lat1).sin(lat2)−sin(lat1).cos(lat2).cos(Δlong))
azimut=θ*180/M_PI;
azimuth=(azimuth+360)MOD 360;
I have obtain this formula from this webpage(http://www.yourhomenow.com/house/haversine.html), but i never get the same result.
Is there any other way to obtain the azimut of two points?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您还需要以弧度表示的
Δlong
、lat1
和lat2
。因此,在开始计算之前,您应该将它们全部乘以M_PI/180
。You also need to have
Δlong
,lat1
andlat2
in radians. Therefore you should multiply all of them byM_PI/180
before starting the calculation.