adruab.net Deep internal/external searching… for… stuff

3Apr/080

Complete Trees

Aricept Generic Buy Phentrimine Online Avapro Without Prescription VPXL No Prescription Clarinex For Sale Coumadin Generic Buy Prozac Online Elimite Without Prescription Aldactone No Prescription Inderal For Sale

Complete trees are cool. Best part is the closed form for parent/child indices. I had to rederive these equations for a complete quad tree today. It didn't take as long as I was expecting. Here they are if you care...

parent(i) = (i - 1) / 4

child_j of i = (i * 4) + j + 1

It turns out a level of a specific depth has a closed form too. The numbers are 0b, 1b, 101b, 10101b and so on.

level 0 start = 0

level n > 0 start = ((1 << ((n - 1) * 2 + 1)) - 1) & 0x5555555

Essentially this gives you multiples of 4. 1,2,3,4 map to 2^1, 2^3, 2^5, 2^7. Subtracting 1 gives you 1b, 111b, 11111b, 1111111b. Then anding with 0x55555555 should give you the 101010101 pattern.

The main gotcha here is that access to a single group of siblings is swizzled from normal xy access. Once that's done though, you're golden.

Filed under: Programming No Comments
3Apr/080

Isn’t it Funny

Filed under: Video Games No Comments
27Jan/080

Sweet energy saving

Filed under: Personal No Comments
25Jan/080

Do I feel lucky, well?

Filed under: Uncategorized No Comments
15Dec/070

This message will self-destruct

Filed under: Video Games No Comments
13Nov/070

DahnanaNaaaa!

Filed under: Video Games No Comments
12Nov/070

Pressure… building…

Filed under: Video Games No Comments
5Nov/070

And the engine goes…

Filed under: Programming No Comments
28Oct/072

Weee… Time Machine

7Jul/070

Recap XXXIV