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
Documentation for H3 Directed Edge Index could be better. #657
Comments
Did you see https://h3geo.org/docs/core-library/h3Indexing ? |
Yes, first link, looked at it like a million times by now, feels like it. Ultimately I got it... but the wording is a bit confusing for example: "4 bits to indicate the H3 Unidirectional Edge index mode," While the bit layout does not show these words, I just shows "mode'. So a better description would be something like: "The 4 bit mode field is used to indicate the H3 Unidirectional Edge index mode," Another example: "3 bits to indicate the edge (1-6) of the origin cell," A better description would be: "The 3 bit Mode-Dependent field is used to store the edge (1-6) of the origin cell," Concerning link two, it does not follow the original layout as shown in link 1, so that feels a bit like a disconnect and it's not interactive, where the fields can be individually manipulated to see the effect, not that it would be of much use, maybe a little bit. What is important is to show the different type of indexes and how they dependent on the mode field. However to explain the basic concept of H3 Index it's alright but that is kinda already done in the layout on link 1, which btw could also be a bit better, to me it seems kind upside down... and the left values could be placed on the right, or changed to make more sense. Plus the hexadecimal is more confusing than it does any good, plus each row could be counted. I will give you myself which is somewhat usefull how to quickly see the correct offset. I also find the bit layout on link 1 kinda confusing/misleading because it does not use multiple blocks to depict 3 bits, so for example it uses 1 box for 3 bits, instead of 3 boxes for 3 bits. The latter would be a bit more clear. Example:
(I have re-posted this under a new issue, because I think it is worth filing it under a better title description, to find it back in the future, in that posting I also have re-arranged the legend to match the table under it a bit better, and also gave a better description how the current table on link 1 has it's problems). |
My initial depiction for myself was this, but the above one is a bit nicer because it follows the link 1 picture better:
|
The first ascii art could even be improved, by numbering the letters depending on which bit it is, in case there is any doubt which bit is the high order and which bit is the low order, this might actually not be such a bad idea, in case code is ported to other machine that have a different bit endianness, there is also byte endianness to worry about. However I think the picture is pretty clear, the order is clear, and the fields are small enough to count which bit position it is, so adding bit numbers to it would probably make more clutter than it's worth it, but it could still be considered. |
I had a hard time figuring out where the bits go.
After studieing the C source code and it's macros and it's bitset offsets and it's masks I came to the conclusion that:
"3 bits to indicate the edge (1-6) of the origin cell" are mapped to "Mode-Dependent" as depicted later down at
"Bit layout of H3Index".
The source code however calls these "reserved bits" not to be confused with the "reserved bit".
Perhaps source code could be modified so it renames to "mode-dependent".
So all mode 2 for a H3Index seems to do is write 1 to 6 to the mode-dependent 3 bits to indicate some kind of edge.
I am still trying to understand how edges and mode 2 work. The documentation could also be better in this regards/expanded/extended to example how these additional 3 bits or how mode 2 is used in code.
But the most important thing is for implementators/users/bindings to be able to understand how to setup an H3Index correctly.
The next part also isn't terribly clear:
"Subsequent bits matching the index bits of the origin cell."
This is knowledge from the source code, it indeed copies these bits from the origin cell, but this is completely obviously to the end user because the end user doesn't even know how it all works and why it does this.
What is far more important is how the bits are used.
Basically they are used to same way as mode 1.
Again 0 to 15 cell indexes.
Perhaps it's best to make a bit layout per mode, so it's perfectly clear how each mode is used. Just a textual description could be interpreted in all kinds of ways without knowing for sure...
Except if the user strictly follows the order, from highest 64 bit to lower bits...
The old saying, "a picture describes a 1000 words" might apply here ! ;)
The risk is that less experienced programmers will interpret the documentation/description/lines of explanation out of order and reinterpret them in their own way. For example mapping 3 bits to the wrong bits because of miss-understanding.
There is further room for confusion, because of the 1st reversed bit and the other 3 reserved bits which are actually depicted as mode-dependent bits.
Only studieing the source code clearifies this. Hopefully the documentation can be improved to make it more clear.
The text was updated successfully, but these errors were encountered: