# Change of pattern in certain position

I want to create an image that contains a pattern similar to an inclined rectangle. The features are as follows:

1. I want to control the angle of inclination, height and thickness:

ang=66 Degree;h=70;esp=20.5;


2. This image has an inclined and vertical sequence:

p1={0,0};
p2={h/Tan[ang],h};
p3={p2[]+esp/Sin[ang],h};
p4={p1[]+esp/Sin[ang],0};
p5={p2[]+esp/Sin[ang]-esp,0};
p6={p2[]+esp/Sin[ang]-esp,(p5[]-p4[])*Tan[ang]};
p7={p2[]+esp/Sin[ang],p3[]-(p5[]-p4[])*Tan[ang]};
group1={Line[{p1,p2,p3,p4,p1}]};
group2={Line[{p5,p6}],Line[{p3,p7}]};


3. A property where I can control the amount of patterns:

offSet1=Prepend[NestList[#1+p3[]-esp&,p3[]-esp,3],0];
offSet2=Prepend[NestList[#1+p3[]-esp&,p3[]-esp,2],0];
Graphics[{Thickness[0.003],GeometricTransformation[group1,(TranslationTransform[{#1,0}]&)/@offSet1],GeometricTransformation[group2,(TranslationTransform[{#1,0}]&)/@offSet2]},ImageSize->900]


The above code is simple and ended up limiting a feature I want to have: apply a mirroring on a particular copy.

The image below describes where mirroring should be applied. Would anyone have an idea how I can improve my code so that I can get a better handle on this property?

## 1 Answer

What about this? I stack filled Polygons to get the same effect. The order of their occurrence within Graphics is crucial.

ang = 66 Degree; h = 70; esp = 20.5;
p1 = {0, 0};
p2 = {h/Tan[ang], h};
p3 = {p2[] + esp/Sin[ang], h};
p4 = {p1[] + esp/Sin[ang], 0};
shift = {p3[] - esp, 0};
rectangle = Polygon[{{0, 0}, {esp, 0}, {esp, h}, {0, h}}];
parallelogram = Polygon[{p1, p2, p3, p4}];
parallelogram2 = GeometricTransformation[
parallelogram,
{
{{1, 0}, {0, -1}},
{0, h} + {p2[], 0} + 4 shift
}
];
Graphics[
{
EdgeForm[{Thick, Black}], FaceForm[Gray],
Table[Translate[rectangle, i shift], {i, 1, 4}],
parallelogram2,
EdgeForm[{Thick, Black}], FaceForm[White],
Table[Translate[parallelogram, i shift], {i, 0, 4}]
}
] • You got it!!! But post the output... – LCarvalho Jul 18 '17 at 18:10