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

Clean up coordinate types - #3873

Merged
brunoabinader merged 15 commits into
masterfrom
3785-too-many-coordinates
Mar 1, 2016
Merged

brunoabinader merged 15 commits into
masterfrom
3785-too-many-coordinates

Conversation

@brunoabinader

Copy link
Copy Markdown
Contributor

As per #3785, this PR main changes are:

  • Replace TileCoordinate with TileID
  • Make TileID coordinates use double precision
  • Remove duplicated vec4 implementation
  • Renamed PrecisionPoint to ScreenCoordinate
  • Cleanup usage of vec{2,3,4} and std::array<float, 2> - they are still used in some places though no longer in coordinate-related logic

👀 @jfirebaugh @tmpsantos @1ec5 @kkaefer

Comment thread src/mbgl/map/transform_state.cpp Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method should be renamed latLngToScreenCoordinate(), right?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch 👍 I'll update the TransformState function names accordingly.

@brunoabinader
brunoabinader force-pushed the 3785-too-many-coordinates branch from c8ea0c2 to e9f0875 Compare February 10, 2016 11:49
@kkaefer

kkaefer commented Feb 10, 2016

Copy link
Copy Markdown
Member

Make TileID coordinates use double precision

I strongly disagree with this change. These are integer because tile endpoints are integer only. Making them floating point may introduce subtle epsilon bugs when comparing tile IDs.

@brunoabinader
brunoabinader force-pushed the 3785-too-many-coordinates branch from e9f0875 to a01f822 Compare February 10, 2016 12:44
Comment thread src/mbgl/map/source_info.hpp Outdated
std::string attribution;
std::array<float, 3> center = { { 0, 0, 0 } };
std::array<float, 4> bounds = { { -180, -90, 180, 90 } };
vec3<> center = { 0, 0, 0 };

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LatLng center;
double zoom;
LatLngBounds bounds;

@jfirebaugh

Copy link
Copy Markdown
Contributor

I agree with @kkaefer, I don't think should replace TileCoordinate with TileID and make TileID coordinates double. Instead, we should reduce the usage of TileCoordinate to just tileCover and then inline it there, and some set of TileID changes suggested in #3834 and #3529, but keep it integer based.

@brunoabinader
brunoabinader force-pushed the 3785-too-many-coordinates branch from a01f822 to 6e3cfa8 Compare February 22, 2016 00:27
@brunoabinader brunoabinader added the ⚠️ DO NOT MERGE Work in progress, proof of concept, or on hold label Feb 22, 2016
@brunoabinader
brunoabinader force-pushed the 3785-too-many-coordinates branch 3 times, most recently from 199154c to 6ede00f Compare February 22, 2016 17:44
@brunoabinader
brunoabinader force-pushed the 3785-too-many-coordinates branch 4 times, most recently from ee9a42f to a19acf3 Compare February 24, 2016 02:03
@brunoabinader brunoabinader added ✓ ready for review and removed in progress ⚠️ DO NOT MERGE Work in progress, proof of concept, or on hold labels Feb 24, 2016
@brunoabinader

Copy link
Copy Markdown
Contributor Author

@jfirebaugh @kkaefer this is ready for review now. This PR is getting too big to fit all changes from #3529 so I'd prefer to implement the rest of TileID changes in a followup PR.

TileCoordinate is now scoped to tile cover implementation. I had some issues while clearing it from TransformState::moveLatLng but behavior is kept the same. LatLng now can be wrapped() when needed. This helped me find a small precision loss issue wrt usage of TransformState conversion functions (tests for that are attached).

@brunoabinader
brunoabinader force-pushed the 3785-too-many-coordinates branch from a19acf3 to 3c7f15e Compare February 24, 2016 02:18
@brunoabinader brunoabinader added ⚠️ DO NOT MERGE Work in progress, proof of concept, or on hold and removed ✓ ready for review labels Feb 24, 2016
@brunoabinader

Copy link
Copy Markdown
Contributor Author

Update: I'm investigating a regression in the test suite expectations, will let you know once I have more information.

@kkaefer

kkaefer commented Mar 1, 2016

Copy link
Copy Markdown
Member

@brunoabinader let's remove the last commit ("Initial setup for UnwrappedTileID") and commit this before it gets unwieldy.

@brunoabinader
brunoabinader force-pushed the 3785-too-many-coordinates branch 2 times, most recently from 4762290 to c083fe8 Compare March 1, 2016 21:19
@brunoabinader brunoabinader added ✓ ready for review and removed ⚠️ DO NOT MERGE Work in progress, proof of concept, or on hold labels Mar 1, 2016
Plus type change for zoom and removed redundant inlines.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants