%@Auteur: Thomas Rey
prologues := 2;

input geometriesyr16.mp;

figure(-u,-u,7u,5.3u);
pair A,B,C,D,S,M,N,P,I,J,K,L;
numeric m,n,p;
picture depart;

m=.7;
n=.5;
p=.7;

A=(0,0);
B=(4u,0);
C=(6u,u);
D=(1.5u,1.8u);
S=(2u,4u);

depart=image(
trace S--A--B--C--S--B;
trace A--D--S dashed evenly;
trace D--C dashed evenly;
nomme.top(S);
nomme.llft(A);
nomme.lrt(B);
nomme.lrt(C);
nomme.lrt(D);

M-S=m*(A-S);
N-S=n*(B-S);
P-S=p*(C-S);
marque_p:="croix";
nomme.lft(M);
nomme.lft(N);
nomme.urt(P);
);% fin de la figure de départ;

trace depart;
fin;

figure(-4u,-u,10u,5.3u);
trace 2coinbg--2coinbd--2coinhd;
trace depart;
fin;


figure(-4u,-u,10u,5.3u);
trace 2coinbg--2coinbd--2coinhd;
trace depart;

I-A=whatever*(A-B);
I-M=whatever*(M-N);

J-C=whatever*(B-C);
J-P=whatever*(N-P);

trace droite(A,B) withcolor red;
trace droite(M,N) withcolor red;

trace droite(N,P) withcolor blue;
trace droite(B,C) withcolor blue;

nomme.bot(I);
nomme.top(J);

fin;


figure(-4u,-u,10u,5.3u);
trace 2coinbg--2coinbd--2coinhd;
pair X,Y;

trace depart;

trace droite(A,B) withcolor red;
trace droite(M,N) withcolor red;

trace droite(N,P) withcolor blue;
trace droite(B,C) withcolor blue;
nomme.bot(I);
nomme.top(J);

X-A=whatever*(S-A);
X-I=whatever*(I-J);

Y-C=whatever*(C-S);
Y-I=whatever*(I-J);

trace demidroite(X,I) withcolor green withpen pencircle scaled 1bp;
trace demidroite(Y,J) withcolor green withpen pencircle scaled 1bp;
trace X--Y dashed evenly withcolor green withpen pencircle scaled 1bp;

K-A=whatever*(D-A);
K-I=whatever*(I-J);

L-C=whatever*(C-D);
L-I=whatever*(I-J);

nomme.lrt(K);
nomme.lrt(L);

fin;


figure(-4u,-u,10u,5.3u);
trace 2coinbg--2coinbd--2coinhd;

trace depart;

trace demidroite(X,I) withcolor green withpen pencircle scaled 1bp;
trace demidroite(Y,J) withcolor green withpen pencircle scaled 1bp;
trace X--Y dashed evenly withcolor green withpen pencircle scaled 1bp;

nomme.lrt(K);
nomme.lrt(L);
nomme.bot(I);
nomme.top(J);

fin;


figure(-4u,-u,10u,5.3u);
trace 2coinbg--2coinbd--2coinhd;
path section;
trace depart;

trace demidroite(X,I) withcolor green withpen pencircle scaled 1bp;
trace demidroite(Y,J) withcolor green withpen pencircle scaled 1bp;
trace X--Y dashed evenly withcolor green withpen pencircle scaled 1bp;

nomme.lrt(K);
nomme.lrt(L);
nomme.bot(I);
nomme.top(J);

trace M--N--P withpen pencircle scaled 1.5bp withcolor blue;
trace P--L--K--M dashed evenly withpen pencircle scaled 1.5bp withcolor blue;
section=M--N--P--L--K--cycle;
fillcolor:=.5*white+.5*blue;
transparence(section);

fin;

figure(-4u,-u,10u,5.3u);
trace 2coinbg--2coinbd--2coinhd;
trace M--S--N;
trace P--S;
trace S--D--K dashed evenly;
trace D--L dashed evenly;
trace section withpen pencircle scaled 1.5bp withcolor blue;
transparence(section);
nomme.top(S);
nomme.lft(M);
nomme.lrt(K);
nomme.lrt(L);
nomme.rt(P);
nomme.lft(N);

fin;

end