Code : Tout sélectionner
import solids;
size(15cm);
currentprojection=orthographic(5,2,2);
currentlight=light(gray(0.5),(5,0,0));
viewportmargin=1cm;
int n=11,
t[]={0,1,1,n};
void draw_cercle_ford(int a, int b, real c){
real r = 1/(2*b^2);
pen p=c*white+(1-c)*yellow;
render re=render(merge=true);
draw(surface(sphere((0,a/b,r),r)),p,re);
draw(surface(sphere((0,a/b,-r),r)),p,re);
if(a!=0) { draw(surface(sphere((0,-a/b,r),r)),p,re);
draw(surface(sphere((0,-a/b,-r),r)),p,re); }
}
void iteration(){
int k = floor((n+t[1])/t[3]);
t = new int[] {t[2],t[3],k*t[2]-t[0],k*t[3]-t[1]};
}
while (t[2]<=n){
draw_cercle_ford(t[0], t[1], t[2]/n);
iteration();
}
Exemple des Cercles de Ford à voir dans le sous-forum 'Géométrie du plan'.