3 ms·
The purpose of the space filling curve is to preserve locality when you store the two dimensional data on a one dimensional storage medium. If you used x and y
by danbruc 11y ago
The purpose of the space filling curve is to preserve locality when you store the two dimensional data on a one dimensional storage medium. If you used x and y coordinates and stored the data like an image row by row, then data of cells adjacent in the x direction would get stored close together but data of cells adjacent in the y direction would get stored quite a bit away because of the other cells of the rows in between. On the other hand the Hilbert curve keeps cells adjacent in both directions closer together and therefore preserves locality better which in turn means less read head repositioning on spinning disks or a better hit probability when you prefetch adjacent data.
- david-given 11y agoIt also allows you to do the opposite, and turn a single-dimensional quantity into two-dimensional coordinates in a useful manner. The most famous example I know is, of course, XKCD's Map of the Internet: https://xkcd.com/195/ https://xkcd.com/195/