Retour

Source : anima.mp


anima.mp
%%[slideshow]
\input slideshow;
author("Christophe Poulain");
title("Animation de section de solides");
%%[navigation]
\input navigation;
couleurboutons:=(1,1,0.3);
couleurfond:=(0,0,0.7);
%% Choix de LaTeX
verbatimtex
%&latex
\documentclass[a4paper]{article}
\usepackage[latin1]{inputenc}
\usepackage[frenchb]{babel}
\begin{document}
etex
%%[geometrie]
input geometrie2;
%%[Image]
picture cp;
cp=thelabel(btex \sf C.POULAIN -- 2002 etex scaled 0.5,(0.90lawidth,0.03laheight));
footer(image(draw cp withcolor blue;));
%% -- navigation PDF & logos
def navPDFlogos =
 init_navigation;
 navigation;
 internavigation;
enddef;
extra_endfig := extra_endfig & "navPDFlogos;";
% gs will need this
prologues:=2;
%fond d'écran
noslides := 11;
def doback =
background := image(drawgradient((charcode/noslides)[white,white], (charcode/noslides)[white,white]););
enddef;
doback;
%cadre
path cadre;
cadre=(0.05lawidth,0.9laheight)--(0.95lawidth,0.9laheight)--(0.95lawidth,0.98laheight)--(0.05lawidth,0.98laheight)--cycle;
draw cadre;
%% -- instructions
color C[];
C6=0.8white;
vardef instruction(expr s) =
  fill cadre withcolor C6;
  label.rt(s,p100);
enddef;
%[Animation]
nextfig;
label(btex \Large\bf Différentes sections etex scaled 2,(.502lawidth,.688laheight)) withcolor 0.3white;
blabel(btex \Large\bf Différentes sections etex scaled 2,(.50lawidth,.69laheight));
label(btex \Large\bf de solides. etex scaled 2,(.502lawidth,.548laheight)) withcolor 0.3white;
blabel(btex \Large\bf  de solides. etex scaled 2,(.5lawidth,.55laheight));
hyperdest("start");
endfig;
u=1.5cm;
pair p[],plan[];
p0=u*(4,1);%B
p1=u*(9,1);
p2=1/5[p0,p1];
p3=2/3[p0,p1];%C
p5=u*(5.2,6);%D
p6=1/4[p2,p5];%A
p7=2/3[p6,milieu(p0,p3)];%Isobarycentre de la base
plan0=p0 shifted (-u,-0.5u);
plan1=p3 shifted (u,-0.5u);
plan3=plan0 shifted (0.5u,1.95u);
plan2=plan3 shifted (plan1-plan0);
plan4=droite(plan2,plan3,10) intersectionpoint droite(p3,p5,10);
plan5=droite(plan2,plan3,10) intersectionpoint droite(p0,p5,10);
nextfig;
  draw plan0--plan1--plan2--plan4;
  draw plan4--plan5 dashed evenly;
  draw plan5--plan3--plan0;
  picture plandebase;
  plandebase=currentpicture;
  draw p0--p3--p5--cycle;
  draw p6--p0 dashed evenly;
  draw p6--p5 dashed evenly;
  draw p6--p3 dashed evenly;
  dotlabel.llft(btex $B$ etex,p0);
  dotlabel.ulft(btex $A$ etex,p6);
  dotlabel.lrt(btex $C$ etex,p3);
  dotlabel.top(btex $D$ etex,p5);
  endfig;
discontinue;
vues:=15;
path section[];
pair g[],h[],i[];
for vue=1 upto vues :
  nextfig;
  pair G,H,K,bary,fleche;
  K=(vue/(vues+2))[p5,p3]-p5;
  g[vue]=p5 shifted K;
  h[vue]=para(g[vue],p0,p3,10) intersectionpoint (p5--p0);
  i[vue]=para(h[vue],p0,p6,10) intersectionpoint (p5--p6);
  bary=2/3[i[vue],milieu(g[vue],h[vue])];
  G=((plan0--plan1) shifted (bary-p7)) intersectionpoint (p5--p3);
  H=((plan0--plan1) shifted (bary-p7)) intersectionpoint (p5--p0);
  fleche=bary shifted (u,1.15u);
  section[vue]=buildcycle(para(g[vue],p0,p3,10),para(h[vue],p0,p6,10),para(g[vue],p6,p3,10));
  if vue=9:
    draw hachure(60,0.1) withcolor blue;
    clip currentpicture to section[vue];
    draw p5--h[vue]--g[vue]--cycle;
    draw p5--i[vue] dashed evenly;
    draw section[vue];
    dotlabel.top(btex $D$ etex,p5);
    picture coffre;
    coffre=currentpicture;
    currentpicture:=nullpicture;
    draw hachure(60,0.1) withcolor red;
    clip currentpicture to section[vue];
    draw coffre rotatedabout(h[vue],120);
    draw h[vue]--p0--p3--g[vue];;
    draw p6--p0 dashed evenly;
    draw p6--i[vue] dashed evenly;
    draw p6--p3 dashed evenly;
    dotlabel.llft(btex $B$ etex,p0);
    dotlabel.ulft(btex $A$ etex,p6);
    dotlabel.lrt(btex $C$ etex,p3);
    draw section[vue];
    draw plandebase;
    drawarrow fleche--bary withpen pencircle scaled 0.25bp;draw fleche--(fleche shifted (u,0)) withpen pencircle scaled 0.25bp;
    label.rt(btex Section de la pyramide ${\cal P}$ etex,(fleche shifted (u,0)));
  else:
  draw hachure(60,0.1) withcolor red;
  clip currentpicture to section[vue];
  draw H--p0--p3--G;
  draw g[vue]--p5--h[vue];
  draw g[vue]--G dashed evenly;
  draw h[vue]--H dashed evenly;
  draw p6--p0 dashed evenly;
  draw p6--p5 dashed evenly;
  draw p6--p3 dashed evenly;
  dotlabel.llft(btex $B$ etex,p0);
  dotlabel.ulft(btex $A$ etex,p6);
  dotlabel.lrt(btex $C$ etex,p3);
  dotlabel.top(btex $D$ etex,p5);
  draw section[vue];
  draw plandebase;
  draw plandebase shifted (bary-p7) dashed dashpattern(on 12bp off 6bp on 3bp off 6bp) withcolor 0.4[red,blue];
  drawarrow fleche--bary withpen pencircle scaled 0.25bp;draw fleche--(fleche shifted (u,0)) withpen pencircle scaled 0.25bp;
  label.rt(btex Section de la pyramide ${\cal P}$ etex,(fleche shifted (u,0)));
  fi
    endfig;
endfor
end