input geometriesyr15;
%---------------------------------------------------------
%Théorème de Thalès fig.1
%---------------------------------------------------------
figure(-5u,-5u,5u,5u);
origine((0,0));
pair A,B,C,M,N,P,Q;
A=u*(0,4);
B=u*(4,-4);
C=u*(-3,-3);
M=.5[A,B];
N=.5[A,C];
trace droite(A,B);
trace droite(A,C);
trace droite(B,C)withcolor red;
trace droite(M,N)withcolor red;
marque_p:="plein";
nomme.lft(A);
nomme.urt(B);
nomme.ulft(C);
nomme.urt(M);
nomme.ulft(N);
label.rt(btex $(d_{1})$ etex,A+u*2.5*unitvector(M-A));
label.lft(btex $(d_{2})$ etex,A+u*2.5*unitvector(N-A));
fin;
%---------------------------------------------------------
%Théorème de Thalès fig.2
%---------------------------------------------------------
figure(-5u,-5u,5u,5u);
origine((0,0));
pair A,B,C,M,N,P,Q;
A=u*(0,4);
B=u*(3,-2);
C=u*(-2,-1);
M=1.3[A,B];
N=1.3[A,C];
trace droite(A,B);
trace droite(A,C);
trace droite(B,C)withcolor red;
trace droite(M,N)withcolor red;
marque_p:="plein";
nomme.lft(A);
nomme.urt(B);
nomme.ulft(C);
nomme.urt(M);
nomme.ulft(N);
label.rt(btex $(d_{1})$ etex,A+u*2.5*unitvector(M-A));
label.lft(btex $(d_{2})$ etex,A+u*2.5*unitvector(N-A));
fin;
%---------------------------------------------------------
%Théorème de Thalès fig.3
%---------------------------------------------------------
figure(-5u,-5u,5u,5u);
origine((0,0));
pair A,B,C,M,N,P,Q;
A=u*(0,0);
B=u*(4,-4);
C=u*(-3,-3);
M=-.5[A,B];
N=-.5[A,C];
trace droite(A,B);
trace droite(A,C);
trace droite(B,C)withcolor red;
trace droite(M,N)withcolor red;
marque_p:="plein";
nomme.lft(A);
nomme.bot(B);
nomme.bot(C);
nomme.bot(M);
nomme.bot(N);
label.rt(btex $(d_{1})$ etex,A+u*5*unitvector(M-A));
label.lft(btex $(d_{2})$ etex,A+u*5*unitvector(N-A));
fin;
%---------------------------------------------------------
%Théorème de Thalès fig.4 (main levee reciproque 1)
%---------------------------------------------------------
figuremainlevee(-5u,-5u,5u,5u);
pair A,B,C,M,N,P,Q;
A=(0,0)*u;
B=(-0.75,-3)*u;
C=(1.5,-3)*u;
M=(-0.5,-2)*u;
N=(1,-2)*u;
trace triangle(A,B,C) ;
trace segment(M,N);
nomme.top(A);
nomme.llft(B);
nomme.lrt(C);
nomme.ulft(M);
nomme.urt(N);
trace cotation (M,A,2mm,3mm,btex 5 etex);
trace cotation (B,M,2mm,3mm,btex 7 etex);
trace cotation (M,N,2mm,3mm,btex 4 etex);
trace cotation (B,C,-2mm,-5mm,btex 15,6 etex);
finmainlevee;

%---------------------------------------------------------
%Théorème de Thalès fig.5 (partager un segment)
%On cherche les points M tels que MA/MB=a/b
%On peut changer les valeurs de a et b (positifs)
%---------------------------------------------------------
figure (-1u,-1u,5u,5u);
pair A,B,C,D,E,N,M;
numeric a,b,c;
a=3;
b=5;
c=a/b;
A=u*(0,0);
B=u*(4,0);
E=u*(1,0);
%on peut choisir l'angle de la demi-droite [AC).
D=rotation (E,A,45);
marque_p:="croix";
for i=1 upto b:
pointe (A+u*i*.5*unitvector(D-A));
endfor;
trace segment (A,B);
trace droite (A,D);
marque_p:="plein";
N=A+u*a*.5*unitvector(D-A);
C=A+u*b*.5*unitvector(D-A);
nomme.top(C);
nomme.top(N);
trace droite (B,C) withcolor rouge;
trace parallele(B,C,N) withcolor rouge;
M=c[A,B];
nomme.ulft(A);
nomme.bot(B);
nomme.bot(M);
label.lrt(btex $x$ etex,A+u*4*unitvector(C-A));
fin;

%---------------------------------------------------------
%Théorème de Thalès fig.4 (main levee reciproque 2)
%---------------------------------------------------------
figuremainlevee(-5u,-5u,5u,5u);
pair A,B,C,M,N;
A=(0,0)*u;
B=(-0.75,-3)*u;
C=(1.5,-3)*u;
M=(-0.25,-1)*u;
N=(-0.25,0.5)*u;
trace triangle(A,B,C) ;
trace A--N;
nomme.urt(A);
nomme.llft(B);
nomme.lrt(C);
nomme.llft(M);
nomme.urt(N);
trace cotation (M,A,2mm,3mm,btex $2/3$ etex);
trace cotation (B,A,-2mm,-2mm,btex 2 etex);
trace cotation (A,N,2mm,2mm,btex 1 etex);
trace cotation (A,C,2mm,5mm,btex 3 etex);
finmainlevee;

%---------------------------------------------------------
%Partage d'un segment MA/MB=a/b
%---------------------------------------------------------
figure(-8u,-3u,5u,5u);
pair A,B,C,M,N,P,Q;
A=(-2,0)*u;
B=(3,0)*u;
C=(-.33,0)*u;
M=(-1.5,1.5)*u;
N=(4,3)*u;
P=(-2.5,-1.5)*u;
Q=(-7,0)*u;
trace droite(B,N)withcolor rouge;
trace droite(A,M)withcolor rouge;
trace droite(Q,N);
trace droite(B,Q);
trace droite(P,N);
marque_p:="croix";
for i=1 upto 6:
pointe (P+i*unitvector(M-P)*abs(M-P)/6);
endfor;
for i=1 upto 5:
pointe (B+i*unitvector(N-B)*abs(N-B)/5);
endfor;
marque_p:="plein";
nomme.lrt(A);
nomme.lrt(B);
nomme.lrt(C);
nomme.ulft(M);
nomme.ulft(N);
dotlabel.lrt("M'",P);
dotlabel.bot("C'",Q);
label.lrt(btex $(d)$ etex,A+u*3*unitvector(M-A))withcolor rouge;
label.lrt(btex $(d')$ etex,B+u*2*unitvector(B-N))withcolor rouge;
fin;

end

