I see these around the web and would like to make them in Mathematica.
Combining them in an array is actually quite mesmerizing!
One way to do it is to create the texture for one tile and then transform repeated copies of it in a way that resembles the original illusion.
First we create the tile:
Then we make repeated copies of it:
For the transformation we can use an exponential mapping, which will turn the $y$-coordinate into an angle and the $x$-coordinate into an exponent for radial distance. Since the mapping is most elegantly described with complex numbers but we need to work with cartesian coordinates we can use
Since this is so useful we wrap it in a procedure for easy reuse:
Now we just need a way to transform our checkerboard image according to our mapping, which is exactly what
Michael E2 pointed out another possible way, namely using the inverse mapping, so let's try that! Up to now we basically let Mathematica do a forward transform of our checkerboard into the disk shape and let it fill the holes via interpolation and throw away the points that got mapped outside of our
Instead we can go the reverse route and start with the destination pixel locations and ask where they came from before undergoing that exponential mapping. Since we made the effort to generalize the procedure of getting a cartesian mapping from any complex function we now can just plug in the inverse complex function, which is the (or rather a branch of) the complex
Great! Now we can use
where we had to adjust the
To see the difference here are images from both approaches, but generated from a tile with
I decided to take a slightly different approach. Instead of transforming an image, I thought of constructing a function that will look like the illusory figure in the OP after performing the log-polar transform. Here's what I came up with:
Here is a
The illusion can be created completely in vector form without using any plotting function. I'll start from the wonderfully elegant solution by Thies Heidecke.
The key change is that instead of
Now the illusion can be generated as follows:
We can turn on antialiasing using