%@AUTEUR:Guillaume Connan
prologues:=2;

verbatimtex
%&latex
\documentclass{article}
\begin{document}
etex

input courbes;
input geo;

color vert_e, turquoise, orange, vert_fonce, rose, vert_mer, bleu_ciel, or, rouge_v,bleu_m,bleu,bleu_f;
vert_e:=(0,0.790002,0.340007);
turquoise:=(0.250999,0.878399,0.815699);
orange:=(0.589999,0.269997,0.080004);
vert_fonce:=(0,1.4*0.392193,0);
rose:=(1.0, 0.752907, 0.796106);
bleu_ciel:=(1.2*0.529405,1.2*0.807794,1);%.2*0.921598);
or:=(1,0.843104,0);
rouge_v:=(0.829997,0.099994,0.119999);
bleu_m:=(0.7*0.529405,0.7*0.807794,0.7);%*0.921598);
bleu_f:=(0.211762,0.3231176,0.3686392);
bleu:=(0.529405,0.807794,1);

%    TAF
pair A,M; path c,cartouche;

c=(2.3cm,1cm)..(4.5cm,4cm)..(9cm,3cm);
cartouche = (4cm,2mm)--(9cm,2mm)--(9cm,8mm)--(4cm,8mm)--cycle;

A = point 0.6 of c;
M = point 1.5 of c;


beginfig(1);
  repere(10cm,5cm,2cm,2cm,1cm,1cm);
  rtrace.axes(0.5pt);
%% lectures sur la grille
  numeric xa,ya,xm,ym,xc,yc;
  xa = 1.25; ya = 1.1 ; xm = 4.9 ; ym = 2.25;
  xc = 2.9 ; yc =2.2;
  pair AA,MM,CC;
  AA = (xa,ya) ; MM = (xm,ym) ; CC = (xc,yc);
 
  path ff,ab;
  ff:=rpoint(xc,yc)--rpoint(xc,0);
  ab:=(AA--MM) en_place;
 
  pair P,m;
  m:=(ff intersectionpoint c);
  P:=(ff intersectionpoint ab);
  draw (CC--(xc,0)) en_place dashed evenly scaled 1.7 withpen pencircle scaled 0.5;
 
  draw rpoint(xa,ya)--rpoint(xa,-0.2) dashed evenly;
  draw rpoint(xm,ym)--rpoint(xm,-0.2) dashed evenly;
 
  label(btex $a$ etex,rpoint(xa,-0.2));
  label(btex $b$ etex,rpoint(xm,-0.2));
  dotlabel.ulft(btex $M$ etex, m);
  dotlabel.lrt(btex $P$ etex, P);
 
  label(btex $x$ etex,rpoint(xc,-0.2));
%% fin des lectures
 
  draw c withpen pencircle scaled 1.5pt withcolor bleu_f;
 
  draw 1.2[A,M]--1.2[M,A];
 
  %draw tangente(1.09,6) withpen pencircle scaled 1.5pt withcolor 0.6white;
  drawdblarrow (m+1/2*(A-P))--(m+1/2*(P-A));
 
  dotlabel.lrt(btex $A$ etex ,A);
 
  dotlabel.lrt(btex etex,M);
  label.bot(btex $B$ etex ,rpoint(5.15,2.2));
 
  label.bot(btex $\mathcal{C}_f$ etex ,point 2 of c);
  
  decoupe.repere;
  etiquette.axes;
endfig;
end