%@Auteur:Thomas Rey
prologues := 2;

input geometriesyr16;

figure(-u,-2.2u,7u,5.3u);
pair A,B,C,D,M,N,I,J,P;
numeric m,n,i,j;
picture depart;

m=1.3;
n=.6;
i=.5;
j=.6;
B=(0,.1u);
C=(2u,-u);
D=(4u,.5u);
A=(u,3.5u);

I-B=i*(C-B);
J-C=j*(D-C);

M-A=m*(I-A);
N-A=n*(J-A);

depart=image(
trace A--B--C--A--D--C;
trace B--D dashed evenly;
trace demidroite(A,I);
trace A--J;
nomme.top(A);
nomme.ulft(B);
nomme.rt(D);
nomme.lrt(C);
nomme.llft(I);
nomme.lrt(J);

marque_p:="croix";
nomme.rt(M);
nomme.rt(N);
);% fin de la figure de départ;

trace depart;
fin;

figure(-u,-2.2u,7u,5.3u);
trace depart;

trace I--J dashed evenly withpen pencircle scaled 1bp withcolor blue;
trace I--(2I-J) withpen pencircle scaled 1bp withcolor blue;
trace J--(2J-I) withpen pencircle scaled 1bp withcolor blue;

fin;

figure(-u,-2.2u,7u,5.3u);
pair X;
trace depart;

trace I--J dashed evenly withpen pencircle scaled 1bp withcolor blue;
trace I--(2I-J) withpen pencircle scaled 1bp withcolor blue;
trace J--(2J-I) withpen pencircle scaled 1bp withcolor blue;

X-M=whatever*(M-N);
X-B=whatever*(B-C);

P-I=whatever*(I-J);
P-M=whatever*(M-N);

trace M--X withcolor red withpen pencircle scaled 1bp;
trace X--N dashed evenly withcolor red withpen pencircle scaled 1bp;
nomme.lrt(P);

fin;

end