Configurations de Thalès
Posté : sam. 27 mars 2010, 15:04
Asymptote est vraiment puissant et permet de faire des figures très complexes, il n'y a qu'à voir sur ce forum. Pour la réalisation de figures plus classiques que l'on utilise souvent, comme les configurations de Thalès au collège, il peut être utile d'avoir un "code type", dans lequel il n'y a qu'à changer quelques valeurs, ou décommenter-commenter quelques lignes. Je propose ici un des codes que j'utilise. Bien sûr, si vous avez plus simple, ou des améliorations à apporter, ça m'intéresse !
Code de base :
Un premier exemple (il faudrait bien sûr enlever quelques longueurs !) :
Configuration "papillon" :
Un dernier exemple plus complet :
Christophe
Code de base :
Code : Tout sélectionner
// Thales.asy -- Configurations de Thalès
// Il faut "connaitre" un triangle (t=ABC), ainsi que le rapport de l'homothétie (k)
// Le second triangle (t2=ADE) est construit comme l'homothétique de t.
import geometry;
unitsize(1*cm); // Pour les "vraies" grandeurs
//size(7*cm);
//---------------------------------------------------------------------------------------
// A MODIFIER
real a=4,b=3,c=5,ang=0,k=-1.5; // BC,AC,AB,(vec{i},vec{AB}),rapport de l'homothétie
// Le premier point du tableau suivant est le centre de l'homothétie
string[] n={"$A$","$B$","$C$","$D$","$E$"}; // labels de t.A,t.B,t.C,t2.B=h(t.B),t2.C=h(t.C)
pair[] dl={NW,E,N,W,S}; // alignements respectifs
//---------------------------------------------------------------------------------------
// RIEN A MODIFIER ICI
triangle t=triangleabc(a,b,c,angle=ang); // Triangle "connu" !
//show(t);
triangle t2=scale(k,t.A)*t;
//show(t2);
point[] p={t.A,t.B,t.C,t2.B,t2.C};
//---------------------------------------------------------------------------------------
// ENLEVER LES LONGUEURS DES COTES NON VOULUES (REMPLACER PAR "")
show(t,LA="",LB="",LC="",La=format("$%f$",a),Lb=format("$%f$",b),Lc=format("$%f$",c));
show(t2,LA="",LB="",LC="",La=format("$%f$",length(t2.C-t2.B)),Lb=format("$%f$",length(t2.C-t2.A)),Lc=format("$%f$",length(t2.B-t2.A)));
//---------------------------------------------------------------------------------------
// AFFICHAGE DES LONGUEURS AVEC FLECHES
//distance(format("$%f$",a),t.B,t.C,rotated=true,offset=3*mm);
//distance(format("$%f$",b),t.A,t.C,rotated=true,offset=3*mm);
//distance(format("$%f$",c),t.A,t.B,rotated=true,offset=3*mm);
//distance(format("$%f$",length(t2.C-t2.B)),t2.B,t2.C,rotated=true,offset=3*mm);
//distance(format("$%f$",length(t2.C-t.A)),t.A,t2.C,rotated=true,offset=3*mm);
//distance(format("$%f$",length(t2.B-t.A)),t.A,t2.B,rotated=true,offset=3*mm);
//---------------------------------------------------------------------------------------
for(int i=0; i<5; ++i) {label(n[i],p[i],dl[i]);} // Placement des labels
Un premier exemple (il faudrait bien sûr enlever quelques longueurs !) :
Code : Tout sélectionner
import geometry;
//unitsize(1*cm); // Pour les "vraies" grandeurs
size(7cm);
//---------------------------------------------------------------------------------------
// A MODIFIER
real a=4,b=3,c=5,ang=0,k=1.5; // BC,AC,AB,(vec{i},vec{AB}),rapport de l'homothétie
// Le premier point du tableau suivant est le centre de l'homothétie
string[] n={"$A$","$B$","$C$","$D$","$E$"}; // labels de t.A,t.B,t.C,t2.B=h(t.B),t2.C=h(t.C)
pair[] dl={W,SE,NW,E,N}; // alignements respectifs
//---------------------------------------------------------------------------------------
// RIEN A MODIFIER ICI
triangle t=triangleabc(a,b,c,angle=ang); // Triangle "connu" !
//show(t);
triangle t2=scale(k,t.A)*t;
//show(t2);
point[] p={t.A,t.B,t.C,t2.B,t2.C};
//---------------------------------------------------------------------------------------
// ENLEVER LES LONGUEURS DES COTES NON VOULUES (REMPLACER PAR "")
show(t,LA="",LB="",LC="",La=format("$%f$",a),Lb=format("$%f$",b),Lc=format("$%f$",c));
show(t2,LA="",LB="",LC="",La=format("$%f$",length(t2.C-t2.B)),Lb="",Lc="");
//---------------------------------------------------------------------------------------
// AFFICHAGE DES LONGUEURS AVEC FLECHES
//distance(format("$%f$",a),t.B,t.C,rotated=true,offset=3*mm);
//distance(format("$%f$",b),t.A,t.C,rotated=true,offset=3*mm);
//distance(format("$%f$",c),t.A,t.B,rotated=true,offset=3*mm);
//distance(format("$%f$",length(t2.C-t2.B)),t2.B,t2.C,rotated=true,offset=3*mm);
distance(format("$%f$",length(t2.C-t.A)),t.A,t2.C,rotated=false,offset=-7*mm,Arrows(SimpleHead));
distance(format("$%f$",length(t2.B-t.A)),t.A,t2.B,rotated=true,offset=6*mm,Arrows(SimpleHead));
//---------------------------------------------------------------------------------------
for(int i=0; i<5; ++i) {label(n[i],p[i],dl[i]);} // Placement des labels
Configuration "papillon" :
Code : Tout sélectionner
import geometry;
unitsize(1*cm); // Pour les "vraies" grandeurs
//size(7*cm);
//---------------------------------------------------------------------------------------
// A MODIFIER
real a=1.5,b=2.4,c=2,ang=90,k=-3/2; // BC,AC,AB,(vec{i},vec{AB}),rapport de l'homothétie
//Le premier point est le centre de l'homothétie
string[] n={"$C$","$D$","$H$","$E$","$F$"}; // labels de t.A,t.B,t.C,t2.B=h(t.B),t2.C=h(t.C)
pair[] di={W+.5*S,E,W,SW,SE}; // alignements respectifs
//---------------------------------------------------------------------------------------
// RIEN A MODIFIER ICI
triangle t=triangleabc(a,b,c,angle=ang); // Triangle "connu" !
//show(t);
triangle t2=scale(k,t.A)*t;
//show(t2);
point[] p={t.A,t.B,t.C,t2.B,t2.C};
//---------------------------------------------------------------------------------------
// ENLEVER LES LONGUEURS DES COTES NON VOULUES (REMPLACER PAR "")
show(t,LA="",LB="",LC="",La=format("$%f$",a),Lb=format("$%f$",b),Lc=format("$%f$",c));
show(t2,LA="",LB="",LC="",La=format("$%f$",length(t2.C-t2.B)),Lb=format("$%f$",length(t2.C-t2.A)),Lc=format("$%f$",length(t2.B-t2.A)));
//---------------------------------------------------------------------------------------
// AFFICHAGE DES LONGUEURS AVEC FLECHES
//distance(format("$%f$",a),t.B,t.C,rotated=true,offset=3*mm);
//distance(format("$%f$",b),t.A,t.C,rotated=true,offset=3*mm);
//distance(format("$%f$",c),t.A,t.B,rotated=true,offset=3*mm);
//distance(format("$%f$",length(t2.C-t2.B)),t2.B,t2.C,rotated=true,offset=3*mm);
//distance(format("$%f$",length(t2.C-t.A)),t.A,t2.C,rotated=true,offset=3*mm);
//distance(format("$%f$",length(t2.B-t.A)),t.A,t2.B,rotated=true,offset=3*mm);
//---------------------------------------------------------------------------------------
for(int i=0; i<5; ++i) {label(n[i],p[i],di[i]);} // Placement des labels
Un dernier exemple plus complet :
Code : Tout sélectionner
import geometry;
usepackage("fourier","upright");
usepackage("amsmath");
unitsize(1*cm); // Pour les "vraies" grandeurs
//size(7*cm);
//---------------------------------------------------------------------------------------
// A MODIFIER
real a=4,b=3,c=5,ang=-45,k=1.5; // BC,AC,AB,(vec{i},vec{AB}),rapport de l'homothétie
// Le premier point du tableau suivant est le centre de l'homothétie
string[] n={"$A$","$B$","$C$","$D$","$E$"}; // labels de t.A,t.B,t.C,t2.B=h(t.B),t2.C=h(t.C)
pair[] dl={N+.5*E,S+.5*W,N,S,N}; // alignements respectifs
//---------------------------------------------------------------------------------------
// RIEN A MODIFIER ICI
triangle t=triangleabc(a,b,c,angle=ang); // Triangle "connu" !
//show(t);
triangle t2=scale(k,t.A)*t;
//show(t2);
point[] p={t.A,t.B,t.C,t2.B,t2.C};
triangle t3=scale(-.75,t.A)*t;
//show(t3);
//---------------------------------------------------------------------------------------
// ENLEVER LES LONGUEURS DES COTES NON VOULUES (REMPLACER PAR "")
show(t,LA="",LB="",LC="",La=format("$%f$",a),Lb=format("$%f$",b),Lc="?");
show(t2,LA="",LB="",LC="",La=format("$%f$",length(t2.C-t2.B)),Lb="",Lc="");
show(t3,LA="",LB="",LC="",La="?",Lb="$\dfrac{9}{4}$",Lc="$\dfrac{15}{4}$");
draw(t.C--t.B,.8*blue);draw(t2.C--t2.B,.8*blue);label("?",midpoint(t.C--t2.C),N);
//---------------------------------------------------------------------------------------
// AFFICHAGE DES LONGUEURS AVEC FLECHES
//distance(format("$%f$",a),t.B,t.C,rotated=true,offset=3*mm);
//distance(format("$%f$",b),t.A,t.C,rotated=true,offset=3*mm);
//distance(format("$%f$",c),t.A,t.B,rotated=true,offset=3*mm);
//distance(format("$%f$",length(t2.C-t2.B)),t2.B,t2.C,rotated=true,offset=3*mm);
//distance(format("$%f$",length(t2.C-t.A)),t.A,t2.C,rotated=true,offset=3*mm);
distance(format("$%f$",length(t2.B-t.A)),t.A,t2.B,rotated=false,offset=6*mm);
//---------------------------------------------------------------------------------------
for(int i=0; i<5; ++i) {label(n[i],p[i],dl[i]);} // Placement des labels
label("$F$",t3.B,N);label("$G$",t3.C,SW);
label("$(BC)\parallel (DE)$",(-1,-3));
Christophe