Section d’un cube parallèlement à sa base

cubebase

input geometriesyr16;
input dlf_tex.mp;

u:=1cm;

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

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


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


pair A,B,C,D,E,F,G,H;
pair V;

numeric c;
c:=4;   %côté du cube

A=(0,0);
B=(c*u,0);
C=(c*u,c*u);
D=(0,c*u);

V=(2u,u);  % vecteur pour la perspective

E= A shifted V;
F= B shifted V;
G= C shifted V;
H= D shifted V;

pair W;
W:=(8u,u);

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


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


draw A--B--C--D--cycle;
draw B--F--G--C;
draw G--H--D;

draw A--E--F dashed evenly;
draw H--E dashed evenly;

numeric cr;
cr:=0.1*i;

pair I,J,K,L;
I:=cr[A,D];
J:=cr[B,C];
K:=cr[F,G];
L:=cr[E,H];

path section;
section = I--J--K--L--cycle;
fillcolor:=1.3orange;
transparence section;
draw I--J--K;
draw K--L--I dashed evenly;



%----------Vue de dessus
I:=A shifted W;
J:=B shifted W;
K:=C shifted W;
L:=D shifted W;

section := I--J--K--L--cycle;
fillcolor:=1.3orange;
transparence section;
draw section;

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 A--B--C--D--cycle;
draw B--F--G--C;
draw G--H--D;

draw A--E--F dashed evenly;
draw H--E dashed evenly;

numeric cr;
cr:=1-0.1*i;

pair I,J,K,L;
I:=cr[A,D];
J:=cr[B,C];
K:=cr[F,G];
L:=cr[E,H];

path section;
section = I--J--K--L--cycle;
fillcolor:=1.3orange;
transparence section;
draw I--J--K;
draw K--L--I dashed evenly;



%----------Vue de dessus
I:=A shifted W;
J:=B shifted W;
K:=C shifted W;
L:=D shifted W;

section := I--J--K--L--cycle;
fillcolor:=1.3orange;
transparence section;
draw section;

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