Skip to content

BenWiederhake/PiWalkLn

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PiWalkLn

Random walk meets digits of pi, meets neat visualization

What is this?

Take the digits of pi, use them as walking instructions, turn by a fixed angle after each digit. As one can consider pi to behave normal, the walk will stay reasonably close to the starting point.

(3k digits with angle 60°)

Don't get me wrong, pi does wander off considerably, but in relation to how far away it could go, it's not much.

Why the fisheye?

Like I said, pi is an untamed beast that likes to wander both the unexplored paths of the canvas and the well-known neighborhood of it's own tail. Here's how it would look like without the transformation:

(10k digits with the noisiest angle, but without fisheye projection)

As you can see, the image is large, it's too far zoomed out, and part of the trail is missing (it should go to blue as in (0, 0, 255)).

Thus the idea of using transformed coordinates: the further away from the center, the more crunched/compressed the image is. This allows a very large region to be covered, while still showing the "pattern" at a comfortable size.

(10k digits with the noisiest angle, but with fisheye projection)

Seriously, how does the fisheye thing work?

I don't know why you're interested, but it's a very simple idea:

  • If the distance (to the starting point (0, 0), which will be at the center of the image) is less-or-equal 1, then keep it.
  • If the distance is bigger, use 1 + ln d instead.

Here's what a Hilbert Walk (which is great to visualize how a square gets distorted) looks like using this projection:

What?

Thanks for asking.

This composite function has the wonderful property of being continuously differentiable, which means that the transition between "keep it" and "use 1 + ln d" is smooth.

Also, it means that the covered walk-space grows exponentially with image size, which means that we can always keep the walk "in sight". Don't let pi escape!

What's with the weird grey lines that don't form a box?

These do form a box, but they're distorted by the fisheye projection.

  • dark grey: rectangle from (-2,-1) to (2,1)
  • medium grey: rectangle from (-20,-10) to (20,10)
  • light grey: rectangle from (-200,-100) to (200,100)

(1k digits with angle 179°)

So what does it look like?

Thanks for asking! I want to show you even more images:

(10k digits with angle 90°)

(30 digits with angle 18°)

For more samples, look at the samples folder. Or, hey, why don't you clone it and experiment yourself? Feel free to share awesome images by making a PR :D

About

Random walk meets digits of pi, meets neat visualization

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages