Pattern Generator: Tilings

Mail: ccollins@math.utk.eduKaliIf you didn't look at yesterday's lab, and play with the programkalithen you should take some time today and do so. The program is written in Java and is available at the following link To run it, click onRun the programBasically you can pick different symmetries (sets of transformations) and then draw with different colored pens and see the effect under the transformations. There's no assignment forkali, just play around with the different symmetries and see what kind of interesting patterns you can create. It might be helpful for the homework, or maybe not!Examples of PatternsExamples from site shown in class More Examples Hexagonal PatternsPattern GeneratorAs mentioned in class, there are only 12 patterns you can generate from a square tile. The object of this lab is to write a program (a modification ofmrcm.m) and then try to identify as many of those patterns as possible. We will need three elements to make this work 1. A tile (i.e. a decorated square) 2. A set of transformations 3. A function to apply the transformations to the tile to see if they are legal and if they are legal to see if the results are the same as in other cases1. A tileAs in past labs our figure (in this case a tile) is just a list of points. As always it is better if you put it in a script so you can change/revert to it as needed (I called minemytile.m). The tile should start as a square and then you should add some other internal elements, like this: pts = [0 0; 1 0; 1 1; 0 1; 0 0; NaN NaN; % a square 0.1 0.9; 0.1 0.7; 0.2 0.7]; % L in upper left corner If you want the different elements in your tile to be different colors, you'll need to make a separate list of points for every color you'll use. Just use any name for them (besidespts). Once you have your list(s) of points, you can check out how they look by plot(pts(:,1),pts(:,2)) or plot(pts(:,1),pts(:,2),'r') replacing 'r' with 'k' for black, 'b' for blue, 'g' for green, etc.2. A set of transformationsSince we want to try alot of different sets of transformations, I've made a list below of various transformations of the square (I make no claim that it is complete). You should copy these transformations to a file (mytrans.m) so you can add to the list as needed. I hopefully have used a meaningful naming and numbering system. Change it if you want. % transformations of the square % number edges R=1, B=2, L=3, T=4 % reflections M1 = [-1 0 2; 0 1 0; 0 0 1]; M2 = [1 0 0;0 -1 0; 0 0 1]; M3 = [-1 0 0;0 1 0 ;0 0 1]; M4 = [1 0 0;0 -1 2;0 0 1]; MD = [0 -1 1;-1 0 1;0 0 1]; % across diagonal MD2 = [0 1 0;1 0 0;0 0 1]; % 180 rotation in middle of edge R1 = [-1 0 2;0 -1 1;0 0 1]; R2 = [-1 0 1;0 -1 0; 0 0 1]; R3 = [-1 0 0;0 -1 1; 0 0 1]; R4 = [-1 0 1;0 -1 2;0 0 1]; % 90 rotation at corner RX14 = [0 -1 2;1 0 0;0 0 1]; RX21 = [0 -1 1;1 0 -1;0 0 1]; RX32 = [0 -1 0;1 0 0;0 0 1]; RX43 = [0 -1 1;1 0 1;0 0 1]; % 180 rotation at corner R14 = [-1 0 2; 0 -1 2; 0 0 1]; R21 = [-1 0 2; 0 -1 0; 0 0 1]; R32 = [-1 0 0; 0 -1 0; 0 0 1]; R43 = [-1 0 0; 0 -1 2; 0 0 1]; % Translations Tx = [1 0 1;0 1 0; 0 0 1]; Ty = [1 0 0; 0 1 1; 0 0 1]; Txy = [1 0 1; 0 1 1; 0 0 1];3. A programIf you havemrcm.mfrom before you can just modify it so that it puts the original and all the copies on the same page. That is, instead of making a list of points from just the images, use the original set of points also, like this: p1 = transform(pts,T1); p2 = transform(pts,T2); p3 = transform(pts,T3); % do for each transform you have np = [pts;NaN NaN;p1; NaN NaN; p2; NaN NaN; p3]; % combine the points into one figure (Note hownpcontainsptsand all the images) I've written a new version ofmrcm.m(I call ittile.m) and attached it below.AssignmentGenerate as many distinct patterns using a decorated square tile as you can (there are 12, you should get at least 6). Print out a picture of each distinct pattern you make.(Procedure)If you've named the files as I have above, here's how to go about working on this problem: mytile mytrans z = tile(pts,4,Tx,Ty); plot(z(:,1),z(:,2)) title('Tx, Ty') Repeat the last three steps over and over again, using different sets of transformations. You can use 1, 2, 3 or as many transformations as you want. You are looking to see if (1) there are no holes in the resulting pattern and (2) if there is overlap, they line up exactly. If both (1) and (2) hold, we'll consider it a legal tiling, otherwise, we'll consider it illegal.(Color)If you want to do colored tiles, hopefully your scriptmytile.mcreates several lists of points, let's call thempts1andpts2. Basically all you have to do is apply the same transformations to both sets of points and then color the results differently. z1 = tile(pts1,4,Tx,Ty); z2 = tile(pts2,4,Tx,Ty); plot(z1(:,1),z1(:,2),'b',z2(:,1),z2(:,2),'g')ChallengeCreate the transformations and apply the same procedure to one of the other shapes, like the equilateral triangle. ---------------------------------PROGRAM------------------------------------tile.mfunction np = tile(pts,N,varargin) T = varargin; k = size(T,2); np = pts; for i = 1:N xp = np; for j = 1:k p = transform(np,T{j}); xp = [xp; NaN NaN; p]; end np = xp; end