Source

input geometriesyr16;
input TEX;
verbatimtex;
%&latex
\documentclass[12pt]{article}
\usepackage{lmodern}
\begin{document}
etex

vardef carrelitteralcpt(expr nbc)=
save $; picture$;
path carr[];
carr1=polygone(u*(1,1),u*(nbc+1,1),u*(nbc+1,nbc+1),u*(1,nbc+1));
carr2=polygone(u*(2,2),u*(nbc,2),u*(nbc,nbc),u*(2,nbc));
$=image( trace hachurage(carr1,60,0.2,0) withcolor bleu; remplis carr2 withcolor blanc; trace carr1; trace carr2; for k=2 upto nbc: trace segment(u*(k,1),u*(k,nbc+1)); trace segment(u*(1,k),u*(nbc+1,k)); endfor; );$
enddef;

vardef carrelitteral(expr nbc,eca)=
save $; picture$,coin;
path LL;
pair PP[];
PP1=iso(u*(1,1),u*(6+eca,6+eca));
PP2=iso(u*(1,1),u*(6+eca,1));
LL=polygone(u*(1,1),u*(4,1),u*(4,2),u*(2,2),u*(2,4),u*(1,4));
coin=image(
trace LL;
for k=2 upto 3:
trace segment(u*(1,k),u*(2,k));
trace segment(u*(k,1),u*(k,2));
endfor;
);
$=image( trace hachurage(LL,60,0.2,0) withcolor bleu; trace hachurage(symetrie(LL,PP1),60,0.2,0) withcolor bleu; trace hachurage(symetrie(LL,PP1,PP2),60,0.2,0) withcolor bleu; trace hachurage(symetrie(symetrie(LL,PP1,PP2),PP1),60,0.2,0) withcolor bleu; trace coin; trace symetrie(coin,PP1); trace symetrie(coin,PP1,PP2); trace symetrie(symetrie(coin,PP1,PP2),PP1); drawoptions(dashed withdots withpen pencircle scaled1.5bp); trace segment(u*(4.5,1.5),symetrie(u*(4.5,1.5),PP2+u*(0,0.5))); trace symetrie(segment(u*(4.5,1.5),symetrie(u*(4.5,1.5),PP2+u*(0,0.5))),PP1); trace rotation(segment(u*(4.5,1.5),symetrie(u*(4.5,1.5),PP2+u*(0,0.5))),PP1,90); trace rotation(segment(u*(4.5,1.5),symetrie(u*(4.5,1.5),PP2+u*(0,0.5))),PP1,-90); drawoptions(); long:=abs(u*(1,1)-u*(6+eca,1)); label.bot(TEX("$\underbrace{\hbox to"&
decimal(long)&"pt{}}_{\hbox{"&decimal(nbc)&"}}$"),iso(u*(1,1),u*(6+eca,1))); );$
enddef;
u:=5mm;

beginfig(1);
trace carrelitteralcpt(3);
endfig;

beginfig(2);
trace carrelitteralcpt(5);
endfig;

beginfig(3);
trace carrelitteralcpt(10);
endfig;
u:=4mm;

beginfig(4);
trace carrelitteral(50,3);
endfig;

beginfig(5);
trace carrelitteral(100,4);
endfig;
eca:=4.5;

beginfig(6);
picture $,coin; path LL; pair PP[]; PP1=iso(u*(1,1),u*(6+eca,6+eca)); PP2=iso(u*(1,1),u*(6+eca,1)); LL=polygone(u*(1,1),u*(4,1),u*(4,2),u*(2,2),u*(2,4),u*(1,4)); coin=image( trace LL; for k=2 upto 3: trace segment(u*(1,k),u*(2,k)); trace segment(u*(k,1),u*(k,2)); endfor; );$=image(
trace hachurage(LL,60,0.2,0) withcolor bleu;
trace hachurage(symetrie(LL,PP1),60,0.2,0) withcolor bleu;
trace hachurage(symetrie(LL,PP1,PP2),60,0.2,0) withcolor bleu;
trace hachurage(symetrie(symetrie(LL,PP1,PP2),PP1),60,0.2,0) withcolor bleu;
trace coin;
trace symetrie(coin,PP1);
trace symetrie(coin,PP1,PP2);
trace symetrie(symetrie(coin,PP1,PP2),PP1);
drawoptions(dashed withdots withpen pencircle scaled1.5bp);
trace segment(u*(4.5,1.5),symetrie(u*(4.5,1.5),PP2+u*(0,0.5)));
trace symetrie(segment(u*(4.5,1.5),symetrie(u*(4.5,1.5),PP2+u*(0,0.5))),PP1);
trace rotation(segment(u*(4.5,1.5),symetrie(u*(4.5,1.5),PP2+u*(0,0.5))),PP1,90);
trace rotation(segment(u*(4.5,1.5),symetrie(u*(4.5,1.5),PP2+u*(0,0.5))),PP1,-90);
drawoptions();
long:=abs(u*(1,1)-u*(6+eca,1));
label.bot(TEX("$\underbrace{\hbox to"&decimal(long)&"pt{}}_{\hbox{$n$}}$"),iso(u*(1,1),u*(6+eca,1)));
);
trace \$;
endfig;

end