# Ellipsographes

## Ellipsographe de L'Hospital

ellipsographe6.mp
```%@DATE: 31 mai 2005

input fichierps;

InitFichierPS(-160,-150,160,150);

u = 1.2cm;

% La longueur de la tige.
l = 4;

% Angle des deux glissières;
a = 70;
ca = cosd(a);
sa = sind(a);
lx = l/sa;

% La position du point décrivant l'ellipse sur la tige.
f := 0.6;

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*lx/50,0) scaled u;
elseif i<=150:
A = (2lx-i*lx/50,0) scaled u;
else:
A = (i*lx/50-4lx,0) scaled u;
fi;
x := (xpart A)/u;
k := l*sqrt(1-(x/lx)*(x/lx));

if (i>50) and (i<150):
h := ca*x - k;
else:
h := ca*x + k;
fi;
B = (ca,sa) scaled (h*u);

E = f[B,A];

drawoptions(withcolor 0.6white);
draw ((-1.1l,0)--(1.1l,0))  scaled u;
draw ((-1.1l,0)--(1.1l,0)) rotated a  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```