Les limaçons de Pascal

Animation flash


sequence.mp
%@DATE: 16 novembre 2006
prologues := 2;
 
input fichierps;
 
InitFichierPS(-2cm,-3cm,4cm,3cm);
 
u = 1cm;
 
def cpoint(expr a,t) = (a + cosd(t),0) rotated t enddef;
 
vardef Courbe(expr a,n) =
    save p; path p;
    p := cpoint(a,0);
    for i=0 upto n: 
	p := p--cpoint(a,360/n*i);
    endfor;
    p
enddef;
 
vardef Point(expr x,y) =
    draw (x,y) scaled u 
	withpen pencircle scaled 2 withcolor black;
    draw (x,y) scaled u 
	withpen pencircle scaled 1.5 withcolor red+green;
enddef;
 
picture repere;
repere = image(
    drawarrow (-1.8u,0)--(3.5u,0);
    drawarrow (0,-2.8u)--(0,2.8u);
    label.bot(btex $x$ etex,(3.5u,0));
    label.lft(btex $y$ etex,(0,2.8u));
    label.rt(btex $r = a + \cos\theta$ etex,(1.2u,-2.5u));
    label.rt(btex $a = $ etex,(1.2u,2.5u));
    Point(-1,0); Point(0,0); Point(1,0); Point(2,0); Point(3,0);
    Point(0,-2); Point(0,-1); Point (0,1); Point(0,2);
);
 
defaultfont  := "cmr10";
defaultscale := 0.8;
 
for j=0 upto 200:
  beginfig(j+1);
    draw repere;
    draw Courbe(j/100,99) scaled u withcolor (1,.3,.3);
    label.rt(decimal (j/100),(1.85u,2.53u));    
  endfig;
endfor;
for j=0 upto 200:
  beginfig(202+j);
    draw repere;
    draw Courbe(2-j/100,99) scaled u withcolor (1,.3,.3);
    label.rt(decimal (2-j/100),(1.85u,2.53u));    
  endfig;
endfor;
 
end