【发布时间】:2025-12-22 00:10:07
【问题描述】:
我有两个位置的纬度和经度。
我已经知道这两个位置之间的距离了。
CLLocation *locA = [[CLLocation alloc] initWithLatitude:[player.strLatitude floatValue] longitude:[player.strLongitude floatValue]];
CLLocation *locB = [[CLLocation alloc] initWithLatitude:app.lat longitude:app.lag];
CLLocationDistance distance = [locB distanceFromLocation:locA];
NSLog(@"Distance%f",distance);
[locA release]; [locB release];
现在我想找出这两个位置之间的角度。
在中心有一个用户位置,我想在该 Cicle 中以适当的角度显示其他用户位置。
感谢您的帮助。
【问题讨论】:
-
您只是在寻找 atan2f 函数吗?
-
对不起,我不知道 atan2f 函数。可以给个链接吗?
-
你有没有跳过初等数学课...?
-
@holex 我知道 atan 的含义,但我不知道如何用它来找到两个 CLLocation 之间的角度!!!!!!!!!!!!!!!!!!!!!跨度>
-
它只是基本的三角函数。有人提到了
tan,但我认为对于该解决方案,cos的法律可以在这里更容易地实施,check the formula。
标签: iphone ios cllocationmanager angle