Recently, a friend brought up this illusory figure by Kitaoka Akiyoshi, which could be considered as a further elaboration of the more popular café wall illusion. I thought it wouldn't be too hard to redo this in Mathematica, so I went for it.
The first step is to construct "bricks" for this new dizzying wall:
tile1p = ColorConvert[Rasterize[
Graphics[{{Rectangle[{0, 0}, {1, 1}], Rectangle[{2, 2}, {3, 3}]},
{FaceForm[], EdgeForm[Directive[AbsoluteThickness[6], Gray]],
Rectangle[{0, 0}, {3, 3}]}}, ImageSize -> Small,
PlotRange -> {{0, 3}, {0, 3}}, PlotRangePadding -> None],
"Image"], "Grayscale"];
tile1m = ColorNegate[tile1p];
tile2p = ImageRotate[tile1p, π/2];
tile2m = ColorNegate[tile2p];
tile3p = ColorConvert[Rasterize[
Graphics[{{Rectangle[{0, 0}, {1, 1}], Rectangle[{2, 0}, {3, 1}]},
{FaceForm[], EdgeForm[Directive[AbsoluteThickness[6], Gray]],
Rectangle[{0, 0}, {3, 3}]}}, ImageSize -> Small,
PlotRange -> {{0, 3}, {0, 3}}, PlotRangePadding -> None],
"Image"], "Grayscale"];
tile3m = ColorNegate[tile3p];
tile4p = ImageRotate[tile3p, π];
tile4m = ColorNegate[tile4p];
I needed to stare at Kitaoka's original image for quite a while to grok the pattern; having done so, I figured using a Switch[]
in a Table[]
would be easiest for me. Thus, here's how to show (a smaller version of) Kitaoka's wall:
With[{m = 20, n = 53},
kita = ImageAssemble[Table[Switch[Mod[j, 2, 1],
1, Switch[Mod[k, 18, 1],
x_ /; x < 9, If[Mod[k, 2, 1] == 1,
tile1m, tile1p],
9, tile3m,
x_ /; x < 18, If[Mod[k, 2, 1] == 1,
tile2m, tile2p],
18, tile4p],
2, Switch[Mod[k, 18, 1],
x_ /; x < 9, If[Mod[k, 2, 1] == 1,
tile1p, tile1m],
9, tile3p,
x_ /; x < 18, If[Mod[k, 2, 1] == 1,
tile2p, tile2m],
18, tile4m]],
{j, m}, {k, n}]]]
The effect is already pretty striking in grayscale:
Applying a splash of color, however, seemed to either magnify or mute the effect for my eyes. For instance,
Colorize[kita, ColorFunction -> "M10DefaultDensityGradient"]
does a number on my eyes, while with
Colorize[kita, ColorFunction -> "ThermometerColors"]
the lines do not look too bent at all as I see it.
Of course, one can make a "vector" version of this by tiling appropriate Polygon[]
objects in Graphics[]
, instead of using ImageAssemble[]
like I did. (This would be important if you try to implement Charlie Deck's animated variation.) I'll leave that for someone else to do.