%@Auteur:Thomas Rey
prologues := 2;

input geometriesyr16;

figure(-u,-u,6.5u,6u);

pair A,B,C,D,E,F,G,H,I,J,K,L,M,N;
picture depart;
numeric r,v;
r:=.5;%rapport de la persp. cavaličre
v:=30;%angle de la ...

A=(0,0);
B=(4u,0);
C-B=r*((B-A) rotated v);
D-C=A-B;
E=(0,4u);
F-E=B-A;
G-F=C-B;
H-G=E-F;

I=.5*(A+E);
J=.5*(D+H);
K=.5*(C+G);
L=.5*(B+F);

depart=image(
trace 5coinbg--5coinbd--5coinhd;
trace G--H--E--F--G--C--B--F;
trace B--A--E;
trace A--D--H dashed evenly;
trace D--C dashed evenly;
nomme.llft(A);
nomme.lrt(B);
nomme.rt(C);
nomme.lft(D);
nomme.ulft(E);
nomme.ulft(F);
nomme.urt(G);
nomme.ulft(H);


marque_p:="croix";
nomme.lft(I);
nomme.lft(J);
nomme.lft(K);
nomme.lft(L);

M-H=.3*(G-H);
nomme.top(M);

N-A=.7*(B-A)+.4*(D-A);
nomme.top(N);
);%fin de l'image depart

trace depart;

fin;


%%%%%%%%%%%%%%
% Fig 12
u:=1cm;
figure(-u,-u,6.5u,6u);
pair Z;
trace depart;
Z-A=whatever*(A-B);
Z-J=whatever*(H-J);
%La droite HJ :
trace H--Z dashed evenly withcolor red;
trace H--(H+H-J) withcolor red;
trace Z--Z+Z-H withcolor red;

trace droite(L,B) withcolor red;

fin;

%%%%%%%%%%%%%%
% Fig 13
u:=1cm;
figure(-u,-u,6.5u,6u);

trace depart;

%La droite HJ :
trace H--Z dashed evenly withcolor red;
trace H--(H+H-J) withcolor red;
trace Z--Z+Z-H withcolor red;

trace droite(F,G) withcolor red;

fin;

%%%%%%%%%
%Fig 14 : GL et BC
figure(-u,-2u,6.5u,6u);
pair Z;
trace depart;

%La droite GL :
trace droite(G,L) withcolor red;
trace droite(B,C) withcolor red;
Z-L=whatever*(G-L);
Z-B=whatever*(B-C);
marque_p:="plein";
pointe(Z);

fin;

%%%%%%%%%%
%Fig 15 : EI et JB
figure(-u,-u,6.5u,6u);
pair Z;
trace depart;
trace droite(E,I) withcolor red withpen pencircle scaled 1.5bp;
%droite JB :
Z-E=whatever*(E-H);
Z-J=whatever*(J-B);
trace Z--B dashed evenly withcolor red withpen pencircle scaled 1bp;
trace B--(B+B-Z) withcolor red withpen pencircle scaled 1.5bp;
trace Z--(Z+Z-B) withcolor red;

fin;

%%%%%%%%
% Fig 16 : FL et AB
figure(-u,-u,6.5u,6u);
trace depart;
trace droite(F,L) withpen pencircle scaled 1.5bp withcolor red;
trace droite(A,B) withpen pencircle scaled 1.5bp withcolor red;
marque_p:="plein";
pointe(B);

fin;

%%%%%%%%%%%%
% Fig 17 : EC et GA
figure(-u,-u,6.5u,6u);
trace depart;
% Droite EC :
trace E--C dashed evenly withpen pencircle scaled 1bp withcolor red;
trace E--(E+E-C) withpen pencircle scaled 1.5bp withcolor red;
trace C--(C+C-E) withpen pencircle scaled .5bp withcolor red;
% Droite GA :
trace G--A dashed evenly withpen pencircle scaled 1bp withcolor red;
trace G--(G+G-A) withpen pencircle scaled .5bp withcolor red;
trace A--(A+A-G) withpen pencircle scaled 1.5bp withcolor red;
marque_p:="plein";
pointe(.5*(E+C));
fin;

%%%%%%%%%%%%
%Fig 18 : HIL et FG
figure(-u,-u,7.5u,6u);
path plan;
trace depart;
plan=(H+H-I)--I--(L+.3*(L-I))--(G+G-L+.3*(G-H))--cycle;
fillcolor:=.5*white+.5*red;
transparence(plan);
trace plan withcolor red;
trace L--G withcolor red;
trace demidroite(G,F) withpen pencircle scaled 1bp withcolor blue;
trace G--(G+G-F) dashed evenly withpen pencircle scaled .5bp withcolor blue;
trace H--G withpen pencircle scaled 1bp withcolor red;
trace H--E--F--B--A--E withpen pencircle scaled 1bp;
trace B--C--K withpen pencircle scaled 1bp;
marque_p:="plein";
pointe(G);

fin;

%%%%%%%%%%%%
%Fig 19 : IFG et KD
figure(-u,-u,6.5u,6u);
path plan;
pair Z;
trace depart;
plan=I--F--G--J--cycle;
trace I--F--G withpen pencircle scaled 1bp withcolor red;
trace G--J--I dashed evenly withpen pencircle scaled 1bp withcolor red;
transparence(plan);
Z-A=whatever*(A-E);
Z-K=whatever*(K-D);
trace Z--K dashed evenly withpen pencircle scaled 1bp withcolor blue;
trace Z--(2Z-K) withpen pencircle scaled 1bp withcolor blue;
trace K--(2K-Z) withpen pencircle scaled 1bp withcolor blue;
%trace droite(K,D) withcolor blue;

fin;

%%%%%%%
%Fig 20 : DN et EFM
figure(-u,-u,6.5u,6u);
path plan;
pair Y,Z;
trace depart;
plan=E--F--G--H--cycle;
trace plan withpen pencircle scaled 1bp;
transparence(plan);
Y-B=whatever*(B-C);
Y-N=whatever*(N-D);
Z-A=whatever*(A-E);
Z-D=whatever*(N-D);
trace Y--D dashed evenly withpen pencircle scaled 1bp withcolor blue;
trace D--Z dashed evenly withpen pencircle scaled .5bp withcolor blue;
trace Z--(2Z-D) withcolor blue;
trace Y--(2Y-Z) withpen pencircle scaled 1.5bp withcolor blue;

fin;

%%%%%%%%%%%%
%Fig 21 : HJ et IDA
figure(-u,-u,6.5u,6u);
path plan;
pair Z;
trace depart;
plan=A--E--H--D--cycle;
trace H--E--A withpen pencircle scaled 1bp withcolor red;
trace A--D--H dashed evenly withpen pencircle scaled 1bp withcolor red;
transparence(plan);
Z-D=whatever*(D-H);
Z-A=whatever*(B-A);
trace Z--H withcolor blue dashed evenly;
trace Z--(2Z-H) withcolor blue;
trace H--(2H-Z) withcolor blue;
trace E--F--B--A--E withpen pencircle scaled 1bp;
fin;

%%%%%%%%%%%
%Fig 22 : ADN et GK
figure(-u,-u,6.5u,6u);
path plan;
pair Z;
trace depart;
trace A--B--C withpen pencircle scaled 1bp withcolor red;
trace C--D--A dashed evenly withpen pencircle scaled 1bp withcolor red;
plan=A--B--C--D--cycle;
transparence(plan);
trace droite(G,K) withpen pencircle scaled 1bp withcolor blue;
marque_p:="plein";
pointe(C);

fin;

%%%%%%%%%%%%%%
%fig 23 : FIJ et ADE
figure(-u,-u,6.5u,6u);
path plana,planb;
pair Z;
trace depart;
plana=F--I--J--G--cycle;
trace plana withcolor red withpen pencircle scaled 1bp;
transparence(plana);

planb=A--D--H--E--cycle;
trace planb withcolor blue withpen pencircle scaled 1bp;
fillcolor:=.5white+.5*blue;
transparence(planb);

Z-G=whatever*(H-G);
Z-J=whatever*(I-J);
trace I--Z dashed evenly withcolor (.5*blue+.5*red);
trace Z--(2Z-I) withcolor (.5*blue+.5*red);
trace I--(2I-Z) withcolor (.5*blue+.5*red) withpen pencircle scaled 1bp;

fin;

%%%%%%%%%%%
% Fig 24 : GIL et ABK
figure(-u,-u,6.5u,6u);
path plana,planb;
pair Z;
trace depart;
plana=G--H--I--L--cycle;
planb=A--B--K--J--cycle;

trace A--B--K withpen pencircle scaled 1bp withcolor red;
trace K--J--A dashed evenly withpen pencircle scaled 1bp withcolor red;
fillcolor:=.5*white+.5*red;
transparence(planb);

trace I--L--G--H withpen pencircle scaled 1bp withcolor blue;
trace H--I dashed evenly withpen pencircle scaled 1bp withcolor blue;
fillcolor:=.5*white+.5*blue;
transparence(plana);

fin;

%%%%%%%%%%
% Fig 25 : (MJ) et (ABC)
figure(-u,-u,6.5u,6u);
pair X,Y,Z;
trace depart;
Z-J=whatever*(M-J);
Z-D=whatever*(D-C);
Y-D=whatever*(D-C);
Y-A=whatever*(A-E);
X-A=whatever*(A-E);
X-M=whatever*(M-J);
trace C--Y dashed evenly withcolor blue;
trace C--(2C-D) withcolor blue;
trace Y--(2Y-C) withcolor blue;
trace M--X dashed evenly withcolor red;
trace X--(2X-M) withcolor red;
trace M--(2M-X) withcolor red;

marque_p:="plein";
pointe(Z);

fillcolor:=.5*white+.5*blue;
transparence(A--B--C--D--cycle);
fin;

%%%%%%%%%
% Fig 26 : intersection de AMF et EFG
% étape 1
figure(-u,-u,6.5u,6u);
pair X;
trace depart;
trace M--F withcolor red withpen pencircle scaled 1bp;
X-M=whatever*(F-A);
X-H=whatever*(H-D);
fin;

%%%%%%%%%
% Fig 27 : intersection de AMF et EFG
% étape 2
figure(-u,-u,6.5u,6u);

trace depart;
trace M--F withcolor red withpen pencircle scaled 1bp;
trace M--X dashed evenly withcolor red withpen pencircle scaled 1bp;
trace F--A withcolor red withpen pencircle scaled 1bp;

fin;

%%%%%%%%%
% Fig 28 : intersection de AMF et EFG
% étape 3
figure(-u,-u,6.5u,6u);

trace depart;
trace M--F withcolor red withpen pencircle scaled 1bp;
trace M--X dashed evenly withcolor red withpen pencircle scaled 1bp;
trace F--A withcolor red withpen pencircle scaled 1bp;
trace A--X dashed evenly withcolor red withpen pencircle scaled 1bp;
fin;

%%%%%%%%%
% Fig 29 : intersection de AMF et EFG
% étape 4
figure(-u,-u,6.5u,6u);

trace depart;
trace M--F withcolor red withpen pencircle scaled 1bp;
trace M--X dashed evenly withcolor red withpen pencircle scaled 1bp;
trace F--A withcolor red withpen pencircle scaled 1bp;
trace A--X dashed evenly withcolor red withpen pencircle scaled 1bp;
fillcolor:=.5*white+.5*red;
transparence(A--F--M--X--cycle);
fin;

%%%%%%%%%
% Fig 30 : intersection de AMF et EFG
% étape 5 (fin)
figure(-u,-u,6.5u,6u);

trace depart;
trace M--F withcolor red withpen pencircle scaled 1bp;
trace M--X dashed evenly withcolor red withpen pencircle scaled 1bp;
trace F--A withcolor red withpen pencircle scaled 1bp;
trace A--X dashed evenly withcolor red withpen pencircle scaled 1bp;
fillcolor:=.5*white+.5*red;
transparence(A--F--M--X--cycle);
fillcolor:=.5*white+.5*blue;
transparence(E--F--G--H--cycle);
trace droite(M,F) withpen pencircle scaled 1.5bp withcolor .5*blue+.5*red;

fin;

%%%%%%%%%%%%
%fig 31 : BNF et EFG
%étape 1
figure(-u,-u,6.5u,6u);
pair X,Y;
trace depart;
X-B=whatever*(B-N);
X-C=whatever*(D-C);
Y-X=G-C;
trace B--X dashed evenly withcolor red withpen pencircle scaled 1bp;

fin;

%%%%%%%%%%%%
%fig 32 : BNF et EFG
%étape 2
figure(-u,-u,6.5u,6u);

trace depart;

trace B--X dashed evenly withcolor red withpen pencircle scaled 1bp;
trace B--F withcolor red withpen pencircle scaled 1bp;
trace X--Y dashed evenly withcolor red withpen pencircle scaled 1bp;
fin;

%%%%%%%%%%%%
%fig 33 : BNF et EFG
%étape 3
figure(-u,-u,6.5u,6u);

trace depart;

trace B--X dashed evenly withcolor red withpen pencircle scaled 1bp;
trace B--F withcolor red withpen pencircle scaled 1bp;
trace X--Y dashed evenly withcolor red withpen pencircle scaled 1bp;
trace F--Y withcolor red withpen pencircle scaled 1bp;
fillcolor:=.5*white+.5*red;
transparence(B--X--Y--F--cycle);
fin;

%%%%%%%%%%%%
%fig 34 : BNF et EFG
%étape 4
figure(-u,-u,6.5u,6u);

trace depart;

trace B--X dashed evenly withcolor red withpen pencircle scaled 1bp;
trace B--F withcolor red withpen pencircle scaled 1bp;
trace X--Y dashed evenly withcolor red withpen pencircle scaled 1bp;
trace F--Y withcolor red withpen pencircle scaled 1bp;

trace E--F--G--H--E withcolor blue withpen pencircle scaled 1bp;
fillcolor:=.5*white+.5*red;
transparence(B--X--Y--F--cycle);
fillcolor:=.5*white+.5*blue;
transparence(E--F--G--H--cycle);
fin;

%%%%%%%%%%%%
%fig 35 : BNF et EFG
%étape 5
figure(-u,-u,6.5u,6u);

trace depart;

trace B--X dashed evenly withcolor red withpen pencircle scaled 1bp;
trace B--F withcolor red withpen pencircle scaled 1bp;
trace X--Y dashed evenly withcolor red withpen pencircle scaled 1bp;
trace F--Y withcolor red withpen pencircle scaled 1bp;

trace E--F--G--H--E withcolor blue withpen pencircle scaled 1bp;
fillcolor:=.5*white+.5*red;
transparence(B--X--Y--F--cycle);
fillcolor:=.5*white+.5*blue;
transparence(E--F--G--H--cycle);
trace droite(F,Y) withcolor .5*red+.5*blue withpen pencircle scaled 1bp;
fin;

%%%%%%%%%%%%
%fig 36 : IJM et LKM
%étape 1
figure(-u,-u,6.5u,6u);
pair X;
trace depart;
X-M=I-J;
trace I--J dashed evenly withcolor red withpen pencircle scaled 1bp;

fin;

%%%%%%%%%%%%
%fig 37 : IJM et LKM
%étape 2
figure(-u,-u,6.5u,6u);
trace depart;

trace I--J dashed evenly withcolor red withpen pencircle scaled 1bp;
trace J--M dashed evenly withcolor red withpen pencircle scaled 1bp;
trace I--X withcolor red withpen pencircle scaled 1bp;
fin;

%%%%%%%%%%%%
%fig 38 : IJM et LKM
%étape 3
figure(-u,-u,6.5u,6u);
trace depart;

trace I--J dashed evenly withcolor red withpen pencircle scaled 1bp;
trace J--M dashed evenly withcolor red withpen pencircle scaled 1bp;
trace I--X withcolor red withpen pencircle scaled 1bp;
trace M--X withcolor red withpen pencircle scaled 1bp;
fillcolor:=.5*white+.5*red;
transparence(J--I--X--M--cycle);
fin;

%%%%%%%%%%%%
%fig 39 : IJM et LKM
%étape 4
figure(-u,-u,6.5u,6u);
trace depart;

trace I--J dashed evenly withcolor red withpen pencircle scaled 1bp;
trace J--M dashed evenly withcolor red withpen pencircle scaled 1bp;
trace I--X withcolor red withpen pencircle scaled 1bp;
trace M--X withcolor red withpen pencircle scaled 1bp;
fillcolor:=.5*white+.5*red;
transparence(J--I--X--M--cycle);

trace L--K withcolor blue withpen pencircle scaled 1bp;

fin;

%%%%%%%%%%%%
%fig 40 : IJM et LKM
%étape 5
figure(-u,-u,6.5u,6u);
trace depart;

trace I--J dashed evenly withcolor red withpen pencircle scaled 1bp;
trace J--M dashed evenly withcolor red withpen pencircle scaled 1bp;
trace I--X withcolor red withpen pencircle scaled 1bp;
trace M--X withcolor red withpen pencircle scaled 1bp;
fillcolor:=.5*white+.5*red;
transparence(J--I--X--M--cycle);

trace L--K withcolor blue withpen pencircle scaled 1bp;
trace K--M dashed evenly withcolor blue withpen pencircle scaled 1bp;
trace L--X withcolor blue withpen pencircle scaled 1bp;

fin;

%%%%%%%%%%%%
%fig 41 : IJM et LKM
%étape 6
figure(-u,-u,6.5u,6u);
trace depart;

trace I--J dashed evenly withcolor red withpen pencircle scaled 1bp;
trace J--M dashed evenly withcolor red withpen pencircle scaled 1bp;
trace I--X withcolor red withpen pencircle scaled 1bp;
trace M--X withcolor red withpen pencircle scaled 1bp;
fillcolor:=.5*white+.5*red;
transparence(J--I--X--M--cycle);

trace L--K withcolor blue withpen pencircle scaled 1bp;
trace K--M dashed evenly withcolor blue withpen pencircle scaled 1bp;
trace L--X withcolor blue withpen pencircle scaled 1bp;
trace M--X withcolor blue withpen pencircle scaled 1bp;
fillcolor:=.5*white+.5*blue;
transparence(X--M--K--L--cycle);
fin;

%%%%%%%%%%%%%
%fig 42 : IJM et LKM
%étape 7
figure(-u,-u,6.5u,6u);
trace depart;

trace I--J dashed evenly withcolor red withpen pencircle scaled 1bp;
trace J--M dashed evenly withcolor red withpen pencircle scaled 1bp;
trace I--X withcolor red withpen pencircle scaled 1bp;
trace M--X withcolor red withpen pencircle scaled 1bp;
fillcolor:=.5*white+.5*red;
transparence(J--I--X--M--cycle);

trace L--K withcolor blue withpen pencircle scaled 1bp;
trace K--M dashed evenly withcolor blue withpen pencircle scaled 1bp;
trace L--X withcolor blue withpen pencircle scaled 1bp;
trace M--X withcolor blue withpen pencircle scaled 1bp;
fillcolor:=.5*white+.5*blue;
transparence(X--M--K--L--cycle);
trace droite(M,X) withpen pencircle scaled 1bp withcolor .5*blue+.5*red;
fin;

end