Question

I'm using AR Toolkit, but I'm not sure if it is working well or if I have a problem with my iPhone.

When I try to locate a point, I see its label on its right. It never points to that location. Do you have the same problem?

In other words, when I see on iPhone's screen the place that I'm trying to point. I see that place and its label at its right side.

I'm not sure if I have a problem with my compass or the toolkit doesn't work well.

Any clue?

No correct solution

OTHER TIPS

I have modified my calculation, for direction with reference to Link

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

Note: poiLon,poiLat -from positions in this context radCurrLatPoi,radCurrLonPoi-To position in this context

This works well for few point,,It does not match at this particular scenario

My current Location: 18.551861,73.942108

My point of Interest: 73.943202,18.552456 73.943693,18.552754 73.943275,18.552687

I think this might be due to me completing a 360 angle...Any suggestion

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top