Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Heading-tracking mode takes the long way around #1199

Closed
friedbunny opened this issue Apr 3, 2015 · 4 comments · Fixed by #1295
Closed

Heading-tracking mode takes the long way around #1199

friedbunny opened this issue Apr 3, 2015 · 4 comments · Fixed by #1295
Labels
bug iOS Mapbox Maps SDK for iOS

Comments

@friedbunny
Copy link
Contributor

When using MGLUserTrackingModeFollowWithHeading, rotating the device several degrees around due south causes the map to go the wrong way to get there.

rotation-bug

@incanus incanus added bug iOS Mapbox Maps SDK for iOS labels Apr 3, 2015
@friedbunny
Copy link
Contributor Author

The headings from [MGLMapView locationManager:didUpdateHeading:] are good.

11:48:25.347 Mapbox GL[3393:500129] headingDirection: 179.321411 (true:179.321411/mag:165.504303)
11:48:28.515 Mapbox GL[3393:500129] headingDirection: 184.756287 (true:184.756287/mag:170.939178)
11:48:34.055 Mapbox GL[3393:500129] headingDirection: 179.454987 (true:179.454987/mag:165.637878)
11:48:35.089 Mapbox GL[3393:500129] headingDirection: 184.748398 (true:184.748398/mag:170.931290)
11:48:36.282 Mapbox GL[3393:500129] headingDirection: 179.720413 (true:179.720413/mag:165.903305)
11:48:37.559 Mapbox GL[3393:500129] headingDirection: 185.071442 (true:185.071442/mag:171.254333)

@friedbunny
Copy link
Contributor Author

Transform::_setAngle is interpolating between negative and positive angles, where headings < 180º become negative angles.

headingDirection: 174.973160
Transform::_setAngle: -2.920038 → -3.053858
headingDirection: 180.300735
Transform::_setAngle: -3.0225753.136344
headingDirection: 174.859329
Transform::_setAngle: 3.136344 → -3.051871
headingDirection: 180.390106
Transform::_setAngle: -3.0518713.134784

@friedbunny
Copy link
Contributor Author

@kkaefer, perhaps you've got some ideas about the best way to fix what appears to be an interpolation issue?

@jfirebaugh
Copy link
Contributor

This looks like the native version of mapbox/mapbox-gl-js#818, probably a similar fix should be applied.

1ec5 added a commit that referenced this issue Apr 19, 2015
fmodf() would conflict with the fix for #1199.
1ec5 added a commit that referenced this issue Apr 19, 2015
Ported mapbox/mapbox-gl-js#821 as well as `util.wrap()` from mapbox-gl-js.

Fixes #1199.
This was referenced Apr 19, 2015
1ec5 added a commit that referenced this issue Apr 20, 2015
Ported mapbox/mapbox-gl-js#821 as well as `util.wrap()` from mapbox-gl-js.

Fixes #1199.
1ec5 added a commit that referenced this issue May 6, 2015
#1295 made #1199 a lot less common, but it was still possible for the map to do a full 180° when drift-rotating past due-south. With this change, the map is atomically rotated to a bearing in the same cycle as the final bearing.

/cc @friedbunny
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug iOS Mapbox Maps SDK for iOS
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants