Open IJzerbaard opened 4 years ago
I've been thinking about this, and as you say, it would take the library away from purely encoding/decoding.
Then again, it is useful.
Do a PR if you want to :)
I think I might add this to a seperate header, morton_ops.h
A good thing for the todo list!
This is indeed very useful; did this get done later? :-) We have some 20+ year old code that uses incremental indexing extensively and it is very inexpensive even in scalar processing mode.
It's still on the todo list - feel free to write it and make a PR :p
We will start working on that.
It is possible to quickly (that is, without going through a decode-modify-encode pipeline) compute neighbours of a Morton-encoded coordinate. The technique is mentioned on wikipedia.
That could be useful to add, though I realise the description of this library only mentions encoding and decoding.