exemple.mp [ source brut ]
input geometriesyr16;
figureespace(-10u,-10u,25u,10u); Initialisation(5,25,20,250); color A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,S; B=(0,0,0); A=(1.3,0,0); D=(1.3,1.3,0); C=(0,1.3,0); G=(0,0,1.3); F=(1.3,0,1.3); E=(1.3,1.3,1.3); H=(0,1.3,1.3); I=(-0.3,1.4,0); J=(0.4,2.1,0); K=(-0.3,2.7,0); L-K=I-J; M-L=(0,0,0.7*sqrt(2)); N-K=M-L; O-J=M-L; Q-I=M-L; S=(0.5,-0.75,2.5); P=ProjectionsurPlan(S,A,B,C); color F',E',E'',H',H'',H''',G',G'',O',M',N',Q'; E'=IntersectionPlanDroite(A,B,C,S,E); F'=IntersectionPlanDroite(A,B,C,S,F); G'=IntersectionPlanDroite(A,B,C,S,G); H'=IntersectionPlanDroite(A,B,C,S,H); H''=IntersectionPlanDroite(Q,I,J,S,H); H'''=IntersectionPlanDroite(Q,O,M,S,H); G''=IntersectionPlanDroite(Q,I,J,G',H'); E''=IntersectionPlanDroite(Q,I,J,E',H'); O'=IntersectionPlanDroite(A,B,C,S,O); M'=IntersectionPlanDroite(A,B,C,S,M); N'=IntersectionPlanDroite(A,B,C,S,N); Q'=IntersectionPlanDroite(A,B,C,S,Q); color RR,SS,TT,UU,VV; RR=IntersectionDroite(G'',H'',Q,O); SS=IntersectionDroite(E'',H'',Q,O); TT=IntersectionDroite(G',H',I,L); VV=IntersectionDroite(E'',H'',J,O); UU=IntersectionDroite(G'',H'',I,Q); color W,Y; W=IntersectionDroite(J,O',E',H'); Y=IntersectionDroite(M',Q',H',G'); trace hachurage(polygone(D,C,B,G',TT,I,UU,RR,H''',SS,VV,J,K,L,M',N',O',W,E',F',A),60,0.25,0) withcolor gris; trace hachurage(polygone(TT,I,UU),60,0.25,0) withcolor gris; trace polygone(D,C,B,G',TT,UU,RR,H''',SS,VV,J,K,L,M',N',O',W,E',F',A) withcolor gris; trace polygone(G,F,E,H); trace polygone(E,H,C,D); trace polygone(F,E,D,A); trace chemin(A,B,G) dashed evenly; trace segment(B,C) dashed evenly; trace polygone(O,N,K,J); trace polygone(Q,M,N,O); trace polygone(Q,O,J,I); trace chemin(I,L,M) dashed evenly; trace segment(L,K) dashed evenly; trace segment(S,P); label.top(btex $S$ etex,Projette(S)); label.bot(btex $P$ etex,Projette(P)); finespace; end