4 ms·
I don't see how your example works? consider how to implement zoom out generically. We do the 1d case and lose nothing compared to the 2d case. Let some seque
by nh23423fefe 4y ago
I don't see how your example works? consider how to implement zoom out generically.
We do the 1d case and lose nothing compared to the 2d case.
Let some sequence of 2n tiles labelled [k+1 k+2 ... k+2n] and we wish to map to a sequence of n tiles labelled [l+1 ... l+n]
map e = (e - (k+1)) `intdiv` 2 + (l+1)
where intdiv is just the usual truncating division
mapping from 1-based array to 1-based array instantiates k=l=0
so
map e = (e - 1)/2 + 1
clearly the simplest map is actually instantiating k = l = -1 which is 0-based
map e = e/2
So now consider the half open case. it must also work the same way. because the 2 tiles beyond the last one map to the 1 tile beyond the sequence to be mapped to. it couldn't work any other way.
The solution is using a 0-based array, not the choice between closed or half open.