Section d’une pyramide régulière à base carrée

pyramide

input geometriesyr16;
input dlf_tex.mp;

u:=1cm;

%----------------------------------- Définition du cadre
path cadre;
numeric xmin,xmax,ymin,ymax;
xmin:=-u;
xmax:=17u;
ymin:=-2u;
ymax:=8u;

cadre:=(xmin,ymin)--(xmax,ymin)--(xmax,ymax)--(xmin,ymax)--cycle;


%---------------------------------- Définitions générales utilisées
%                                   sur toutes les figures


numeric h;
h:=6;   %hauteur

pair S,A,B,C,D,H,V;
pair AA,BB,CC,DD,HH;


A=(0,0);
B=(6u,0);

V=(1.5u,1.5u);

C=B shifted V;
D=A shifted V;

H=0.5[A,C];
S=H shifted (0,h*u);

pair K,L,M,N,O,W;

W:=(10u,0);

pair T,TT;
T:=(3u,-1.5u);
TT:=(13u,-1.5u);



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%
%%
%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
for i:=0 upto 10:
beginfig(i+1)


draw S--A;
draw S--B;
draw S--C;
draw S--D dashed evenly;

draw A--B--C;
draw C--D--A dashed evenly;
draw S--H dashed evenly;
draw C--A dashed evenly;
draw D--B dashed evenly;

trace codeperp(S,H,A,6);
trace codeperp(S,H,B,6);

label.lft(btex $A$ etex,A);
label.bot(btex $B$ etex,B);
label.rt(btex $C$ etex,C);
label.urt(btex $D$ etex,D);
label.top(btex $S$ etex,S);
label.bot(btex $H$ etex,H);



numeric cr;
cr:=0.1*i;     %coefficient de réduction

AA:=cr[S,A];
BB:=cr[S,B];
CC:=cr[S,C];
DD:=cr[S,D];
HH:=cr[S,H];

path section;
section=buildcycle(segment(AA,BB),segment(BB,CC),segment(CC,DD),segment(DD,AA));
fillcolor:=1.3orange;
transparence section;

draw AA--BB--CC;
draw CC--DD--AA dashed evenly;
draw AA--CC dashed evenly;
draw BB--DD dashed evenly;



K:=A shifted W;
L:=B shifted W;
M:=K rotatedaround(L,-90);
N:= L rotatedaround(K,90);
O:=0.5[K,M];

label.llft(btex $A$ etex,K);
label.lrt(btex $B$ etex,L);
label.urt(btex $C$ etex,M);
label.ulft(btex $D$ etex,N);
label.bot(btex $S$ etex,O);

trace polygone(K,L,M,N);
trace segment(K,M);
trace segment(L,N);

AA:=cr[O,K];
BB:=cr[O,L];
CC:=cr[O,M];
DD:=cr[O,N];

section:=buildcycle(segment(AA,BB),segment(BB,CC),segment(CC,DD),segment(DD,AA));
fillcolor:=1.3orange;
transparence section;

trace polygone(AA,BB,CC,DD);

label(TEX("\uline{Vue en perspective}"),T);
label(TEX("\uline{Vue de dessus}"),TT);

draw cadre withcolor black withpen pencircle scaled 2pt;
clip currentpicture to cadre;

endfig;

endfor



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%
%%
%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
for i:=1 upto 10:
beginfig(i+11)


draw S--A;
draw S--B;
draw S--C;
draw S--D dashed evenly;

draw A--B--C;
draw C--D--A dashed evenly;
draw S--H dashed evenly;
draw C--A dashed evenly;
draw D--B dashed evenly;

trace codeperp(S,H,A,6);
trace codeperp(S,H,B,6);

label.lft(btex $A$ etex,A);
label.bot(btex $B$ etex,B);
label.rt(btex $C$ etex,C);
label.urt(btex $D$ etex,D);
label.top(btex $S$ etex,S);
label.bot(btex $H$ etex,H);



numeric cr;
cr:=1-0.1*i;     %coefficient de réduction

AA:=cr[S,A];
BB:=cr[S,B];
CC:=cr[S,C];
DD:=cr[S,D];
HH:=cr[S,H];

path section;
section=buildcycle(segment(AA,BB),segment(BB,CC),segment(CC,DD),segment(DD,AA));
fillcolor:=1.3orange;
transparence section;

draw AA--BB--CC;
draw CC--DD--AA dashed evenly;
draw AA--CC dashed evenly;
draw BB--DD dashed evenly;



K:=A shifted W;
L:=B shifted W;
M:=K rotatedaround(L,-90);
N:= L rotatedaround(K,90);
O:=0.5[K,M];

label.llft(btex $A$ etex,K);
label.lrt(btex $B$ etex,L);
label.urt(btex $C$ etex,M);
label.ulft(btex $D$ etex,N);
label.bot(btex $S$ etex,O);

trace polygone(K,L,M,N);
trace segment(K,M);
trace segment(L,N);

AA:=cr[O,K];
BB:=cr[O,L];
CC:=cr[O,M];
DD:=cr[O,N];

section:=buildcycle(segment(AA,BB),segment(BB,CC),segment(CC,DD),segment(DD,AA));
fillcolor:=1.3orange;
transparence section;

trace polygone(AA,BB,CC,DD);

label(TEX("\uline{Vue en perspective}"),T);
label(TEX("\uline{Vue de dessus}"),TT);

draw cadre withcolor black withpen pencircle scaled 2pt;
clip currentpicture to cadre;

endfig;

endfor


end