首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > 移动开发 >

已知一个点的中纬度,通过距离求另外一个点的经纬度

2012-09-27 
已知一个点的经纬度,通过距离求另外一个点的经纬度-(CLLocation*) moveLocation:(CLLocation*)startLocati

已知一个点的经纬度,通过距离求另外一个点的经纬度

-(CLLocation*) moveLocation:(CLLocation*)startLocation:(double)movementInMeters:(double)movementBearing{doubledist = (movementInMeters / 1000);/* -> great-circle distance (km) */doublecourse = movementBearing;/* -> initial great-circle course (degrees) */doubleslt = startLocation.coordinate.latitude;/* -> starting decimal latitude (-S) */doubleslg = startLocation.coordinate.longitude;/* -> starting decimal longitude(-W) */doublexlt = 0;/* <- ending decimal latitude (-S) */doublexlg = 0;/* <- ending decimal longitude(-W) */doublec, d, dLo, L1, L2, coL1, coL2, l;if (dist > KmPerDegree*180.0) {course -= 180.0;if (course < 0.0) course += 360.0;dist    = KmPerDegree*360.0-dist;}if (course > 180.0) course -= 360.0;c    = course*RadiansPerDegree;d    = dist*DegreesPerKm*RadiansPerDegree;L1   = slt*RadiansPerDegree;slg *= RadiansPerDegree;coL1 = (90.0-slt)*RadiansPerDegree;coL2 = ahav(hav(c)/(sec(L1)*csc(d))+hav(d-coL1));L2   = HalfPI-coL2;l    = L2-L1;if ((dLo=(cos(L1)*cos(L2))) != 0.0)dLo  = ahav((hav(d)-hav(l))/dLo);if (c < 0.0) dLo = -dLo;slg += dLo;if (slg < -PI)slg += TwoPI;else if (slg > PI)slg -= TwoPI;xlt = L2*DegreesPerRadian;xlg = slg*DegreesPerRadian;CLLocation *tempLocation = [[[CLLocation alloc] initWithLatitude:xlt longitude:xlg] autorelease];return tempLocation;}
?

热点排行