【发布时间】:2011-08-28 07:26:18
【问题描述】:
我有一系列 lat/lon 代表某个对象的中心。我需要在中心两边各 x 米处画一条线并且它需要垂直于航向(想象一个大写字母T)
最后我想得到这条线端点的纬度/经度。
谢谢!
【问题讨论】:
我有一系列 lat/lon 代表某个对象的中心。我需要在中心两边各 x 米处画一条线并且它需要垂直于航向(想象一个大写字母T)
最后我想得到这条线端点的纬度/经度。
谢谢!
【问题讨论】:
基本计算在这个类似问题的答案中:Calculate second point knowing the starting point and distance。计算垂直于主航向的两个航向的点,距离您想要的距离。
【讨论】:
看看:Core Location extensions for bearing and distance
有了这些扩展和初始线上的两个点,您应该能够得到方位,加/减 pi/2 并找到任意一侧的点,如下所示:
double bearing = [bottomOfT bearingInRadiansTowardsLocation:topOfT];
CLLocation *left = [topOfT newLocationAtDistance:meters
alongBearingradians:bearing+M_PI/2];
CLLocation *right = [topOfT newLocationAtDistance:meters
alongBearingradians:bearing-M_PI/2];
【讨论】: