Nope. Nope. still can't do it. I swear, this thing is impossible.
grrr. still nothing.
Hrm. Maybe if I did this . . . and this . . . but then this will break, unless . . .
pain pain pain PAIN
AUGH this is going to suck to implement.
Oh well. I didn't really believe in data hiding anyway.
So all I have to do is (five pages of dense algorithm compressed into about two mental "sentences", complete with diagrams).
. . . I *think* it works.
Except I have to go deeper for the recursive cutoff to be efficient, and I can use inclusion/exclusion to make the block flagging more efficient.
The fact that this is almost but not quite integer math makes it much trickier.
This entire thing segues nicely into another LJ entry, which I will write later.