
\begin{TP}[Dans la peau d'un programmeur][\algo]
 Vous êtes programmeur pour un concepteur de logiciel de géométrie dynamique.
 
 \partie{Vecteur et translation}
 Voici une capture d'écran du logiciel sur lequel vous travaillez.  
 
{\bfseries Votre mission}: gérer l'affichage des coordonnées des objets dans le menu {\bfseries Description}.

 L'utilisateur a placé trois points libres $A$, $B$, $C$. 
 Il a utilisé l'icône \og vecteur\fg\ pour tracer le vecteur $\vv{AB}$. 
 Il a utilisé l'icône \og translation\fg\ pour tracer $C'$ le translaté de $C$ dans la translation de vecteur $\vv{AB}$. 
 \vspace{0.5em}
 \begin{center}
 \begin{tikzpicture}[general]
  \clip (0,0) rectangle (13.8,5);
  \draw[color=gray!80, fill=gray!80] (0,0) rectangle (13.8,5);
  \draw[color=gray!50, fill=gray!50] (8,0) rectangle (13.8,5);
  \shade[color=gray,top color=A3, bottom color=blue, rounded corners=5pt] (5.6,5) rectangle (9.5,4);
  \shade[color=gray,top color=A3, bottom color=blue, rounded corners=5pt] (9.6,5) rectangle (13.8,4);
  \draw[color=gray, fill=A3] (0,0) rectangle (9.5,4.6);
  \draw[color=C1] (5.6,4.8) node[right] {Figure};
  \draw[color=C1] (9.6,4.8) node[right] {Description};
  \draw[fill=white, color=white] (7.2,4.8) circle (0.15);
  \draw[color=A1] (7.2,4.8) node {\bfseries +};
  \draw[fill=white, color=white] (7.6,4.8) circle (0.15);
  \draw[color=A1] (7.6,4.8) node {\bfseries -};
  \draw[fill=yellow, color=yellow] (8,4.8) circle (0.15);
  \draw[color=A1] (8,4.8) node {\bfseries i};
  \draw[fill=white, color=white] (8.4,4.8) circle (0.15);
  \draw[color=A1] (8.4,4.8) node {$\boxtimes$};
  \draw[fill=white, color=white] (8.8,4.8) circle (0.15);
  \draw[color=A1] (8.8,4.8) node {\footnotesize $\curvearrowleft$};
  \draw[fill=white, color=white] (9.2,4.8) circle (0.15);
  \draw[color=A1] (9.2,4.8) node {\footnotesize $\curvearrowright$};
  \draw[fill=white, color=white] (13.5,4.8) circle (0.15);
  \draw[color=A1] (13.5,4.8) node {\bfseries -};
  \draw[fill=white, color=white] (12.7,4.8) circle (0.15);
  \draw[color=A1] (12.7,4.8) node {\footnotesize $\curvearrowleft$};
  \draw[fill=white, color=white] (13.1,4.8) circle (0.15);
  \draw[color=A1] (13.1,4.8) node {\footnotesize $\curvearrowright$};
  \draw[color=gray!50, fill=gray!50] (13.5,0) rectangle (13.8,4.6);
  \draw[color=gray, fill=gray!30] (13.5,0.5) rectangle (13.8,0.8);
  \draw[color=gray, fill=gray!30] (13.5,4.6) rectangle (13.8,4.3);
  \draw[color=gray, fill=A3] (9.6,0.5) rectangle (13.5,4.6); 
  \shade[color=gray,top color=A3, bottom color=blue, rounded corners=5pt] (9.6,0.4) rectangle (13.8,-0.4);
  \draw[color=C1] (9.6,0.15) node[right] {Script};
  \draw[fill=white, color=white] (13.5,0.2) circle (0.15);
  \draw[color=A1] (13.5,0.2) node {\bfseries +};
  \draw[color=gray, fill=gray] (13.55,0.75)--(13.75,0.75)--(13.65,0.55)--cycle ;
  \draw[color=gray, fill=gray] (13.55,4.35)--(13.75,4.35)--(13.65,4.55)--cycle ;
   \draw (2.19,2.23) node[below right, color=A1] {A};  
   \draw (6.99,3.55) node[below right, color=A1] {B};  
   \draw (1.54,0.53) node[below right, color=A1] {C};    
   \draw (6.34,1.85) node[below right, color=A1] {C'};
   \draw[axe] (2.19,2.23)--(6.99,3.55);
  \draw (2.19,2.23) node[ color=A1] {$\times$};  
   \draw (6.99,3.55) node[ color=A1] {$\times$};  
   \draw (1.54,0.53) node[ color=A1] {$\times$}; 
   \draw (6.34,1.85) node[ color=A1] {$\times$};
   \begin{small}
     \draw (9.7,4.3) node[right, color=A1] {@ \textcolor{C1}{libre};};
     \draw (9.9,3.9) node[right, color=A1] {A=point(2.19,2.23);};
     \draw (9.9,3.5) node[right, color=A1] {B=point(6.99,3.55);};
     \draw (9.9,3.1) node[right, color=A1] {C=point(1.54,0.53);};
     \draw (9.7,2.6) node[right, color=A1] {@ \textcolor{C1}{lié};};
     \draw (9.9,2) node[right, color=A1] {AB=vecteur$\left( \begin{array}{c}4.8\\1.32\end{array}\right)$;};
     \draw (9.9,1.3) node[right, color=A1] {C'=point(6.34,1.85);};
   \end{small}
 \end{tikzpicture}
\end{center}

Proposer un algorithme qui calcule les nouvelles coordonnées du vecteur $\vv{AB}$ et du point~$C'$ à partir des nouvelles coordonnées des points $A$, $B$ et $C$ quand l'utilisateur déplace l'un de ces trois points à la souris.

 \partie{Point sur}
 Voici une deuxième capture d'écran du logiciel sur lequel vous travaillez.  
 
 {\bfseries Votre mission}: gérer l'affichage des objets dans la fenêtre {\bfseries figure} .

 L'utilisateur a placé deux points libres $A$ et $B$.\\
Il a tracé la droite $(AB)$.
Il a placé le point $P$ sur la droite $(AB)$.

 \begin{center}
 \begin{tikzpicture}[general]
  \draw[color=gray!80, fill=gray!80] (0,0) rectangle (13.8,5);
  \draw[color=gray!50, fill=gray!50] (8,0) rectangle (13.8,5);
  \shade[color=gray,top color=A3, bottom color=blue, rounded corners=5pt] (5.6,5) rectangle (9.5,4);
  \shade[color=gray,top color=A3, bottom color=blue, rounded corners=5pt] (9.6,5) rectangle (13.8,4);
  \draw[color=gray, fill=A3] (0,0) rectangle (9.5,4.6);
  \draw[color=gray!50, fill=gray!50] (9.6,0) rectangle (13.8,4.6);
  \draw[color=C1] (5.6,4.8) node[right] {Figure};
  \draw[color=C1] (9.6,4.8) node[right] {Description};
  \draw[fill=white, color=white] (7.2,4.8) circle (0.15);
  \draw[color=A1] (7.2,4.8) node {\bfseries +};
  \draw[fill=white, color=white] (7.6,4.8) circle (0.15);
  \draw[color=A1] (7.6,4.8) node {\bfseries -};
  \draw[fill=yellow, color=yellow] (8,4.8) circle (0.15);
  \draw[color=A1] (8,4.8) node {\bfseries i};
  \draw[fill=white, color=white] (8.4,4.8) circle (0.15);
  \draw[color=A1] (8.4,4.8) node {$\boxtimes$};
  \draw[fill=white, color=white] (8.8,4.8) circle (0.15);
  \draw[color=A1] (8.8,4.8) node {\footnotesize $\curvearrowleft$};
  \draw[fill=white, color=white] (9.2,4.8) circle (0.15);
  \draw[color=A1] (9.2,4.8) node {\footnotesize $\curvearrowright$};
  \draw[fill=white, color=white] (13.5,4.8) circle (0.15);
  \draw[color=A1] (13.5,4.8) node {\bfseries +};
  \shade[color=gray,top color=A3, bottom color=blue, rounded corners=5pt] (9.6,4.5) rectangle (13.8,3.5);
  \draw[color=gray!50, fill=gray!50] (13.5,0) rectangle (13.8,4.1);
  \draw[color=gray, fill=gray!30] (13.5,0) rectangle (13.8,0.3);
  \draw[color=gray, fill=gray!30] (13.5,3.8) rectangle (13.8,4.1);
  \draw[color=gray, fill=A3] (9.6,0) rectangle (13.5,4.1);
  \draw[color=C1] (9.6,4.25) node[right] {Script};
  \draw[fill=white, color=white] (13.5,4.3) circle (0.15);
  \draw[color=A1] (13.5,4.3) node {\bfseries -};
  \draw[fill=white, color=white] (12.7,4.3) circle (0.15);
  \draw[color=A1] (12.7,4.3) node {\footnotesize $\curvearrowleft$};
  \draw[fill=white, color=white] (13.1,4.3) circle (0.15);
  \draw[color=A1] (13.1,4.3) node {\footnotesize $\curvearrowright$};
  \draw[color=gray, fill=gray] (13.55,0.25)--(13.75,0.25)--(13.65,0.05)--cycle ;
  \draw[color=gray, fill=gray] (13.55,3.85)--(13.75,3.85)--(13.65,4.05)--cycle ;
  \draw[color=A1, very thick] (1,0)--(9.2, 4.6);
  \draw (1,0) node[above left, color=A1] {(dAB)}; 
  \draw (3.19,1.23) node[below right, color=A1] {A};  
  \draw (6.99,3.35) node[below right, color=A1] {B};  
  \draw (1.94,0.53) node[below right, color=A1] {P};  
  \draw (3.19,1.23) node[ color=A1] {$\times$};  
  \draw (6.99,3.35) node[ color=A1] {$\times$};  
  \draw (1.94,0.53) node[ color=A1] {$\times$};
  \begin{small}
    \draw (9.7,3.8) node[right, color=A1] {@ \textcolor{C1}{options};};
    \draw (9.7,3.2) node[right, color=A1] {@ \textcolor{C1}{figure};};
    \draw (9.9,2.8) node[right, color=A1] {A=point(3.19,1.23);};
    \draw (9.9,2.4) node[right, color=A1] {B=point(6.99,3.35);};
    \draw (9.9,1.6) node[right, color=A1] {P=pointsur(dAB,-0.29);};
    \draw (9.9,2) node[right, color=A1] {dAB=droite(A,B);};
  \end{small}
 \end{tikzpicture}
\end{center}

Dans la fenêtre \texttt{script}, le point $P$ est défini par \texttt{P=pointsur(dAB,-0.29)}.\\ $-0,29$ indique que $\vv{AP}=-0,29\vv{AB}$.

L'utilisateur substitue une nouvelle valeur, que l'on notera $k$,  au $-0.29$ dans la fenêtre script et met la figure à jour.  
Proposer un algorithme qui calcule les nouvelles coordonnées du point $P$, en vue de l'affichage du point, à partir de $k$. 


\end{TP}
