New answers tagged

8

I am late to see this question but here is a solution closely based on my answer to Creating a Sierpinski gasket with the missing triangles filled in. tri[n_] := Table[{2 j - i, Sqrt[3] i}, {i, 0, n}, {j, i, n}] // Partition[Riffle @@ #, 3, 1] & /@ Partition[#, 2, 1] & Example of use: Map[{RandomColor[], Polygon@#} &, tri[5], {2}] // ...


6

Anothor way by NestList randomTriPlot[n_] := Module[{next}, next[polys_] := Join[Map[# + {-1, -Sqrt[3]} &, polys, {2}], {MapAt[# - 2 Sqrt[3] &, polys[[-1]], {1, 2}], # + {1, -Sqrt[3]} & /@ polys[[-1]]}]; (*get coordinate of the next layer by translate this layer*) Flatten@ Map[Polygon, NestList[next, N@{{{0, 0}, {...


10

This question is not a bit hard: mat = {{1, 0}, {1/2, Sqrt[3]/2}}; draw[n_] := Graphics[Table[{RandomColor[], Triangle[{{i + n + 1 - #, j + n + 1 - #}, {i, j + 1}, {i + 1, j}}.mat]}, {i, n}, {j, # - i}] & /@ {n, n + 1}]; draw[8] Code is easy, check it by yourself~


13

I guess something like this: With[{n = 7}, BlockRandom[SeedRandom["triangles"]; Graphics[Table[{RandomColor[], Polygon[TranslationTransform[{Sqrt[3] (j + i - 1), 3 j + Boole[EvenQ[i]]}/2] @ ...


7

Here is a slightly improved/updated version of the solution developed by Peter Frentrup and published at Jan 15, 2010 on the xkcd forum. The changes I have made are to put "Image" as the second argument for Rasterize, explicitly convert the result to grayscale and use ImageData for extracting channel values (all these features were not present in Mathematica ...


5

A quick example how to generate the first two frames. Just the basic layout, no fancy annotations, but you should get the idea. First, define the functions that draw the frames: frame1[{int1_, int2_}] := PieChart[{(int1 + int2)/2, 1 - (int1 + int2)/2}, ChartStyle -> {Black, White}, PerformanceGoal -> "Speed", ChartBaseStyle -> EdgeForm[...


15

First and foremost, it must be mentioned that in the artist's work, not all possible triangles are drawn from the vertices. There are triangles whose one or more edges consist of more than two vertices; technically they are polygons (disguising as triangles). And in fact, there are also non-disguising 4-gons. Shown below are some of those things. It would ...


12

Not as great as the original but should serve as a good starting point. The code should probably be self-explanatory... (* parameters *) innerradius = 20; outerradius = 23; numvertices = 12; xrange = {-100, 100}; yrange = {-100, 100}; numframes = 150; colour = Black; finalangle = 720 Degree; (* must be a multiple of 360 Degree / numvertices *) blurring = 10;...


18

The original QRCode is a single piece (I don't dare put it here as it's actually a figure of Chinese pre-president ......) The most interesting phenomenon is that the reference bar has different pixel size as others. So I wrote a brief mathematica code and find out the following: QRCode Reader will only check the color of center points defined by the ...



Top 50 recent answers are included