Having issues understanding index calculation
nambastha opened this issue · 1 comments
nambastha commented
Hi David
I'm trying to understand how the index is getting calculated in your code.
SmallHilbertCurve c =
HilbertCurve.small().bits(1).dimensions(2);
//returns long rather than BigInteger
long index = c.index(0,2);
It returns 0. Can you help me in understanding how it's 0 as distance between point 0 to 2 should come as 2.
Thanks in advance.
davidmoten commented
You are trying an extreme case. By setting bits=1 then each of the axes varies from 0 to 1 only. Thus in fact (0,2) is outside the domain and probably wraps around to (0,0).