Nicolas Allemand

Music, game dev and emulation.

Today I stumbled upon a really cool wikipedia article which deals with a remarkable subject: quadtrees. As it says,

a quadtree is a tree data structure in which each internal node has four children.

Wikipedia

Let me show you an example for you to visualize this:
Screenshot of a quadtree Each node has four children

The implementation is fairly simple, and I wanted to go a bit further. That's when I found koalastothemax. It is a quadtree implementation applied to an image : basically, for each child, you have to compute its colour, which is the average of all the image's pixels colours inside it.

Here's the result:
Screenshot a quadtree-based image
Another screenshot of a quadtree-base image