input latexmp;
setupLaTeXMP(class="article",options="12pt",fontencoding="T1",inputencoding="latin1",language="frenchb",packages="fourier,textpathmp");
input textpath;

prologues:=2;

input geometriesyr16;

figure(-6u,-8u,6u,8u);
pair O,A,B,P[],Q[],M[],R[],S[];
O=(0,0);
A-O=u*(1,0);
B=rotation(A,O,90);
path cc,dd;
cc=cercles(O,3u);
dd=droite(O,A);
marque_r:=10;
marque_p:="plein";
drawoptions(withcolor rouge);
r=0;s=0;
for k=0 step 1 until 360:
  P[k]=pointarc(cc,k);
  if (perpendiculaire(O,P[k],P[k]) intersectiontimes dd)<>(-1,-1):
    Q[k]=perpendiculaire(O,P[k],P[k]) intersectionpoint dd;
    if (parallele(O,B,Q[k]) intersectiontimes droite(O,P[k]))<>(-1,-1):
      M[k]=parallele(O,B,Q[k]) intersectionpoint droite(O,P[k]);
      if xpart(M[k])>0:
	r:=r+1;
	R[r]=M[k];
      else:
	s:=s+1;
	S[s]=M[k];
      fi;
    fi;
  fi;
endfor;
drawoptions(dashed evenly withcolor gris);
trace cc;
trace dd;
trace droite(O,B);
drawoptions(withcolor rouge);
path campyle[];
campyle1=R1
for k=2 upto r:
  --R[k]
endfor;
campyle2=S1
for k=2 upto s:
  --S[k]
endfor;
trace campyle1;
trace campyle2;
drawoptions(withcolor bleu);
trace textpath("\Large Campyle d'Eudoxe",campyle1,0);
fin;
end