作者热门文章
- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
我是 objective-c 的新手,所以如果我的问题太垃圾,我想道歉。
我正在编写一个指南针,但它正在运行(感谢教程)。给出了实际位置(经度和纬度)。我的指南针内的箭头是否可以向我显示特定位置(经度 2 和纬度 2)的方向?我读到我必须考虑 iphone 的磁性和真实航向。
最佳答案
- (void)locationManager:(CLLocationManager *)manager didUpdateHeading:(CLHeading *)newHeading {
double heading = newHeading.trueHeading; //in degree relative to true north
double bearing = ... //get current bearing in degree relative to true north
//with the JS library mentioned below it would be something like
//bearing = userLoc.bearingTo(destionation);
//just two lines, the the sake of the example
double rotationInDegree = (bearing - heading); //the important line
rotationInDegree = fmod((rotationInDegree + 360), 360); //just to be on the safe side :-)
compassViewPerhapsAsImage.transform=CGAffineTransformMakeRotation(DegreesToRadians(rotationInDegree));
}
计算方位的好链接:
关于显示特定位置的 iPhone 罗盘,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7298193/
我是 objective-c 的新手,所以如果我的问题太垃圾,我想道歉。 我正在编写一个指南针,但它正在运行(感谢教程)。给出了实际位置(经度和纬度)。我的指南针内的箭头是否可以向我显示特定位置(经度
我正在为移动设备开发“指南针”。我有以下几点: point 1 (current location): Latitude = 47.2246, Longitude = 8.8257 point 2 (
有没有办法在 SQL Server 2008R2 中知道一个点是否在另一点的南、东等? 例如,我有一个来源 point(lat1,lng1)我想知道在哪里point(lat2,lng2)位于该原点:北
我正在尝试在 Windows Phone 项目上使用 GART ( http://gart.codeplex.com/ ),它需要使用陀螺仪。 大多数时候我觉得陀螺仪没有校准并且显示错误的结果。 有没
在我的印象中,iOS 中 Google map 的指南针效果非常好。我说的是 map 中蓝色小“我的位置”点的罗盘箭头,请参阅 Google Maps SDK - My Location .在最近的1
我是一名优秀的程序员,十分优秀!