Ellipsographes

Ellipsographe d'Archimède

Animation flash


ellipsographe5.mp
%@DATE: 31 mai 2005
 
input fichierps;
 
InitFichierPS(-150,-150,150,150);
 
u = 1.2cm;
 
 
% La longueur de la tige.
l = 4;
 
% La position du point décrivant l'ellipse sur la tige.
f := 0.7;
 
vardef Point(expr p) =
    draw p withpen pencircle scaled 4;
    draw p withpen pencircle scaled 3 withcolor white;
enddef;
 
% L'ellipse;
path e;
 
for i=0 upto 200:
  beginfig(i+1);
 
    pair A,B,E;
    if i<=50:
	A = (i*l/50,0) scaled u;
    elseif i<=150:
	A = (2l-i*l/50,0) scaled u;
    else:
	A = (i*l/50-4l,0) scaled u;
    fi;
    x := (xpart A)/u;    
    k := l*sqrt(1-(x/l)*(x/l));
    B := (0,k) scaled u;
 
    if (i>50) and (i<150):
	B := B yscaled -1;
    fi;
 
    E = f[B,A];
 
    drawoptions(withcolor 0.6white);    
    draw ((-1.1l,0)--(1.1l,0)) scaled u;
    draw ((0,1.1l)--(0,-1.1l)) scaled u;
    drawoptions();
 
    drawarrow (0,0)--(A scaled 0.95) withpen pencircle scaled 1.25;
 
    if i=0: 
	e := E;
    else:
	e := e -- E;
	draw e withpen pencircle scaled 1 withcolor blue;
    fi
 
    drawoptions(withpen pensquare scaled 2 withcolor (1,0.08,0.58));	
    draw A--B;
    drawoptions();
 
    Point(A);
    Point(B);
    Point(E); 
  endfig;
endfor;
 
end