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

[core] Precision loss in Transform::flyTo #4298

Closed
brunoabinader opened this issue Mar 13, 2016 · 6 comments
Closed

[core] Precision loss in Transform::flyTo #4298

brunoabinader opened this issue Mar 13, 2016 · 6 comments
Labels
archived Archived because of inactivity bug Core The cross-platform C++ core, aka mbgl

Comments

@brunoabinader
Copy link
Member

Transform::flyTo loses more precision than Transform::easeTo when animating. Example:

Given point A LatLng { -45, -135 } and point B LatLng { 45, 135 }:
Transform::easeTo from point A to B: LatLng { 44.999999999695532, 135.00000000038369 }

  • Latitude precision loss: 45 - 44.999999999695532 = 3.0446756E-10
  • Longitude precision loss: 135 - 135.00000000038369 = -3.8369308E-10

Transform::flyTo from point B to A: LatLng { -44.999808628745399, -135.00024116863571 }

  • Latitude precision loss: -45 + 44.999808628745399 = -1.9137125E-4
  • Longitude precision loss: -135 + 135.00024116863571 = 2.4116863E-4

The exponent of precision loss from easeTo is -10, while flyTo is -4.

/cc @1ec5

@1ec5
Copy link
Contributor

1ec5 commented Mar 13, 2016

This regression was caused by the additional point-latLng-point round trip added in #3301. I wonder how GL JS gets better precision out of that approach.

@1ec5 1ec5 added the bug label Mar 13, 2016
brunoabinader added a commit that referenced this issue Mar 14, 2016
Simplify LatLng::{wrap,unwrapForShortestPath} code, avoiding duplicated
code between Transform::{latLngToScreenCoordinate,easeTo,flyTo}.

Added unit tests for camera usage in Transform to detect cases like e.g.
crossing the antimeridian as a shortest path between two coordinates.

Transform::flyTo precision loss to be handled in #4298.
@kkaefer kkaefer added the Core The cross-platform C++ core, aka mbgl label May 30, 2017
@jfirebaugh
Copy link
Contributor

From #9199:

Finally, the point interpolation is tweaked so that at the end of the flying (when k === 1) it ends up at the exact end point. I didn't see any bugs related to this, but it seems like a good thing to have explicitly.

This changes the consequences of this bug: instead of ending up at the slightly wrong position at the end of flyTo, it animates to the wrong position, then suddenly snaps to the correct position at the very end.

@stale stale bot added the archived Archived because of inactivity label Nov 6, 2018
@stale
Copy link

stale bot commented Nov 30, 2018

This issue has been automatically detected as stale because it has not had recent activity and will be archived. Thank you for your contributions.

@stale stale bot closed this as completed Nov 30, 2018
@stale stale bot removed the archived Archived because of inactivity label Dec 3, 2018
@stale stale bot added the archived Archived because of inactivity label Jun 1, 2019
@stale
Copy link

stale bot commented Jun 2, 2019

This issue has been automatically detected as stale because it has not had recent activity and will be archived. Thank you for your contributions.

@stale stale bot closed this as completed Jun 2, 2019
@stale stale bot removed the archived Archived because of inactivity label Jun 3, 2019
@brunoabinader
Copy link
Member Author

I guess one way to alleviate this issue would be converting the geographical coordinate all the way into tile coordinates, and keep using that when interpolating.

To be honest, I'd love to see easeTo and flyTo outside of the GL Native core code, and implemented externally as part of a client-side animation interface. /cc @tmpsantos

@stale stale bot added the archived Archived because of inactivity label Dec 1, 2019
@stale
Copy link

stale bot commented Dec 1, 2019

This issue has been automatically detected as stale because it has not had recent activity and will be archived. Thank you for your contributions.

@stale stale bot closed this as completed Dec 1, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
archived Archived because of inactivity bug Core The cross-platform C++ core, aka mbgl
Projects
None yet
Development

No branches or pull requests

5 participants