本文介绍了计算指南针朝向CLLocation-iOS的Haversine函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我了解如何获取2个CLLocations之间的距离.我需要确定从一个CLLocation到另一个CLLocation的广义罗盘方位(N,NE,E等).

I understand how to get the distance between 2 CLLocations. I need to determine the generalized compass bearing (N, NE, E etc.) from a CLLocation to another CLLocation.

在我用haversine公式实现某种推论之前,您是否发现有一个通用的开源库或代码片段可以解决使用或不使用haversine的问题?

Before I implement something to derive the bearing with the haversine formula is there a generally adapted open source library or code fragment that you've found solves this problem with or without using haversine?

谢谢!

推荐答案

我使用了可移动的类型脚本-余弦的余弦和球面定律都可用.这些代码示例都是用JavaScript编写的,但是它们很容易转换为C或Objective C.

I've used some of the snippets available from Movable Type Scripts - both haversine and spherical law of cosines available. The code examples are all in JavaScript, but they translate very easily to C or Objective C.

这篇关于计算指南针朝向CLLocation-iOS的Haversine函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-06 06:48