Retour

Source : rotationcubeaxe.mp


rotationcubeaxe.mp
%%Choix
%verbatimtex
%&Latex
%\documentclass{article}
%\usepackage[frenchb]{babel}
%\usepackage[latin1]{inputenc}
%\begin{document}
%etex
%%%%%%%%%
prologues:=2;
input constantes;
input geometrie31;
pair p[],q[],r[],s[],t[];
p0=u*(10,10);%O
p1=u*(15,10);%y
p2=u*(10,15);%z
p3=u*(12,12);%x
path cadre;
cadre=(0,5u)--(20u,5u)--(20u,20u)--(0,20u)--cycle;
path cerclebase;
cerclebase=cercle(p0,abs(p0-p1));
path bas[],haut[];
picture combo[];
for k=0 step 0.05 until 1:
  beginfig(k*100);
    draw cadre;
    q[100*k]=point(k*length cerclebase) of cerclebase;
    r[100*k]=q[100*k] rotatedabout(p0,90);
    q[100*k+1]=projet(q[100*k],p0,p1);
    r[100*k+1]=projet(r[100*k],p0,p1);
    s[100*k]=1/2[p0,parallele(q[100*k+1],p0,p3,10) intersectionpoint parallele(q[100*k],p2,p3,10)];
    t[100*k]=1/2[p0,parallele(r[100*k+1],p0,p3,10) intersectionpoint parallele(r[100*k],p2,p3,10)];
    if k=0:
      l[100*k]=abs(p0-((p0--p2) intersectionpoint parallele(s[100*k],p2,p3,10)));
    fi%s[100*k]-symc(t[100*k],p0));
    haut[100*k]=(s[100*k] shifted(0,l0))--(t[100*k] shifted(0,l0))--(symc(s[100*k],p0) shifted (0,l0))--(symc(t[100*k],p0) shifted (0,l0))--cycle;%haut
    draw haut[100*k];
    if (100*k<20) or ((100*k>90) and (100*k<100)):
      draw symc(s[100*k],p0)--symc(t[100*k],p0)--s[100*k];
      draw symc(s[100*k],p0)--t[100*k]--s[100*k] dashed evenly;%bas
      draw t[100*k]--(t[100*k] shifted (0,l0)) dashed evenly;%arÍte verticale1
      draw s[100*k]--(s[100*k] shifted (0,l0));%arÍte verticale5
      draw symc(s[100*k],p0)--(symc(s[100*k],p0) shifted (0,l0));%ArÍte verticale4
      draw symc(t[100*k],p0)--(symc(t[100*k],p0) shifted (0,l0));%ArÍte fixe p0--p2
    fi
    if ((100*k>15) and (100*k<45)):
      draw t[100*k]--symc(s[100*k],p0)--symc(t[100*k],p0);
      draw symc(t[100*k],p0)--s[100*k]--t[100*k] dashed evenly;
      draw t[100*k]--(t[100*k] shifted (0,l0));%arÍte verticale1
      draw s[100*k]--(s[100*k] shifted (0,l0)) dashed evenly;%arÍte verticale5
      draw symc(s[100*k],p0)--(symc(s[100*k],p0) shifted (0,l0));%ArÍte verticale4
      draw symc(t[100*k],p0)--(symc(t[100*k],p0) shifted (0,l0));%ArÍte fixe p0--p2
    fi
    if ((100*k>40) and (100*k<70)):      
      draw symc(s[100*k],p0)--symc(t[100*k],p0)--s[100*k] dashed evenly;
      draw symc(s[100*k],p0)--t[100*k]--s[100*k];
      draw t[100*k]--(t[100*k] shifted (0,l0));%arÍte verticale1
      draw s[100*k]--(s[100*k] shifted (0,l0));%arÍte verticale5
      draw symc(s[100*k],p0)--(symc(s[100*k],p0) shifted (0,l0));%ArÍte verticale4
      draw symc(t[100*k],p0)--(symc(t[100*k],p0) shifted (0,l0)) dashed evenly;%ArÍte fixe p0--p2
    fi
    if ((100*k>65) and (100*k<95)):
      draw t[100*k]--symc(s[100*k],p0)--symc(t[100*k],p0) dashed evenly;
      draw symc(t[100*k],p0)--s[100*k]--t[100*k];
      draw t[100*k]--(t[100*k] shifted (0,l0));%arÍte verticale1
      draw s[100*k]--(s[100*k] shifted (0,l0));%arÍte verticale5
      draw symc(s[100*k],p0)--(symc(s[100*k],p0) shifted (0,l0)) dashed evenly;%ArÍte verticale4
      draw symc(t[100*k],p0)--(symc(t[100*k],p0) shifted (0,l0));%ArÍte fixe p0--p2
    fi
    draw 1.5[p0,p2]--1.5[p2,p0] dashed dashpattern(on 12bp off 6bp on 3bp off 6bp) withcolor red;
    path rep,repe;
    rep=cercle(p0,0.5mm);
    fill rep withcolor red;
    repe=rep shifted (0,l0);
    fill repe withcolor red;
  endfig;
endfor
end