Quadtree Art, Part 2: Linear Subdivision with Quads

Published on

With the SDL and framebuffer setup in place we now dive into subdividing the image.

In this second part we build a basic quadtree system using a dynamic array (essentially a queue). Each quad is subdivided into four children and those are appended to the array.


What You’ll Learn


What’s Missing

This method uses no prioritization.

We pick the next quad from the array in order, regardless of whether it has high or low color variation. This means:

Still it creates a pleasing and abstract reveal of the image.


Project Code

You will find the complete source code here: quadtree-art

After building and running the project you will see your image rendered as large color block. Press any key to progressively split the image into smaller quads. Each quad is rendered with its average color. There is no prioritization yet, so the image is refined in order revealing detail bit by bit across the entire canvas.


External Resources

Acknowledgements


Next Up

In the final part we introduce a min-heap priority queue to guide the subdivision process by error and area. The result is much more coherent and satisfying.