-
Notifications
You must be signed in to change notification settings - Fork 684
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Templatize Point2/PointLL #2429
Merged
Merged
Conversation
This file contains 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
… for increased precision.
danpat
force-pushed
the
danpat_point2_refactor
branch
from
June 23, 2020 00:01
f9de4e2
to
0ec6e7e
Compare
…red other compilation bugs.
@kevinkreiser @purew This is ready for a round of 👀 |
purew
reviewed
Jun 26, 2020
… (sans optimization)
…ise there that leads to a few cm error.
purew
reviewed
Jun 26, 2020
purew
previously approved these changes
Jun 30, 2020
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🍰
kevinkreiser
approved these changes
Jun 30, 2020
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.
Issue
The
Point2
class, (andPointLL
that is subclassed from it) is hard-coded to usefloat
.Most of the time, this is fine. But sometimes, you want to do something that requires a bit more precision. In my case, I'm splitting geometry using
midgard::trim_polyline
.This leads to creating new points along existing lines. When using
float
, practical precision is limited to about 0.5m wrt geospatial coordinates. Most of the time this is fine.However, in my case, I'm rendering a map with the original geometry, plus some newly injected intermediate points created by
midgard::trim_polyline
.When
float
precision is used, sometimes the error margin becomes visible in weird ways, like in the circled section in the following screenshot:Using
double
for the newly created types has enough precision that they are "on the line" for all human-practical detail levels -float
does not, and half-metre errors do become visible in some real-world contexts.Long story short - this PR turns
Point2
into a template class, and makes all the necessary changes to support that. Most code remains unchanged, andfloat
precision remains the default, but this refactor allows you to optionally choosePointXY<double>
orGeoPoint<double>
(for sphericalDistance
, etc) if you need the extra detail for some reason.Tasklist
Requirements / Relations
Link any requirements here. Other pull requests this PR is based on?