7
$\begingroup$

I would like to implement an algorithm for designing this non-symmorphic lattice enter image description here

This has a Glide reflection axis runs northeast-southwest.

$\endgroup$
  • 1
    $\begingroup$ Do you at least have code for generating a single tile? $\endgroup$ – J. M. will be back soon Dec 9 '16 at 22:32
  • $\begingroup$ I am fine if a single tile of this lattice is a rectangle. $\endgroup$ – Dario Bercioux Dec 9 '16 at 22:32
  • $\begingroup$ @J.M. nope, but a single tile can be a rectangle. Sorry for not specifying this information. $\endgroup$ – Dario Bercioux Dec 9 '16 at 22:33
6
$\begingroup$

First we recognize that we might not want to work with rectangles, but with tile elements that look like this.

tile =
  {Line[{{0, 0}, {1, 0}}], Line[{{0, 1}, {2, 1}}], 
   Line[{{0, 2}, {2, 2}}], Line[{{0, 1}, {0, 2}}], 
   Line[{{1, 0}, {1, 1}}], Line[{{2, 0}, {2, 1}}], 
   Line[{{2, 0}, {2, 2}}], Line[{{3, 0}, {3, 2}}], 
   Line[{{4, 1}, {4, 2}}], Line[{{2, 0}, {4, 0}}], 
   Line[{{3, 1}, {4, 1}}], Line[{{2, 2}, {3, 2}}]};

Graphics[tile]

tile

Given that we need two translation functions.

t0 = Translate[tile, {4 #1, 2 #2}] &;
t2 = Translate[tile, {2 + 4 #1, 2 #2}] &;

Now we can draw the tiling.

Graphics[Function[n, {t0[#, n], t2[#, 1 + n]} & /@ Range[0, 4]] /@ Range[0, 8, 2]]

tiling

$\endgroup$
  • $\begingroup$ Can't you use this approach to generate polygons too? $\endgroup$ – Feyre Dec 10 '16 at 10:05
3
$\begingroup$

This is a step by step setup for a textured image.

We can generate rectangles at proper distance with:

   Graphics[{EdgeForm[Thick], White, 
  Table[Rectangle[{i, 0}, {i + 2, 1}], {i, 0, 6, 4}]}]

enter image description here

Then lets add a vertical rectangle:

Graphics[{EdgeForm[Thick], White, 
  Table[{Rectangle[{i, 0}, {i + 2, 1}], 
    Rectangle[{i + 2, -1}, {i + 3, 1}]}, {i, 0, 6, 4}]}]

enter image description here

The horizontal rectangle to the top and right of the initial one, is given by increasing both x and y by 1, for which we'll use a new iterator:

{Rectangle[{i + j, j}, {i + j + 2, j + 1}], 
 Rectangle[{i + 2 + j, -1 + j}, {i + 3 + j, 1 + j}]}

Now generate a function which will do everything including a good plotting range:

tiles[n_] :=

 Graphics[{EdgeForm[Thick], White, 
   Table[{Rectangle[{i + j, j}, {i + j + 2, j + 1}], 
     Rectangle[{i + 2 + j, -1 + j}, {i + 3 + j, 1 + j}]}, {i, 0, 
     2n, 4}, {j, n}]}, PlotRange -> {{n, 2+ 2n}, {1, n}}]

If you want to generate an actual textured tileset, you need to use polygons:

tileim = Import["https://i.imgsafe.org/d2eee03f00.png"];
tilesG[n_] := 
 Graphics[{Texture[tileim], 
   Table[{Polygon[{{i + j, j}, {i + j, j + 1}, {i + j + 2, 
        j + 1}, {i + j + 2, j}}, 
      VertexTextureCoordinates -> {{0, 1}, {1, 1}, {1, 0}, {0, 0}}], 
     Polygon[{{i + 2 + j, -1 + j}, {i + 2 + j, 1 + j}, {i + 3 + j, 
        1 + j}, {i + 3 + j, -1 + j}}, 
      VertexTextureCoordinates -> {{0, 0}, {0, 1}, {1, 1}, {1, 
         0}}]}, {i, 0, 2 n, 4}, {j, n}]}, 
  PlotRange -> {{n, 2 + 2 n}, {1, n}}]
tilesG[8]

enter image description here

$\endgroup$
  • 1
    $\begingroup$ Instead of keeping a rotated copy of the texture, just change the VertexTextureCoordinates setting of the first set of Polygon[]s into VertexTextureCoordinates -> {{0, 1}, {1, 1}, {1, 0}, {0, 0}}. $\endgroup$ – J. M. will be back soon Dec 10 '16 at 10:15
  • $\begingroup$ To make things easier for other people, you might consider uploading tile.png to imgur, and then use Import[] to get the image from within Mathematica. $\endgroup$ – J. M. will be back soon Dec 11 '16 at 10:43
  • $\begingroup$ @J.M. Fair enough $\endgroup$ – Feyre Dec 11 '16 at 10:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.