Retour

Source : volumespheresflash.mp

Animation flash


volumespheresflash.mp
input geometriesyr16;
figure(0,0,15u,8u);
trace feuillet withcolor blanc;
pair O,A,B,C,D,I,J,Z,K[],L[];
O=u*(4,4);
Z=(0,0);
drawoptions(withpen pencircle scaled 1.5bp);
path cc,cd,ce;
cc=cercles(O,3cm);
cd=cercles(Z,3cm);
ce=(cd yscaled 0.15) shifted O;
I=point(0.25*length cc) of cc;
J=symetrie(I,O);
trace cotationmil(O,I,-3.5cm,20,btex rayon $r$ etex);
draw cc;
draw subpath(0,(length ce)/2) of ce dashed evenly;
draw subpath((length ce)/2,length ce) of ce;
B=u*(11,4);
draw (subpath(0,(length ce)/2) of ce) shifted (B-O) dashed evenly;
draw (subpath((length ce)/2,length ce) of ce) shifted (B-O);
A=u*(11,7);
draw droite(B,A) dashed dashpattern(on12bp off6bp on3bp off6bp);
C=point(0) of (ce shifted (B-O));
D=point(length ce/2) of (ce shifted (B-O));
draw D--A--C;
trace cotationmil(B,C,-1cm,20,btex rayon $r$ etex);
trace cotationmil(A,B,3.5cm,30,btex hauteur $r$ etex);
picture solides;
solides=currentpicture;
drawoptions();
fin;
vues=5;
pair sec[];
path Cc[],Cd[],Ccsph[],Cdsph[],volcone[],volsphere[];
for vue=0 upto vues:
  figure(0,0,15u,8u);
  trace feuillet withcolor blanc;
  h:=vue/vues;
  sec1:=h[A,B];
  sec2:=(h/4)[J,I];
  Cc[vue]=cercle(Z,h*3*u);
  Cd[vue]=Cc[vue] yscaled 0.15 shifted sec1;
  Ccsph[vue]=cercle(Z,3*sqrt(h*(1-h/4))*u);
  Cdsph[vue]=Ccsph[vue] yscaled 0.15 shifted sec2;
  draw subpath(0,(length Cd[vue])/2) of Cd[vue] dashed evenly;
  draw subpath((length Cd[vue])/2,length Cd[vue]) of Cd[vue];
  draw subpath(0,(length Cdsph[vue])/2) of Cdsph[vue] dashed evenly;
  draw subpath((length Cdsph[vue])/2,length Cdsph[vue]) of Cdsph[vue];
  volcone[vue]=D--h[A,D]--(subpath((length Cd[vue])/2,length Cd[vue]) of Cd[vue])--C--(subpath(length ce,(length ce/2)) of (ce shifted(B-O)))--cycle;
  if vue<>vues:
    fill volcone[vue] withcolor jaune;
    fill Cd[vue] withcolor jaune;
    draw subpath(0,(length Cd[vue])/2) of Cd[vue] dashed evenly withpen pencircle scaled 1.5bp;
    draw subpath((length Cd[vue])/2,length Cd[vue]) of Cd[vue] withpen pencircle scaled 1.5bp;
  fi;
  K[vue]=point((length Cdsph[vue])/2) of Cdsph[vue];
  L[vue]=point(0) of Cdsph[vue];
  volsphere[vue]=arccercle(K[vue],L[vue],O)--(subpath(length Cdsph[vue],(length Cdsph[vue])/2) of Cdsph[vue])--cycle;
  if vue<>0:
    fill volsphere[vue] withcolor ciel;
    fill Cdsph[vue] withcolor ciel;
    draw subpath(0,(length Cdsph[vue])/2) of Cdsph[vue] dashed evenly withpen pencircle scaled 1.5bp;
    draw subpath((length Cdsph[vue])/2,length Cdsph[vue]) of Cdsph[vue] withpen pencircle scaled 1.5bp;
  fi;
  draw solides;
  fin;
endfor;
%%-----------------
%% 2eme quart
%%-----------------
for vue=0 upto vues:
  figure(0,0,15u,8u);
  draw feuillet withcolor blanc;
  h:=vue/vues;
  k:=1+(vue/vues);
  sec1:=h[A,B];
  sec2:=(k/4)[J,I];
  Cc[vues+1+vue]=cercle(Z,h*3*u);
  Cd[vues+1+vue]=Cc[vues+1+vue] yscaled 0.15 shifted sec1;
  Ccsph[vues+1+vue]=cercle(Z,3*sqrt(k*(1-k/4))*u);
  Cdsph[vues+1+vue]=Ccsph[vues+1+vue] yscaled 0.15 shifted sec2;
  draw subpath(0,(length Cd[vues+1+vue])/2) of Cd[vues+1+vue] dashed evenly;
  draw subpath((length Cd[vues+1+vue])/2,length Cd[vues+1+vue]) of Cd[vues+1+vue];
  draw subpath(0,(length Cdsph[vues+1+vue])/2) of Cdsph[vues+1+vue] dashed evenly;
  draw subpath((length Cdsph[vues+1+vue])/2,length Cdsph[vues+1+vue]) of Cdsph[vues+1+vue];
  volcone[vues+1+vue]=D--h[A,D]--(subpath((length Cd[vues+1+vue])/2,length Cd[vues+1+vue]) of Cd[vues+1+vue])--C--(subpath(length ce,(length ce/2)) of (ce shifted(B-O)))--cycle;
  draw subpath(0,(length Cdsph[vues])/2) of Cdsph[vues] dashed evenly;
  draw subpath((length Cdsph[vues])/2,length Cdsph[vues]) of Cdsph[vues];
  fill volsphere[vues] withcolor ciel;
  fill Cdsph[vues] withcolor ciel;
  if vue<>vues:
    fill volcone[vues+1+vue] withcolor jaune;
    fill Cd[vues+1+vue] withcolor jaune;
    draw subpath(0,(length Cd[vues+1+vue])/2) of Cd[vues+1+vue] dashed evenly withpen pencircle scaled 1.5bp;
    draw subpath((length Cd[vues+1+vue])/2,length Cd[vues+1+vue]) of Cd[vues+1+vue] withpen pencircle scaled 1.5bp;
  fi;
  K[vues+1+vue]=point((length Cdsph[vues+1+vue])/2) of Cdsph[vues+1+vue];
  L[vues+1+vue]=point(0) of Cdsph[vues+1+vue];
  volsphere[vues+1+vue]=arccercle(K[vues+1+vue],K[vues],O)--(subpath((length Cdsph[vues])/2,length Cdsph[vues]) of Cdsph[vues])--arccercle(L[vues],L[vues+1+vue],O)--(subpath(length Cdsph[vues+1+vue],(length Cdsph[vues+1+vue])/2) of Cdsph[vues+1+vue])--cycle;
  if vue<>0:
    fill volsphere[vues+1+vue] withcolor ciel;
    fill Cdsph[vues+1+vue] withcolor ciel;
    draw subpath(0,(length Cdsph[vues+1+vue])/2) of Cdsph[vues+1+vue] dashed evenly withpen pencircle scaled 1.5bp;
    draw subpath((length Cdsph[vues+1+vue])/2,length Cdsph[vues+1+vue]) of Cdsph[vues+vue+1] withpen pencircle scaled 1.5bp;
  fi;
  draw subpath(0,(length Cdsph[vues])/2) of Cdsph[vues] dashed evenly withpen pencircle scaled 1.5bp;
  draw subpath((length Cdsph[vues])/2,length Cdsph[vues]) of Cdsph[vues] withpen pencircle scaled 1.5bp;
  draw solides;
  fin;
endfor;
end