Skip to content
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

Consistent pentagon local IJ coords #234

Merged
merged 5 commits into from
May 28, 2019

Conversation

isaacbrodsky
Copy link
Collaborator

Change failed directions so that more than one face cannot be crossed
when unfolding a pentagon. This should fix #184 by disallowing this kind of line.

Change failed directions so that more than one face cannot be crossed
when unfolding a pentagon.
@coveralls
Copy link

coveralls commented May 15, 2019

Coverage Status

Coverage remained the same at 100.0% when pulling 8399808 on isaacbrodsky:local-ij-origin-dependent into a6cd31b on uber:master.

* within the pentagon base cell.
*
* This previously included a Class II/Class III check but these were removed
* due failure cases. It's possible this could be restricted to a narrower set
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit: due to failure cases.

Copy link
Collaborator

@nrabinowitz nrabinowitz left a comment

Choose a reason for hiding this comment

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

LG, though I think the CHANGELOG comment overstates the change.

CHANGELOG.md Outdated
@@ -6,6 +6,8 @@ The public API of this library consists of the functions declared in file
[h3api.h.in](./src/h3lib/include/h3api.h.in).

## [Unreleased]
### Changed
- Local coordinate spaces cannot cross more than one icosahedron face.
Copy link
Collaborator

Choose a reason for hiding this comment

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

This restriction only applies to pentagons, right?

// https://github.com/uber/h3/issues/163
if (FAILED_DIRECTIONS_III[originLeadingDigit][dir] ||
FAILED_DIRECTIONS_II[originLeadingDigit][dir]) {
if (FAILED_DIRECTIONS[originLeadingDigit][dir]) {
// TODO this part of the pentagon might not be unfolded
// correctly.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit: Not a big deal, but reading this comment makes me think something is incorrect, rather than something might be incorrect and so we're throwing an error. Maybe TODO: this part of the pentagon might not be unfolded correctly, so throw an error for now?

@@ -188,8 +188,8 @@ int h3ToLocalIjk(H3Index origin, H3Index h3, CoordIJK* out) {
int originLeadingDigit = _h3LeadingNonZeroDigit(origin);

if (FAILED_DIRECTIONS[originLeadingDigit][dir]) {
// TODO this part of the pentagon might not be unfolded
// correctly.
// TODO In this case this part of the pentagon might not be
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit: In this case this part... -> In case this part...

Copy link
Collaborator

Choose a reason for hiding this comment

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

No, I think it's correct as is - "in case" means you don't know whether something might occur, but you want to anticipate it; "in this case" means you are clear that in the current context something will occur, and you are handling it.

Copy link
Collaborator

Choose a reason for hiding this comment

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

But we don't know if it's actually unfolding incorrectly or not, so in case that would happen we're doing something. The current phrasing is very confusing.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I requested this change, because every time I see this comment I think that return 3 is thought to be possibly incorrect, instead of being a correct guard against possible issues. Open to other options. Maybe

TODO: We may be unfolding the pentagon incorrectly in this case; return an error
code until this is guaranteed to be correct.

?

Copy link
Collaborator

Choose a reason for hiding this comment

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

That one is definitely clear.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'll update with the revised wording @nrabinowitz suggested

@isaacbrodsky isaacbrodsky merged commit 7c69f57 into uber:master May 28, 2019
@isaacbrodsky isaacbrodsky deleted the local-ij-origin-dependent branch May 28, 2019 20:23
mrdvt92 pushed a commit to mrdvt92/h3 that referenced this pull request Jun 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

h3Line algorithm has error cases crossing pentagons
4 participants