Section d’un cylindre parallèlement à sa base

cylindebout

input geometriesyr16;
input dlf_tex.mp;

u:=1cm;

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

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


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

pair A,B,O,AA,BB,OO;

numeric rb,h;
rb:=3;     % rayon de base
h:=6;      % hauteur

O=(0,0);
OO:= O shifted (0,h*u);
A=(-rb*u,0);
AA:= A shifted (0,h*u);
B=(rb*u,0);
BB:= B shifted (0,h*u);


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

pair T,TT;
T:=(0,-2u);
TT:=(8u,-2u);


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

path cc;
cc= cercles(O,rb*u);
cc := cc yscaled 0.2;
draw subpath (0, length cc /2) of cc dashed evenly;
draw subpath (length cc /2,length cc) of cc;

draw cc shifted (0,h*u);

draw A--AA;
draw B--BB;
draw O--OO dashed evenly;

numeric cr;
cr:=0.1*i;

cc:= cc shifted (0,cr*h*u);
fillcolor:=1.3orange;
transparence cc;
draw subpath (0, length cc /2) of cc dashed evenly;
draw subpath (length cc /2,length cc) of cc;

marque_p := "croix";
MarquePoint(O);
MarquePoint(OO);
marque_p := "rien";

%--------Vue de dessus
pair P;
P:=O shifted W;
cc:= cercles(P,rb*u);
fillcolor:=1.3orange;
transparence cc;
draw cc;

marque_p := "croix";
MarquePoint(P);
marque_p := "rien";

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)

path cc;
cc= cercles(O,rb*u);
cc := cc yscaled 0.2;
draw subpath (0, length cc /2) of cc dashed evenly;
draw subpath (length cc /2,length cc) of cc;

draw cc shifted (0,h*u);

draw A--AA;
draw B--BB;
draw O--OO dashed evenly;

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

cc:= cc shifted (0,cr*h*u);
fillcolor:=1.3orange;
transparence cc;
draw subpath (0, length cc /2) of cc dashed evenly;
draw subpath (length cc /2,length cc) of cc;

marque_p := "croix";
MarquePoint(O);
MarquePoint(OO);
marque_p := "rien";

%--------Vue de dessus
pair P;
P:=O shifted W;
cc:= cercles(P,rb*u);
fillcolor:=1.3orange;
transparence cc;
draw cc;

marque_p := "croix";
MarquePoint(P);
marque_p := "rien";

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

Niveau supérieur : Animations avec Metapost