Source

input geometriesyr16;

typerepre:="persp";

figureespace(-10u,-10u,10u,10u);
Initialisation(5,30,20,115);
color A,B,C,D,M[];
D=(0,0,0);
A-D=(1,0,0);
B-A=(0,1,0);
C-D=B-A;
trace polygone(A,B,C,D);
finespace;
figureespace(-10u,-10u,10u,10u);
Initialisation(5,30,20,115);
color A,B,C,D,M[];
D=(0,0,0);
A-D=(1,0,0);
B-A=(0,1,0);
C-D=B-A;
M1-iso(A,B)=Distance(iso(A,B),B)*((B-iso(A,B))*cosd(60)/Distance(iso(A,B),B)+%
(iso(A,B)+D-A-iso(A,B))*sind(60)/Distance(iso(A,B),iso(A,B)+D-A));
M2-M1=C-B;
trace chemin(iso(A,B),B,C,iso(C,D)) cutafter segment(M1,M2);
trace chemin(iso(A,B),B,C,iso(C,D)) cutbefore segment(M1,M2) dashed evenly;
trace polygone(iso(A,B),M1,M2,iso(C,D));
drawarrow Projette(iso(M1,M2))..Projette(3/5[iso(C,M2),iso(M1,B)])..%
Projette(iso(C,B))--Projette(iso(C,B))..Projette(2/5[iso(C,M2),iso(M1,B)])%
..Projette(iso(M1,M2));
finespace;

figureespace(-10u,-10u,10u,10u);
Initialisation(5,30,20,115);
color A,B,C,D,M[];
D=(0,0,0);
A-D=(1,0,0);
B-A=(0,1,0);
C-D=B-A;
trace polygone(A,B,C,D);
trace segment(iso(A,B),iso(C,D)) dashed evenly;
finespace;

figureespace(-10u,-10u,10u,10u);
Initialisation(5,30,20,115);
color A,B,C,D,M[];
D=(0,0,0);
A-D=(1,0,0);
B-A=(0,1,0);
C-D=B-A;
M1-iso(A,iso(A,B))=Distance(iso(A,iso(A,B)),iso(A,B))*((iso(A,B)-iso(A,iso(A,B)))%
*cosd(60)/Distance(iso(A,iso(A,B)),iso(A,B))+(iso(A,iso(A,B))+D-A-iso(A,iso(A,B)))%
*sind(60)/Distance(iso(A,iso(A,B)),iso(A,iso(A,B))+D-A));
M2-M1=C-B;
trace chemin(iso(A,iso(A,B)),iso(A,B),iso(C,D),iso(D,iso(C,D))) cutafter%
segment(M1,M2);
trace chemin(iso(A,iso(A,B)),iso(A,B),iso(C,D),iso(D,iso(C,D))) cutbefore%
segment(M1,M2) dashed evenly;
trace polygone(iso(A,iso(A,B)),M1,M2,iso(D,iso(C,D)));
%partie 2
color M[];
M1-iso(B,iso(A,B))=Distance(iso(B,iso(A,B)),iso(A,B))*((iso(A,B)-iso(B,iso(A,B)))%
*cosd(20)/Distance(iso(B,iso(A,B)),iso(A,B))+(iso(B,iso(A,B))+D-A-iso(B,iso(A,B)))%
*sind(20)/Distance(iso(B,iso(A,B)),iso(B,iso(A,B))+D-A));
M2-M1=C-B;
trace chemin(iso(B,iso(A,B)),iso(A,B),iso(C,D),iso(C,iso(C,D)))%
cutafter segment(M1,M2);
trace chemin(iso(B,iso(A,B)),iso(A,B),iso(C,D),iso(C,iso(C,D)))%
cutbefore segment(M1,M2) dashed evenly;
trace polygone(iso(B,iso(A,B)),M1,M2,iso(C,iso(C,D)));
finespace;

figureespace(-10u,-10u,10u,10u);
Initialisation(5,30,20,115);
trace polygone(A,B,C,D);
drawoptions(withpen pencircle scaled 0.5bp);
trace segment(iso(A,B),1/10[iso(A,B),iso(C,D)]);
trace segment(iso(C,D),1/10[iso(C,D),iso(A,B)]);
trace segment(1/4[A,B],1/4[D,C]);
trace segment(3/4[A,B],3/4[D,C]);
drawoptions();
finespace;

%2eme partie des doubles pliages
figureespace(-10u,-10u,10u,10u);
Initialisation(5,30,20,115);
color M[];
M1-iso(A,D)=Distance(iso(A,D),D)*((D-iso(A,D))*cosd(75)/Distance(iso(A,D),D)+%
(iso(A,D)+A-B-iso(A,D))*sind(75)/Distance(iso(A,D),iso(A,D)+A-B));
M2-M1=B-A;
trace chemin(iso(A,D),A,B,iso(C,B)) cutbefore segment(M1,M2);
trace chemin(iso(A,D),A,B,iso(C,B)) cutafter segment(M1,M2) dashed evenly;
trace chemin(1/4[M1,M2],1/4[iso(A,D),iso(B,C)],1/4[A,B]);
trace chemin(3/4[M1,M2],3/4[iso(A,D),iso(B,C)],3/4[A,B]);
trace polygone(iso(A,D),M1,M2,iso(C,B));
drawarrow Projette(iso(M1,M2))..Projette(3/5[iso(B,M2),iso(M1,A)])..%
Projette(iso(A,B))--Projette(iso(A,B))..Projette(2/5[iso(B,M2),iso(M1,A)])..%
Projette(iso(M1,M2));
finespace;

figureespace(-10u,-10u,10u,10u);
Initialisation(5,30,20,115);
trace polygone(A,B,C,D);
drawoptions(withpen pencircle scaled 0.5bp);
trace segment(iso(A,B),1/10[iso(A,B),iso(C,D)]);
trace segment(iso(C,D),1/10[iso(C,D),iso(A,B)]);
trace segment(1/4[A,B],1/4[D,C]);
trace segment(3/4[A,B],3/4[D,C]);
trace segment(iso(A,D),iso(C,B)) dashed evenly;
drawoptions();
finespace;

figureespace(-10u,-10u,10u,10u);
Initialisation(5,30,20,115);
color M[];
M1-iso(A,iso(A,D))=Distance(iso(A,iso(A,D)),iso(A,D))*((iso(A,D)-iso(A,iso(A,D)))%
*cosd(25)/Distance(iso(A,iso(A,D)),iso(A,D))+(iso(A,iso(A,D))+A-B-iso(A,iso(A,D)))%
*sind(25)/Distance(iso(A,iso(A,D)),iso(A,iso(A,D))+A-B));
M2-M1=B-A;
trace chemin(iso(A,iso(A,D)),iso(A,D),iso(C,B),iso(B,iso(C,B)))%
cutbefore segment(M1,M2);
trace chemin(iso(A,iso(A,D)),iso(A,D),iso(C,B),iso(B,iso(C,B)))%
cutafter segment(M1,M2) dashed evenly;
trace polygone(iso(A,iso(A,D)),M1,M2,iso(B,iso(C,B)));
%partie 2
color M[];
M1-iso(D,iso(A,D))=Distance(iso(D,iso(A,D)),iso(A,D))*((iso(A,D)-iso(D,iso(A,D)))*%
cosd(35)/Distance(iso(D,iso(A,D)),iso(A,D))+(iso(D,iso(A,D))+A-B-iso(D,iso(A,D)))*%
sind(35)/Distance(iso(D,iso(A,D)),iso(D,iso(A,D))+A-B));
M2-M1=B-A;
trace chemin(iso(D,iso(A,D)),iso(A,D),iso(C,B),iso(C,iso(C,B)))%
cutbefore segment(M1,M2);
trace chemin(iso(D,iso(A,D)),iso(A,D),iso(C,B),iso(C,iso(C,B)))%
cutafter segment(M1,M2) dashed evenly;
trace polygone(iso(D,iso(A,D)),M1,M2,iso(C,iso(C,B)));
finespace;

figureespace(-10u,-10u,10u,10u);
Initialisation(5,30,20,115);
trace polygone(1/4[A,D],1/4[B,C],3/4[B,C],3/4[A,D]);
trace segment(1/4[D,B],1/4[A,C]) dashed evenly;
trace segment(3/4[D,B],3/4[A,C]) dashed evenly;
trace segment(iso(A,D),iso(C,B)) withpen pencircle scaled 1.5bp;
finespace;

figureespace(-10u,-10u,10u,10u);
Initialisation(5,30,20,115);
trace polygone(1/4[A,C],1/4[B,D],3/4[A,C],3/4[B,D]);
trace polygone(1/4[A,C],1/4[A,C]+(0,0,1/4),1/4[D,B]+(0,0,1/4),1/4[D,B]);
trace segment(iso(1/4[A,C],1/4[D,B]),iso(3/4[A,C],3/4[D,B])) withpen pencircle%
scaled 1.5bp;
trace segment(iso(1/4[A,C],1/4[D,B]),iso(1/4[A,C]+(0,0,1/4),1/4[D,B]+(0,0,1/4)))%
withpen pencircle scaled 1.5bp;
remplis polygone(3/4[A,C],3/4[A,C]+(0,0,1/4),3/4[D,B]+(0,0,1/4),3/4[D,B])%
withcolor blanc;
trace polygone(3/4[A,C],3/4[A,C]+(0,0,1/4),3/4[D,B]+(0,0,1/4),3/4[D,B]);
finespace;

typerepre:="proj";
%Assemblage
%2 pièces
figureespace(-10u,-10u,10u,10u);
Initialisation(5,15,20,750);
%%pièce2
color A',B',C',D';
A'=1/4[iso(A,D),iso(B,C)];
B'-A'=(0,1/2,0);
C'=3/4[A,C];
D'-A'=C'-B';
picture piecedeux;
piecedeux=image(
remplis polygone(A',B',C',D') withcolor orange;
remplis polygone(C',C'+(0,0,1/2),D'+(0,0,1/2),D') withcolor orange;
trace polygone(A',B',C',D');
trace polygone(C',C'+(0,0,1/2),D'+(0,0,1/2),D');
trace segment(iso(A',B'),iso(C',D')) withpen pencircle scaled 1.5bp;
trace segment(iso(C',D'),iso(C',D')+(0,0,1/2)) withpen pencircle scaled 1.5bp;
remplis polygone(A'+(0,0,1/2),B'+(0,0,1/2),C'+(0,0,1/2),D'+(0,0,1/2))%
withcolor orange;
trace polygone(A'+(0,0,1/2),B'+(0,0,1/2),C'+(0,0,1/2),D'+(0,0,1/2));
);
trace piecedeux shifted(Projette((D-A)));
%%pièce 1
trace polygone(1/4[A,C],1/4[B,D],3/4[A,C],3/4[B,D]);
trace polygone(1/4[A,C],1/4[A,C]+(0,0,1/4),1/4[D,B]+(0,0,1/4),1/4[D,B]);
trace segment(iso(1/4[A,C],1/4[D,B]),iso(3/4[A,C],3/4[D,B])) withpen pencircle%
scaled 1.5bp;
trace segment(iso(1/4[A,C],1/4[D,B]),iso(1/4[A,C]+(0,0,1/4),1/4[D,B]+(0,0,1/4)))%
withpen pencircle scaled 1.5bp;
remplis polygone(3/4[A,C],3/4[A,C]+(0,0,1/4),3/4[D,B]+(0,0,1/4),3/4[D,B])%
withcolor blanc;
trace polygone(3/4[A,C],3/4[A,C]+(0,0,1/4),3/4[D,B]+(0,0,1/4),3/4[D,B]);
%flèche
drawarrow Projette(iso(D',C')+3/4*(D-A)+(0,0,0.02))--Projette(iso(iso(A',B'),%
iso(D',C'))+(0,0,0.02));
finespace;

%3 pièces
figureespace(-10u,-10u,10u,10u);
Initialisation(5,15,20,750);
%%pièce 3
color A'',B'',C'',D'';
A''=1/4[A,C];
B''-A''=(0,1/4,0);
D''=1/4[D,B];
C''-D''=B''-A'';
picture piecetrois;
piecetrois=image(
remplis polygone(D'',C'',C''+(0,0,1/2),D''+(0,0,1/2)) withcolor bleu;
remplis polygone(D'',D''+(0,0,1/2),A''+(0,0,1/2),A'') withcolor bleu;
trace polygone(D'',C'',C''+(0,0,1/2),D''+(0,0,1/2));
trace polygone(D'',D''+(0,0,1/2),A''+(0,0,1/2),A'');
trace segment(iso(D'',D''+(0,0,1/2)),iso(C'',C''+(0,0,1/2))) withpen%
pencircle scaled 1.5bp;
trace segment(iso(D'',D''+(0,0,1/2)),iso(A'',A''+(0,0,1/2))) withpen%
pencircle scaled 1.5bp;
remplis polygone(A''+(0,0,1/2),B''+(0,0,1/2),B'',A'') withcolor bleu;
trace polygone(A''+(0,0,1/2),B''+(0,0,1/2),B'',A'');
);
trace piecetrois shifted(0.5*Projette(A-B));
%%pièce2
color A',B',C',D';
A'=1/4[iso(A,D),iso(B,C)];
B'-A'=(0,1/2,0);
C'=3/4[A,C];
D'-A'=C'-B';
picture piecedeux;
piecedeux=image(
remplis polygone(A',B',C',D') withcolor orange;
remplis polygone(C',C'+(0,0,1/2),D'+(0,0,1/2),D') withcolor orange;
trace polygone(A',B',C',D');
trace polygone(C',C'+(0,0,1/2),D'+(0,0,1/2),D');
trace segment(iso(A',B'),iso(C',D')) withpen pencircle scaled 1.5bp;
trace segment(iso(C',D'),iso(C',D')+(0,0,1/2)) withpen pencircle scaled 1.5bp;
remplis polygone(A'+(0,0,1/2),B'+(0,0,1/2),C'+(0,0,1/2),D'+(0,0,1/2))%
withcolor orange;
trace polygone(A'+(0,0,1/2),B'+(0,0,1/2),C'+(0,0,1/2),D'+(0,0,1/2));
);
trace piecedeux;
%%pièce 1
trace polygone(1/4[A,C],1/4[B,D],3/4[A,C],3/4[B,D]);
trace polygone(1/4[A,C],1/4[A,C]+(0,0,1/4),1/4[D,B]+(0,0,1/4),1/4[D,B]);
trace segment(iso(1/4[A,C],1/4[D,B]),iso(3/4[A,C],3/4[D,B])) withpen pencircle%
scaled 1.5bp;
trace segment(iso(1/4[A,C],1/4[D,B]),iso(1/4[A,C]+(0,0,1/4),1/4[D,B]+(0,0,1/4)))%
withpen pencircle scaled 1.5bp;
remplis polygone(3/4[A,C],3/4[A,C]+(0,0,1/4),3/4[D,B]+(0,0,1/4),3/4[D,B])%
withcolor blanc;
trace polygone(3/4[A,C],3/4[A,C]+(0,0,1/4),3/4[D,B]+(0,0,1/4),3/4[D,B]);
%flèche
drawarrow Projette(iso(D'',D''+(0,0,1/2))+1/4*(A-B)+(0,0,0.02))--%
Projette(iso(iso(C'',C''+(0,0,1/2)),iso(D'',D''+(0,0,1/2)))+(0,0,0.02));
finespace;

%figure finale
figureespace(-10u,-10u,10u,10u);
Initialisation(5,15,20,750);
remplis polygone(1/4[A,C],1/4[B,D],3/4[A,C],3/4[B,D]) withcolor blanc;
remplis polygone(A',B',C',D') withcolor orange;
remplis polygone(A''+(0,0,1/2),B''+(0,0,1/2),B'',A'') withcolor bleu;
remplis polygone(D'',D''+(0,0,1/2),A''+(0,0,1/2),A'') withcolor bleu;
remplis polygone(C',C'+(0,0,1/2),D'+(0,0,1/2),D') withcolor orange;
remplis polygone(D'',C'',C''+(0,0,1/2),D''+(0,0,1/2)) withcolor bleu;
remplis polygone(A'+(0,0,1/2),B'+(0,0,1/2),C'+(0,0,1/2),D'+(0,0,1/2))%
withcolor orange;
remplis polygone(3/4[A,C],3/4[A,C]+(0,0,1/4),3/4[D,B]+(0,0,1/4),3/4[D,B])%
withcolor blanc;
trace polygone(3/4[A,C],3/4[A,C]+(0,0,1/4),3/4[D,B]+(0,0,1/4),3/4[D,B]);
trace polygone(A''+(0,0,1/2),B''+(0,0,1/2),B'',A'');
trace polygone(A'+(0,0,1/2),B'+(0,0,1/2),C'+(0,0,1/2),D'+(0,0,1/2));
trace segment(A''+(0,0,1/2),D''+(0,0,1/2));
trace segment(D'',D''+(0,0,1/2)) cutbefore segment(A''+(0,0,1/2),B''+(0,0,1/2))%
cutafter segment(A'+(0,0,1/2),B'+(0,0,1/2));
trace segment(D'',C'') cutbefore segment(B'',B''+(0,0,1/2));
trace segment(C'',C''+(0,0,1/2)) cutafter segment(A'+(0,0,1/2),B'+(0,0,1/2));
trace segment(1/4[A,C],3/4[D,B]);
trace segment(C'',3/4[A,C]) cutafter segment(3/4[D,B],3/4[D,B]+(0,0,1/4));
trace segment(3/4[A,C],3/4[A,C]+(0,0,1/2));
trace segment(iso(A'',D''),iso(3/4[D,B],3/4[A,C])) cutbefore%
segment(B'',B''+(0,0,1/2)) cutafter segment(3/4[D,B],3/4[D,B]+(0,0,1/4));
finespace;

end