fix: incorrect distance to tile in globe projection#7234
Open
jtfedd wants to merge 5 commits intomaplibre:mainfrom
Open
fix: incorrect distance to tile in globe projection#7234jtfedd wants to merge 5 commits intomaplibre:mainfrom
jtfedd wants to merge 5 commits intomaplibre:mainfrom
Conversation
…o fix-globe-tiling-lod
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7234 +/- ##
=======================================
Coverage 92.71% 92.71%
=======================================
Files 289 289
Lines 24074 24074
Branches 5112 5112
=======================================
+ Hits 22320 22321 +1
+ Misses 1754 1753 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Launch Checklist
CHANGELOG.mdunder the## mainsection.Summary
The distance to tiles was not being calculated correctly with globe projection. This would cause high-detail tiles to be loaded all the way to the horizon which looks incorrect and very slow in the browser.
Root Cause
The issue was specifically in calculating the x distance to the tile. The condition for checking whether the camera is to the right of the tile was checking whether the distance to the tile was greater than
1. Since all of the coordinates are in the range[0..1]this condition is always false, and we would fall into the final case which is that the camera is inside the tile, and return a distance of0. The correct condition is to check whether the camera is to the right of the tile is to check whether the distance from the top-left corner of the tile to the camera position is greater than the width of the tile.Testing
covering_tiles.test.tsto cover cases where the camera is looking toward the horizon in each major direction in globe projection.index.html
Issues
Fixes #7219