Skip to content

Instantly share code, notes, and snippets.

View mikedouglas's full-sized avatar

Michael Douglas mikedouglas

View GitHub Profile
@mikedouglas
mikedouglas / README.mkd
Created August 20, 2011 05:24 — forked from mbostock/.block
Hilbert Tiles

Say you have a bunch of things, like thousands of photos from your digital camera. What if you wanted to look at them all at once? A typical user interface might order the photos chronologically by column and then by row, which does a decent job of grouping related photos together... But, if you have thousands of photos, the rows may be hundreds of photos long, and it is impossible to zoom in on a group of related photos!

An alternative that better preserves locality is a space-filling curve, such as the Hilbert curve. These curves can be used to place related things next to each other in space, avoiding those huge gaps across rows you see with sequential layout.

This example demonstrates the effect of using a Hilbert curve for layout with Polymaps by generating rainbow-colored tiles. As you can see, each tile is surrounded by its adjacent colors in the rainbow, even as you zoom in and ou