如何计算两个地理/GPS 坐标之间的角度? [英] How to calculate angle between two Geographical/GPS coordinates?
本文介绍了如何计算两个地理/GPS 坐标之间的角度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有两个 GPS 坐标
I have two GPS Coordinates
例如(Lat1, Long1) 和 (Lat2,Long2)
e.g. (Lat1, Long1) and (Lat2,Long2)
谁能帮我找出这两点之间的角度.
Could anybody please help me find the angle between those two points.
值应为 0-360 度.
Values should be 0-360 degrees.
推荐答案
摘自 this 以前的 SO 帖子:
Taken from this previous SO post:
float dy = lat2 - lat1;
float dx = cosf(M_PI/180*lat1)*(long2 - long1);
float angle = atan2f(dy, dx);
这篇关于如何计算两个地理/GPS 坐标之间的角度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文