Le but est de produire les cinq figures ci après :
https://goopics.net/i/r5VP7
J'ai fait une seule figure, mais comment faire pour en avoir cinq séparées ? Je sais que tu vas me répondre qu'il suffit d'en faire cinq, mais mon problème est d'avoir la base du carré principal alignée sur la même ligne de base. Je ne sais pas si je suis suffisamment clair !
Code : Tout sélectionner
import trembling ;
import geometry ;
unitsize(1cm,1cm);
real a = 1.5;
pair centre = (a/2,a/2);
transform h=scale(2/sqrt(2),centre);
path carre = scale(a)*unitsquare ;
path p1 = (a,a)--(a,0)--(0,a) ;
path p2 = (a,a)--(a+a*sqrt(3)/2,a/2)--(a,0) ;
path p3 = (0,a)--(-a*sqrt(3)/2,a/2)--(0,0) ;
tremble tr=tremble(angle=4,
frequency=.5,
random=2) ;
add(shift(-1,-1)*grid(25,7,gray)) ;
draw(tr.deform(carre--p1),magenta+2bp) ;
draw(shift(1.5*a,0)*tr.deform(carre--p1--p2),magenta+2bp) ;
draw(shift(5*a,0)*tr.deform(carre--p2--p3),magenta+2bp) ;
draw(shift(7.5*a,0)*tr.deform(carre),magenta+2bp) ;
draw(shift(8*a,-a/4)*rotate(45)*tr.deform(h*carre),magenta+2bp) ;
draw(shift(10.5*a,-a/4)*rotate(45)*tr.deform(h*carre),magenta+2bp) ;
draw(shift(10*a,0)*tr.deform(carre--p1),magenta+2bp) ;
shipout(bbox(Fill(lightgray))) ;
fabrice