Petit exercice de géométrie...

Animation flash


fig.mp
prologues := 1;
input fichierps;
 
InitFichierPS(-205,-15,215,185);
 
pair A,B,C,D,P,N[],M,I;
 
u := 2cm;
 
A = (0,0);
B = (3,0) scaled u;
C = (3,3) scaled u;
D = (0,3) scaled u;
I = 0.5[A,C];
 
path d;
 
defaultfont := "putri8a";
 
for i=0 upto 100:
 
    beginfig(i+1);
 
	draw (2.2[C,D])--(1.2[D,C]);
	draw D--A--B--C;
	dotlabel.top("D",D);
	dotlabel.top("C",C);
	dotlabel.bot("B",B);
	dotlabel.bot("A",A);
 
	if i<=50:
	    P := (3,3*i/50) scaled u;
	else:
	    P := (3,6-3*i/50) scaled u;
	fi;
 
	N[i] = whatever * (P rotated 90);
	N[i] = whatever [C,D];
 
	dotlabel.rt("P",P);
	dotlabel.ulft("N",N[i]);
 
	draw N[i]--A--P--cycle; 
 
	M := 0.5[P,N[i]];
 
	drawarrow B--P
	    withpen pencircle scaled 1.5
	    withcolor 0.4blue;
 
	if i=0:
	    d := M;
	else:
	    d := d -- M;
	    drawarrow d
		withpen pencircle scaled 1.5
		withcolor red;
	fi;
 
	dotlabel.bot("I",I);
 
    endfig;
endfor;
 
end