3
$\begingroup$

I use this code

a = Graphics[   { Inset[
     Style["\[FilledRectangle]", FontSize -> Scaled[0.09]], { 0.34, -0.6755  }]  ,
    Inset[ Style["\[FilledRectangle]", FontSize -> Scaled[0.09]], {    -0.33, -0.6755  }]  } ];

b = Graphics[{Thickness[0.002], CapForm["Butt"], Line[{{   0.34, -0.6755   }, {  2.5, -0.6755 }}]}];

c = Graphics[{EdgeForm[{Thick, Blue}], FaceForm[],  Triangle[{{-1, -2}, {0, 0}, {1, -2}}]}];

Show[{a, b, c}]

and the result is

enter image description here

How can I ask Mathematica to repeat the above picture such that I get this result? enter image description here

$\endgroup$
3
  • 5
    $\begingroup$ Have you seen TranslationTransform and GeometricTransformation? $\endgroup$
    – Michael E2
    Oct 25, 2021 at 23:03
  • 1
    $\begingroup$ ˋTranslateˋ might also turn out useful. $\endgroup$ Oct 26, 2021 at 7:49
  • 1
    $\begingroup$ Define a unit cell and a lattice, like in here. $\endgroup$
    – rhermans
    Oct 26, 2021 at 9:42

2 Answers 2

2
$\begingroup$
n = 5;
translations = {# 0.34 + (# - 1) 2.5, 0} & /@ Range[n]; 

Graphics[{EdgeForm[{Thick, Blue}], FaceForm[], CapForm["Butt"], Thickness[0.002], 
  Translate[{Triangle @ {{-1, -2}, {0, 0}, {1, -2}}, 
     Text[Style["▮", FontSize -> Scaled[0.04]], {#, -0.6755}] & /@ {-.33, 0.34}}, 
   translations],
  Translate[Line[{#, -0.6755} & /@ {.34, 2.5}], Most @ translations]}, 
 ImageSize -> 900]

enter image description here

$\endgroup$
2
$\begingroup$

here is a quick start that can be easily improved

unit[x_, y_] := {Rectangle[{0.34 - 0.1, -0.6755 - 0.2} + {x, 
     y}, {0.34 + 0.1, -0.6755 + 0.2} + {x, y}], 
  Rectangle[{-0.34 - 0.1, -0.6755 - 0.2} + {x, 
     y}, {-0.34 + 0.1, -0.6755 + 0.2} + {x, y}], Thickness[0.002], 
  CapForm["Butt"], 
  Line[{{0.34, -0.6755} + {x, y}, {2.5, -0.6755} + {x, y}}], 
  EdgeForm[{Thick, Blue}], FaceForm[], 
  Triangle[{{-1, -2} + {x, y}, {0, 0} + {x, y}, {1, -2} + {x, y}}]}

and then you can produce j unit as follow

Block[{j = 6, Xn = (Norm[{0.34, -0.6755} - {2.5, -0.6755}] + 0.7)}, 
 Graphics[{Table[
    unit[i (Norm[{0.34, -0.6755} - {2.5, -0.6755}] + 0.7), 0], {i, 1, 
     j}], Rectangle[{0.34 - 0.1, -0.6755 - 0.2} + {(j + 1) Xn, 
      0}, {0.34 + 0.1, -0.6755 + 0.2} + {(j + 1) Xn, 0}], 
   Rectangle[{-0.34 - 0.1, -0.6755 - 0.2} + {(j + 1) Xn, 
      0}, {-0.34 + 0.1, -0.6755 + 0.2} + {(j + 1) Xn, 0}], 
   EdgeForm[{Thick, Blue}], FaceForm[], 
   Triangle[{{-1, -2} + {(j + 1) Xn, 0}, {0, 0} + {(j + 1) Xn, 
       0}, {1, -2} + {(j + 1) Xn, 0}}]}, ImageSize -> 400, 
  Axes -> False]]    

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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