2011-10-11 3 views
1

저는 AR Toolkit을 사용하고 있습니다. 제대로 작동하는지 또는 iPhone에 문제가 있는지 잘 모르겠습니다.iPhone AR 툴킷 또는 나침반의 방향이 잘못됨

포인트를 찾으려고 할 때 오른쪽에 레이블이 표시됩니다. 그 위치를 결코 가리 키지 않습니다. 같은 문제가 있습니까?

즉, 아이폰의 화면에서 내가 가리키고있는 곳을 볼 때. 나는 그 장소와 그 라벨을 오른쪽에 보았다.

내 나침반에 문제가 있거나 툴킷이 제대로 작동하지 않으면 잘 모르겠습니다.

단서가 있습니까?

답변

1

내가

Calculating bearing between two CLLocationCoordinate2Ds

double poiLon = coordinate.coordinateGeoLocation.coordinate.longitude; 
double poiLat = coordinate.coordinateGeoLocation.coordinate.latitude; 
double a = poiLon - self.currentLocation.coordinate.longitude; 
double b = poiLat - self.currentLocation.coordinate.latitude; 

poiLon=degreesToRadians(coordinate.coordinateGeoLocation.coordinate.longitude); 
poiLat=degreesToRadians(coordinate.coordinateGeoLocation.coordinate.latitude); 
double radCurrLatPoi=degreesToRadians(self.currentLocation.coordinate.latitude); 
double radCurrLonPoi=degreesToRadians(self.currentLocation.coordinate.longitude); 

a=sin(poiLon-radCurrLonPoi)*cos(poiLat); 
b=cos(radCurrLatPoi)*sin(poiLat)-sin(radCurrLatPoi)*cos(poiLat)*cos(poiLon-radCurrLonPoi); 

//sin(tLng-fLng)*cos(tLat), cos(fLat)*sin(tLat)-sin(fLat)*cos(tLat)*cos(tLng-fLng) 
double alpha = 180.0 * atan2(a, b)/M_PI; 

if (alpha < 0.0) 
    alpha += 360.0; 
else if (alpha > 360.0) 
    alpha -= 360.0; 

CLLocationDirection theHeading = self.currentHeading.trueHeading; 
double deltaOrient = alpha - theHeading; 
CGFloat X = 320.0/2.0 + (deltaOrient * 320.0f/30.0);//x position 

참고 링크를 참조하여 방향을 위해, 내 계산을 수정 한 : poiLon, 이러한 맥락 radCurrLatPoi에서 poiLat의 -from 위치, radCurrLonPoi이-하기 위해 이러한 맥락에 위치

이 점은이 특정 시나리오에서 잘 작동하지 않습니다.

나의 현재 위치 : 관심 18.551861,73.942108

내 포인트 : 73.943202,18.552456 73.943693,18.552754 73.943275,18.552687

나는이 때문에 나에게 360 각도를 완료하기 것 같아요 ... 모든 제안

+0

CLLocation.horizontalAccuracy를 확인하십시오. 어쩌면이 값이 너무 클 수도 있습니다. – VansFannel