How do I make the following Moiré pattern?
I tried:
A = Plot[Table[n, {n, 1, 30}], {x, 0, 31},
GridLines -> {Table[n, {n, 1, 30}], None},
GridLinesStyle -> AbsoluteThickness[1.2], PlotStyle -> Gray,
Axes -> False, AspectRatio -> 1]
B = Rotate[A, -30 Degree]
C = Rotate[A, -60 Degree]
Answer
I feel that once you start with Moire patterns, there's no ending. The way I would replicate these is by making a grid into a function (like @JasonB) but also parametrise the angle of rotation into it:
lines[t_, n_] :=
Line /@ ({RotationMatrix[t].# & /@ {{-1, #}, {1, #}},
RotationMatrix[t].# & /@ {{#, -1}, {#, 1}}} & /@
Range[-1, 1, 2/n]) // Graphics;
So that you can vary the number of lines n
and rotation parameter t
as well. Now your image is (more or less):
lines[#, 40] & /@ Range[0, π - π/3, π/3] // Show
And you can play more with these two parameters. Here's what you get if you superimpose grids with very small relative angle differences:
lines[#, 100] & /@ Range[-π/300, π/300, π/300] // Show
Or randomising the spacing and angle of each grid:
lines[Cos[# π/30], #] & /@ RandomInteger[{1, 20}, 9] // Show
and -as an overkill- harmonically varying these two effects results in great gif potential
gif = Table[Show[{lines[0, Floor[10 + 9 Cos[t]]], lines[-2 π/3 Cos[t], 20],
lines[+2 π/3 Cos[t], 20]},
PlotRange -> {{-1.5, 1.5}, {-1.5, 1.5}},
ImageSize -> 200], {t, -π/2, π/2 - π/70, π/70}];
Export["moire.gif", gif]
Comments
Post a Comment