Google地图上任意两个点的距离

来源:互联网 发布:象过河软件免费版 编辑:程序博客网 时间:2024/06/08 10:22

公式:


float CalcDistanceOfTwoPoints( const double& x1, const double& y1,  const double& x2, const double& y2){// s = arcsin()double a = y2 - y1;double b = x2 - x1;//google:地图上任意两点的距离公式return asin(sqrt(sin(a / 2) * sin(a / 2) + cos(y1) + cos(y2) + sin(b / 2) * sin(b / 2)))*6378.137;}


阅读全文
0 0
原创粉丝点击