views:

105

answers:

1

The algorithm name is after some mathematician.

You can traverse image line by line of course, but you can traverse image using recursive generated path, which the basic blocks looks like:

U

This one is for traversal 2x2 pixels image. If you have bigger image, you "multiply" this block (rotated or not) for each segment. The result is snake-like path.

So, maybe you remember the name of this algorithm :-) Thank you in advance.

+6  A: 

I believe it may be Hilbert Traversal or the Hilbert Curve.

See, e.g. http://corte.si/posts/code/hilbert/portrait/index.html

alt text

Paul R
Bingo! Thank you very much.
macias
@Macias, do the decent thing and accept @Paul's answer.
High Performance Mark
I know about accepting answers, but StackOverflow forbids to accept answer in short period (crazy as it sounds, it is how it works).
macias
Note that if you use that curve to traverse an 2d array, it's highly inefficient vrt. processor cache.
Pasi Savolainen