\section{La puissance de \TikZ}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Varia
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Varia}




%=============================
% Accolades
%=============================
\begin{frame}[t]
\frametitle{Accolades}

\scalebox{0.5}{
\begin{tikzpicture}


\node[draw, minimum size = 20pt, inner sep = 1pt] (n1) at (0, 2) {n1};
\node[draw, minimum size = 20pt, inner sep = 1pt] (n2) at (2, 2) {n2};
\node[draw, minimum size = 20pt, inner sep = 1pt] (n3) at (0, 0) {n3};
\node[draw, minimum size = 20pt, inner sep = 1pt] (n4) at (2, 0) {n4};

\uncover<2->{\draw[decorate, decoration={brace,amplitude=10pt, raise=2pt}] (n1.north west) -- (n2.north east) node [midway, above=13pt] {noeuds du haut};}
\uncover<3->{\draw[decorate, decoration={brace,amplitude=10pt, mirror, raise=2pt}] (n3.south west) -- (n4.south east) node [midway, below=13pt] {noeuds du bas};}

\uncover<4->{\draw[decorate, decoration={brace,amplitude=10pt, raise=2pt}] (n3.south west) -- (n1.north west) node [midway, left=10pt] {noeuds de gauche};}

\uncover<4->{\draw[decorate, decoration={brace,amplitude=10pt,mirror, raise=2pt}] (n4.south east) -- (n2.north east) node [midway, right= 10pt] {noeuds de droite};}

\end{tikzpicture}
}


\scriptsize{
\ttfamily
	\only<2->{ { \color{gray} \textbackslash usetikzlibrary\{decorations.pathreplacing\}}}
	
	\only<2>{ {\color{red} \textbackslash draw[decorate, decoration=\{brace,amplitude=10pt, raise=2pt\}] (n1.north west) -- (n2.north east)}
	
	node [midway, below=13pt] \{noeuds du haut\};}
	
	\only<3>{\textbackslash draw[decorate, decoration=\{brace,amplitude=10pt, raise=2pt, {\color{red}mirror} \}] (n3.south west) -- (n4.south east) 
	
	node [midway, below=13pt] \{noeuds du bas\};}
	
	
	
	\only<4>{
	\textbackslash draw[decorate, decoration=\{brace,amplitude=10pt, raise=2pt\}] (n3.south west) -- (n1.north west) 
	
	node [midway, left=10pt] \{noeuds de gauche\};
	
	\vspace{10pt}
	
	\textbackslash draw[decorate, decoration=\{brace,amplitude=10pt,mirror, raise=2pt\}] (n4.south east) -- (n2.north east)
	
	 node [midway, right= 10pt] \{noeuds de droite\};
	}
}

\end{frame}


%=============================
% Ajouter une image
%=============================
\begin{frame}[t,fragile]
\frametitle{\bfseries Intégrer une figure {\color{black}jpg/png}}

%\footnotesize
\uncover<2>{
``Remplir" le noeud par une image:\\
\footnotesize \texttt{
\textbackslash node[inner sep=0pt] (legault) at (0,0)
	       \{{\color{red} \textbackslash includegraphics[width=2cm]\{legault.jpg\}}\};
}
}
\color{black}

%\vspace{-0.5cm}
\begin{figure}
\begin{tikzpicture}
\draw[fill=blue!60!green!20,rounded corners=10pt] (-2,-2) rectangle (8,2);
\node[fill=white,draw,minimum width=0.3\textwidth] (legault0) at (0,0)  {\Large Alice};
\node[fill=white,draw,minimum width=0.3\textwidth] (trudeau0) at (6,0)    {\Large Bob};
\draw[<->, very thick,red] (legault0.east) to [bend left] (trudeau0.west);
\only<1>{
\node[fill=white,draw,minimum width=1cm] (minion0) at (3,1)
	    {\Large Eve};
}
\node[above] at (3,-2){\Large \textbf{Cryptographie 101}};

\uncover<2>{\node[inner sep=0pt] (legault) at (0,0)
	    {\includegraphics[width=0.3\textwidth]{legault.jpg}};
\node[inner sep=0pt] (trudeau) at (6,0)
	    	    {\includegraphics[width=0.3\textwidth]{trudeau.jpg}};
\draw[<->, very thick,red] (legault.east) to [bend left] (trudeau.west);
\node[inner sep=0pt] (minion) at (3,1)
	    {\includegraphics[width=0.1\textwidth]{minion.png}};}
%\draw[<-, very thick] (legault.east) to [bend right] (trudeau.west);
\end{tikzpicture}
\end{figure}


\end{frame}

%=============================
%arcs en courbe
%=============================
\begin{frame}[t]
\frametitle{Arc de forme arbitraire}

\begin{tikzpicture}

\node[draw, circle, inner sep =0.1, label={[gray, left](-3, 1.5)}] (n1) at (-3,1.5) {n1};
\node[draw, circle, inner sep = 0.1, , label={[gray, left](3, 1.5)}] (n2) at (3,1.5) {n2};

\uncover<1>{\draw[->, -triangle 60]  plot[smooth, tension=0.7] coordinates {(n1.45) (-2,2.5) (-1,0.5) (2.5,-0.5) (5,2) (3,3) (n2.95)};}
\only<2->{\draw[->, -triangle 60, gray]  plot[smooth, tension=0.7] coordinates {(n1.45) (-2,2.5) (-1,0.5) (2.5,-0.5) (5,2) (3,3) (n2.95)};}

\uncover<2>{\draw[->, -triangle 60]  plot[smooth, tension=0.2] coordinates {(n1.45) (-2,2.5) (-1,0.5) (2.5,-0.5) (5,2) (3,3) (n2.95)};}
\uncover<3->{\draw[->, -triangle 60, gray]  plot[smooth, tension=0.2] coordinates {(n1.45) (-2,2.5) (-1,0.5) (2.5,-0.5) (5,2) (3,3) (n2.95)};}

\uncover<3>{\draw[->, -triangle 60]  plot[smooth, tension=2] coordinates {(n1.45) (-2,2.5) (-1,0.5) (2.5,-0.5) (5,2) (3,3) (n2.95)};}


\node[gray] (p1) at (-2, 2.7)  {(-2, 2.5)};
\node[gray] (p2) at (-0.5,0.7)  {(-1,0.5)};
\node[gray] (p3) at (2.7,-0.7)  {(2.5,-0.5)};
\node[gray] (p4) at (5.5,2)  {(5,2)};
\node[gray] (p5) at (3,3.2)  {(3,3)};
\end{tikzpicture}

\scriptsize{
\ttfamily
\only<1>{\textbackslash draw[->, -triangle 60]  
plot[smooth, tension=0.7] coordinates \{(n1.45) (-2,2.5) (-1,0.5) (2.5,-0.5) (5,2) (3,3) (n2.95)\};}

\only<2>{\textbackslash draw[->, -triangle 60]  plot[smooth, {\color{red} tension=0.2}] coordinates \{(n1.45) (-2,2.5) (-1,0.5) (2.5,-0.5) (5,2) (3,3) (n2.95)\};}

\only<3>{\textbackslash draw[->, -triangle 60]  plot[smooth, {\color{red} tension=2}] coordinates \{(n1.45) (-2,2.5) (-1,0.5) (2.5,-0.5) (5,2) (3,3) (n2.95)\};}
}

\end{frame}


%==============================================
% Construire un arbre
%==============================================
\begin{frame}<handout:1-2>[t,fragile]
\frametitle{\bfseries Construire un arbre}
\begin{figure}
\begin{tikzpicture}[scale=0.7]
\tikzstyle{level 1}=[level distance=1.5cm,sibling distance=6cm]
\tikzstyle{level 2}=[level distance=1.5cm,sibling distance=2cm]
\tikzset{noeud/.style={circle,draw,thick,fill=#1!25,inner sep=2pt},
noeud/.default={orange}}
\node [noeud=green] {Racine}
child { node [noeud=blue]{$ N_1 $}
child { node [noeud]{$ F_1 $} edge from parent node[above left] {$y$}}
child { node [noeud]{$ F_2 $} }
}
child { node [noeud=blue]{$ N_2 $} 
child { node [noeud]{$ F_3 $} }
child { node [noeud]{$ F_4$} }
child { node[noeud]{$ F_5$} }
};
\end{tikzpicture}
\end{figure}

\scriptsize{
\ttfamily



\only<1,2|handout:1>{\textcolor{green!50!black}{\textbf{\textbackslash node[noeud=green] \{Racine\}}}\\
\textcolor{blue}{\hspace{1cm}\textbf{child }\{ node[noeud=blue]\{N1\}}\\
\hspace{2cm}child \{ node[noeud]\{F1\} \only<2>{\textbf{edge from parent node[above left] \{y\}}}\}\\
\hspace{2cm}child \{ node[noeud]\{F2\} \}\\
\hspace{1cm}\}\\
\textcolor{blue}{\hspace{1cm}\textbf{child} \{ node[noeud=blue]\{N2\}} \\
\hspace{2cm}child \{ node[noeud]\{F3\} \}\\
\hspace{2cm}child \{ node[noeud]\{F4\} \}\\
\hspace{2cm}child \{ node[noeud]\{F5\} \}\\
\hspace{1cm}\};}

\only<3|handout:2>{ {\normalfont Gestion des niveaux:\\}
\textbackslash tikzstyle\{\textcolor{blue!50!black}{\textbf{level 1}}\}=[\textbf{level distance}=1.5cm,\textbf{sibling distance}=6cm]\\
\textbackslash tikzstyle\{\textcolor{orange!50!black}{\textbf{level 2}}\}=[level distance=1.5cm,sibling distance=2cm]\\
\vspace{\baselineskip}

}

}
\end{frame}



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% pgfplots
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Tracer des courbes et surfaces avec pgfplots}

%===============================================
% Description pgfplots
%===============================================
\begin{frame}{pgfplots}
    \framesoustitre{Description}
    \begin{itemize}
        \item Package permettant de tracer des courbes.
        \item Axes automatiques.
        \item 2D/3D.
    \end{itemize}
    
    
    \framesoustitre{Usage}
    
    \scriptsize{
    \ttfamily
    \textbackslash usepackage\{pgfplots\} 
    
    \textbackslash pgfplotsset\{compat=newest\}
    
    \textbackslash usepackage\{tikz-3dplot\} % pour 3D
    }
    
    \vspace{5pt}
    
    \framesoustitre{Attention!}
    
    Il peut y avoir des conflits avec le package babel!
    
\end{frame}

%===============================================
% Tracer une fonction (sans PGF)
%===============================================
\begin{frame}<handout:1-2>[t,fragile]
\frametitle{\bfseries Tracer une fonction (méthode rapide)}
%\begin{columns}
%\begin{column}{0.45\textwidth}
%\begin{tikzpicture}[scale =0.7]
%\draw [<->] (0,5) -- (0,0) -- (3,0);
%\draw[red, thick, domain=0:3] plot (\x, {0.5*\x*\x});
%\end{tikzpicture}
%\end{column}
%\begin{column}{0.45\textwidth}
%\ttfamily
%\textbackslash draw [<->] (0,5) -- (0,0) -- (3,0);
%\textbackslash draw[red, thick, domain=0:3] plot (\textbackslash x, {0.5*\textbackslash x*\textbackslash x});
%\end{column}
%\end{columns}
\begin{figure}
\begin{tikzpicture}[scale =1]
\draw [<->] (0,3) -- (0,0) -- (5,0);
\draw[red, thick, domain=0:5] plot[samples=200] (\x, {sqrt(\x)});
\uncover<2->{
\node[below] at (5,0) {x};
\node[left] at (0,3) {y};
\foreach \x in {0,1,...,4} \draw(\x,2pt)--++(0,-4pt) node[below]{\small\x};
}
\uncover<3->{\node[red,above] at (4.5,2.2) {$ \sqrt{x} $};
\coordinate (A) at (0.64,0.8);
\draw[->,thick,gray] (A) --++(1,0.625) node[above,gray,midway,sloped] {\small $ f'(x) $};
\filldraw[fill=gray!30,draw=gray!80] (3,0)--(3,1.73) --plot[domain=3:4] (\x, {sqrt(\x)}) --(4,0)--cycle;
\node at (3.5,1) {\tiny $ \int_{3}^{4}\sqrt{x}dx $};
}

\end{tikzpicture}
\end{figure}

\scriptsize{
\ttfamily
\textbackslash draw [<->] (0,3) -- (0,0) -- (5,0);\\
\textbackslash draw[red, thick, domain=0:5]\textbf{ plot[samples=200] (\textbackslash x, \{sqrt(\textbackslash x)\})};\\
\vspace{1\baselineskip}

\only<1|handout:1>{\normalfont 
\begin{itemize}
\item samples= nb de points utilisés dans le tracé (défaut=25)
\item Fonctions définis: sqrt, cos, sin, tan, exp, ln, floor ...
\item Fonction paramétriques, polaires 
\end{itemize}}

\only<2|handout:2>{

\textbackslash node[below] at (5,0) \{x\};\\
\textbackslash node[left] at (0,3) \{y\};\\
\textbackslash foreach \textbackslash x in \{0,1,...,4\} \textbackslash draw(\textbackslash x,2pt)---++(0,-4pt) node[below]\{\textbackslash small\textbackslash x\};\\
}
\only<3|handout:2>{

\textbf{\textbackslash filldraw}[fill=gray!30,draw=gray!80] (3,0) -- (3,1.73) \textbf{ -- plot[domain=3:4] (\textbackslash x, \{sqrt(\textbackslash x)\}) -- } (4,0)--cycle;

}

}
\end{frame}


%===============================================
% Fonctions plus complexes avec pgfplots
%===============================================
\begin{frame}<handout:1-2>{Avec pgfplots}

%\begin{tikzpicture}[declare function = {racine(\x) = sqrt(\x);}]
\begin{tikzpicture}[]

\begin{axis}[
%axis y line = center,
%axis x line = center,
x=1.5cm, y=0.75cm,
ytick distance = 1,
xtick distance  = 1,
xlabel = $x$, 
ylabel = $y$,
samples     = 160,
domain      = 0:5,
xmin = 0, xmax = 5,
ymin = 0, ymax = 4,
]

\only<3-|handout:2>{
\filldraw[fill=gray!30,draw=gray!80] (3,0)--(3,1.73) --plot[domain=3:4] (\x, {sqrt(3*\x)}) --(4,0)--cycle;
}
\only<2-|handout:2>{
\addplot[red, thick, mark=none, ] {sqrt(3*x)};
}
%\draw[thick, samples=200] plot (\x, racine(\x));
\end{axis}

\end{tikzpicture}
    
\only<1|handout:1>{    
\scriptsize{
\ttfamily

\textbackslash begin\{axis\}[

\quad x=1.5cm, y=0.75cm,                         

\quad xtick distance  = 0.5, ytick distance = 1, 

\quad xlabel = $x$, ylabel = $y$,                

\quad xmin = 0, xmax = 5, ymin = 0, ymax = 4,   

\quad samples     = 160, domain      = 0:5,

]

\qquad Courbes à afficher...

\textbackslash end\{axis\}

}
}

\only<2-|handout:2>{
\scriptsize{
\ttfamily

\only<3-|handout:2>{
\textbackslash filldraw[fill=gray!30,draw=gray!80] (3,0)--(3,1.73) --plot[domain=3:4] (\textbackslash x, \{sqrt(3*\textbackslash x)\}) --(4,0)--cycle;
}

\textbackslash addplot[red, thick, mark=none, ] \{sqrt(3*x)\};

%\draw[thick, samples=200] plot (\x, racine(\x));
}
}    
\end{frame}

%===============================================
% Exemple fillbetween
%===============================================
\begin{frame}{Aire entre deux courbes}
\begin{center}
    \begin{tikzpicture}[scale=0.9]
    \begin{axis}[axis lines=middle,
    ymin=-1.5,
    xlabel=$x$,
    ylabel=$y$,
    enlargelimits,
    ytick=\empty,
    xtick={-2.19,2.19},
    xticklabels={-2.19,2.19}]
    
    \addplot[name path=F,domain={-4:4}] {-(1/6)*x^2+2} node[pos=1, below]{$g_2(x)$};
    
    \addplot[name path=G,domain={-4:4}] {0.25*x^2}node[pos=1, above]{$g_1(x)$};
    
    \addplot[blue!30, opacity=0.5]fill between[of=F and G, soft clip={domain=-2.19:2.19}];
    
    
    \end{axis}
    \end{tikzpicture}
\end{center}
    
    
    \scriptsize{
    \ttfamily
    
    
    \textbackslash addplot[{\color{red}name path=F},domain=\{-4:4\}] \{-(1/6)*x\textasciicircum 2+2\} node[pos=1, below]\{$g_2(x)$\};
    
    \textbackslash addplot[{\color{red}name path=G},domain=\{-4:4\}] \{0.25*x\textasciicircum 2\}node[pos=1, above]\{$g_1(x)$\};
    
    \textbackslash addplot[blue!30, opacity=0.5]{\color{red}fill between[of=F and G, soft clip=\{domain=-2.19:2.19\}]};
    
    }
    
\end{frame}

%================================================
% Coordonnées polaires, Équations paramétriques
%================================================
\begin{frame}{Coordonnées polaires, équations paramétriques}

\begin{center}
\scalebox{0.8}{
\begin{tikzpicture}[>=latex]
    
    
%\fill[fill=lightgray] plot[domain=-pi/2:pi/2] (xy polar cs:angle=\x r,radius= {2-2*sin(\x r)});
%\draw[thick,color=red,domain=0:2*pi,samples=200,smooth] plot (xy polar cs:angle=\x r,radius= {2-2*sin(\x r)});

\begin{axis}[axis lines=middle, xmin = -4, ymin = -4.5, xmax = 4, ymax = 2, x=1cm, y=1cm]
\node[red] at (-3,-3.3) {\scriptsize $r=2-2\sin\theta$};
\node[blue] at (1.5,1.5) {\scriptsize \begin{tabular}{c}
     x(t) = sin(t) \\
     y(t) = cos(t) 
\end{tabular}};
%\addplot[data cs=polarrad, thick,color=red,domain=0:2*pi,samples=200,smooth] (x, {2-2*sin(x)});
\addplot[domain=0:360,samples=300,color=red,data cs=polar] (x,{2 - 2*sin(x)});
\addplot[domain=0:360,samples=300,color=blue] ({sin(x)},{cos(x});

%\draw[->] (-4,0) -- (4,0);
%\draw[->] (0,-5) -- (0,2);

\end{axis}
\end{tikzpicture} 
}
\end{center}

 \scriptsize{
    \ttfamily
    \textbackslash addplot[{\color{red}domain=0:360, data cs=polar}, ...] (x,\{2 - 2*sin(x)\});
    
    \textbackslash addplot[{\color{red}domain=0:360}, ...] (\{sin(x)\},\{cos(x)\};
}
    
\end{frame}


%==============================================
% 3D
%==============================================
\begin{frame}{Surfaces 3D}

\scalebox{0.7}{
\begin{tikzpicture}[declare function = {paraboloide(\x,\y) = (\x)^2 + (\y)^2;},
%\begin{tikzpicture}[declare function = {paraboloide(\x,\y) = sin(deg(\x))+sin(deg(\y));},
cube/.style={black},]
\begin{axis}[]
 
\addplot3 [
    domain=-5:2,
    domain y = -1:3,
    samples = 20,
    samples y = 8, surf] {x^2 + y^2};
\end{axis}

\end{tikzpicture}
}


 \scriptsize{
    \ttfamily
    \textbackslash addplot3 [domain=-5:2, domain y = -1:3,   samples = 20, samples y = 8, surf] \{x\textasciicircum 2 + y\textasciicircum 2\};
}
\end{frame}

%====================================
% mon show off
%====================================
\begin{frame}<handout:1-5>{Avec de la pratique...}

\begin{center}
    
\only<1|handout:1>{
    \begin{tikzpicture}[declare function = {paraboloide(\x,\y) = -\x^2/10 - (\y-4)^2/10+4;}]

        %definit la taille des pas en x et y
        \def\m{15}
        \def\n{15};
        
        %domaine des courbes
        %
        \def\xmin{-4}
        \def\xmax{4}
        \def\ymin{-2}
        \def\ymax{4}
        
        \begin{axis}[
        unit vector ratio=1 1.5 1,
        axis lines = left,
        xmin=-4,
        xmax=5,
        ymin=-3,
        ymax=5,
        zmin=0,
        zmax=10,
        xticklabels={,,},
        yticklabels={,,},
        zticklabels={,,},
        width=12cm,
        height = 12cm,
        xlabel={x},
        ylabel={y},
        zlabel={z},
        ]
        
        \pgfplotsset{ticks=none}
        
        %projection de la surface dans le plan xy
        \fill[yellow!30!white]   plot[smooth cycle, tension=.7] coordinates {(axis cs:-3.5,1) (axis cs:-0.5,3.5) (axis cs:2,2.5) (axis cs:3,0.5) (axis cs:1,-0.5) (axis cs:-1,0) (axis cs:-2.5,0) (axis cs:-3.5,0)};
        
        %clip la surface selon la courbe desiree
        \clip[draw]  plot[smooth cycle, tension=.7] coordinates {(axis cs:-3.5,1, {paraboloide(-3.5,1)}) (axis cs:-0.5,3.5, {paraboloide(-0.5,3.5)}) (axis cs:2,2.5,  {paraboloide(2, 2.5)}) (axis cs:3,0.5,  {paraboloide(3,0.5)}) (axis cs:1,-0.5,  {paraboloide(1, -0.5)}) (axis cs:-1,0,  {paraboloide(-1, 0)}) (axis cs:-2.5,0,  {paraboloide(-2.5,0)}) (axis cs:-3.5,0,  {paraboloide(-3.5,0)})};
        
        %surface
        \addplot3 [surf, domain=\xmin:\xmax, y domain=\ymin:\ymax,
        shader=flat,
        z buffer=sort,
        fill=blue,
        draw=black,
        opacity = 0.2,
        fill opacity = 0.4,
        ] { paraboloide(x,y) };
        
        \end{axis}
\end{tikzpicture}
}

\only<2|handout:2>{
\begin{tikzpicture}

%seed de generateur aleatoire (pour les points)
\pgfmathsetseed{42}




%bornes sur theta
\def\tmin{pi/8}
\def\tmax{pi/2.5}

%borrnes sur r
\def\rmin{1.5}
\def\rmax{3}

%taille de pas en theta et r
\def\m{6}
\def\n{4};
\def\stept{(\tmax-\tmin)/\m};
\def\stepr{(\rmax-\rmin)/\n};

\def\xmin{1}
\def\ymin{1}

\begin{axis}[
unit vector ratio = 1 1,
axis y line = center,
axis x line = center,
ytick = \empty,
xtick       = \empty,
xlabel = $x$, 
ylabel = {$y$},
samples     = 160,
xmin = -1, xmax = 3,
ymin = -1, ymax = 3,
]

\draw[thick,samples=200,smooth] plot[domain=\tmin:\tmax] (xy polar cs:angle=\x r,radius= {\rmin}) -- plot[domain=\tmax:\tmin] (xy polar cs:angle=\x r,radius= {\rmax}) -- cycle;


%tous les secteurs
\pgfmathsetmacro{\rtempa}{\rmin+1*\stepr};
\draw[samples=200,smooth] plot[thick, domain=\tmin:\tmax] (xy polar cs:angle=\x r,radius= {\rtempa});

\pgfmathsetmacro{\rtempb}{\rmin+2*\stepr};
\draw[samples=200,smooth] plot[thick, domain=\tmin:\tmax] (xy polar cs:angle=\x r,radius= {\rtempb});

\pgfmathsetmacro{\rtempc}{\rmin+3*\stepr};
\draw[samples=200,smooth] plot[thick, domain=\tmin:\tmax] (xy polar cs:angle=\x r,radius= {\rtempc});


%rayons

\pgfmathsetmacro{\ttempa}{\tmin+1*\stept};
\draw[samples=200,smooth] (xy polar cs:angle=\ttempa r,radius= {\rmin}) -- (xy polar cs:angle=\ttempa r,radius= {\rmax});

\pgfmathsetmacro{\ttempb}{\tmin+2*\stept};
\draw[samples=200,smooth] (xy polar cs:angle=\ttempb r,radius= {\rmin}) -- (xy polar cs:angle=\ttempb r,radius= {\rmax});

\pgfmathsetmacro{\ttempc}{\tmin+3*\stept};
\draw[samples=200,smooth] (xy polar cs:angle=\ttempc r,radius= {\rmin}) -- (xy polar cs:angle=\ttempc r,radius= {\rmax});

\pgfmathsetmacro{\ttempd}{\tmin+4*\stept};
\draw[samples=200,smooth] (xy polar cs:angle=\ttempd r,radius= {\rmin}) -- (xy polar cs:angle=\ttempd r,radius= {\rmax});

\pgfmathsetmacro{\ttempe}{\tmin+5*\stept};
\draw[samples=200,smooth] (xy polar cs:angle=\ttempe r,radius= {\rmin}) -- (xy polar cs:angle=\ttempe r,radius= {\rmax});




\fill[fill=red!20,samples=200,smooth] plot[domain=\ttempb:\ttempc] (xy polar cs:angle=\x r,radius= {\rtempb}) -- plot[domain=\ttempc:\ttempb] (xy polar cs:angle=\x r,radius= {\rtempc}) -- cycle;

\draw (xy polar cs:angle={(\ttempb+\ttempc)/2 r}, radius={(\rtempb+\rtempc)/2}) -- (axis cs: 2.5,2.5) node{$R_{ij}$};


\foreach \i in {1,...,\m}
{
	\foreach \j in {\n,...,1}
	{
		\pgfmathsetmacro{\ta}{\stept*(\i-1) + \tmin};
		\pgfmathsetmacro{\tb}{\stept*\i + \tmin};
		
		\pgfmathsetmacro{\ra}{\stepr*(\j-1)+ \rmin};
		\pgfmathsetmacro{\rb}{\stepr*\j+ \rmin};
		
		%on prend un point d'evaluation aleatoire, mais pas trop pres du bord (raison pour laquelle on a rand/3 et non rand/2)
		\pgfmathsetmacro{\teval}{(\ta+\tb)/2+rand/4*\stept};
		\pgfmathsetmacro{\reval}{(\ra+\rb)/2+rand/4*\stepr};
		
		\begingroup\edef\temp{\endgroup\noexpand  \fill[blue] (xy polar cs:angle={\teval r},radius={\reval}) circle (1pt);}\temp
	}
}
	
\end{axis}
\end{tikzpicture}
}

\only<3|handout:3>{
\begin{tikzpicture}[declare function = {paraboloide(\x,\y) = -\x^2/10 - (\y-4)^2/10+4;},
cube/.style={black},]

    \def\m{5}
    \def\n{6};
    
    
    \def\xmin{1}
    \def\xmax{4}
    \def\ymin{2}
    \def\ymax{6}
    
    \def\stepx{(\xmax - \xmin)/\m};
    \def\stepy{(\ymax - \ymin)/\n};
    
    
    %	\pgfdeclarelayer{pre main}
    % \pgfsetlayers{pre main,main}
    
    \begin{axis}[
    %view={0}{0},
    unit vector ratio=1 1.5 1,
    %hide z axis, 
    axis lines*       = left,
    xmin=0,
    xmax=6,
    ymin=0,
    ymax=6,
    zmin=0,
    zmax=4,
    % z=0.5cm,x=1cm, y=1cm,
    width=12cm,
    height = 12cm,
    xlabel={x},
    ylabel={y},
    zlabel={z},
    %enlargelimits=0.3,
    %scale uniformly strategy=units only,
    %domain = \xa:\xb,
    ]
    
    
    
    \pgfmathsetseed{42}		
    
    
    \fill[blue, opacity=0.2, draw] (axis cs: \xmin, \ymin, 0) -- (axis cs: \xmin, \ymax, 0) -- (axis cs: \xmax, \ymax, 0) -- (axis cs: \xmax, \ymin, 0) -- cycle;
    
    %derriere
    \fill[blue, opacity=0.2, draw] (axis cs: \xmax, \ymax, 0) -- (axis cs: \xmin,\ymax, 0) -- plot[domain=\xmin:\xmax] (axis cs: \x, \ymax, {paraboloide(\x, \ymax)})-- (axis cs: \xmax,\ymax, {paraboloide(\xmax, \ymax)}) -- cycle;
    
    %gauche
    \fill[blue, opacity=0.2, draw] (axis cs: \xmin, \ymax, 0) -- (axis cs: \xmin,\ymin, 0) -- plot[domain=\ymin:\ymax] (axis cs: \xmin, \x, {paraboloide(\xmin, \x)})-- (axis cs: \xmin,\ymax, {paraboloide(\xmin, \ymax)}) -- cycle;
    
    %devant
    \fill[blue, opacity=0.2, draw] (axis cs: \xmax, \ymin, 0) -- (axis cs: \xmin,\ymin, 0) -- plot[domain=\xmin:\xmax] (axis cs: \x, \ymin, {paraboloide(\x, \ymin)})-- (axis cs: \xmax,\ymin, {paraboloide(\xmax, \ymin)}) -- cycle;
    
    %droite
    \fill[blue, opacity=0.2, draw] (axis cs: \xmax, \ymax, 0) -- (axis cs: \xmax,\ymin, 0) -- plot[domain=\ymin:\ymax] (axis cs: \xmax, \x, {paraboloide(\xmax, \x)})-- (axis cs: \xmax,\ymax, {paraboloide(\xmax, \ymax)}) -- cycle;



    \def\i{3}
    %tranche
	\pgfmathsetmacro{\xa}{\stepx*(\i-1)+\xmin};
	\pgfmathsetmacro{\xb}{\stepx*\i+ \xmin};
	\pgfmathsetmacro{\xeval}{(\xb+\xa)/2};
	

	%droite
	\fill[red, opacity=0.2, draw = black, thin] (axis cs: \xb,\ymax, 0) -- (axis cs: \xb,\ymin, 0) -- plot[domain=\ymin:\ymax] (axis cs: \xb, \x, {paraboloide(\xeval, \x)}) -- (axis cs: \xb,\ymax, {paraboloide(\xeval, \ymax)}) -- cycle;
	
	%arriere
	\fill[red, opacity=0.2, draw = black, thin] (axis cs: \xb,\ymax, 0) -- (axis cs: \xa,\ymax, 0) -- (axis cs: \xa,\ymax, {paraboloide(\xeval, \ymax)}) -- (axis cs: \xb,\ymax, {paraboloide(\xeval, \ymax)}) -- cycle;
	
	%avant
	\fill[red, opacity=0.2, draw = black, thin] (axis cs: \xb,\ymin, 0) -- (axis cs: \xa,\ymin, 0) -- (axis cs: \xa,\ymin, {paraboloide(\xeval, \ymin)}) -- (axis cs: \xb,\ymin, {paraboloide(\xeval, \ymin)}) -- cycle;
	
	%gauche
	\fill[red, opacity=0.2, draw = black, thin] (axis cs: \xa,\ymax, 0) -- (axis cs: \xa,\ymin, 0) -- plot[domain=\ymin:\ymax] (axis cs: \xa, \x, {paraboloide(\xeval, \x)}) -- (axis cs: \xa,\ymax, {paraboloide(\xeval, \ymax)}) -- cycle;	
	%dessus
	
	\addplot3 [surf, domain=\xa:\xb, y domain=\ymin:\ymax,
	shader=flat,
	z buffer=sort,
	fill=red,
	draw=black, thin,
	opacity = 0.2,
	fill opacity = 0.2,
	] {paraboloide(\xeval,y)};
	
	%dessous
	\fill[red, opacity=0.2, draw = black, thin] (axis cs: \xa,\ymax, 0) -- (axis cs: \xb,\ymax, 0) -- (axis cs: \xb,\ymin, 0) -- (axis cs: \xa,\ymin, 0) --cycle;



    \addplot3 [surf, domain=\xmin:\xmax, y domain=\ymin:\ymax, shader=flat,
                z buffer=sort,
                fill=blue,
                draw=black,
                opacity = 0.2,
                fill opacity = 0.4,
            ] {paraboloide(x,y)};

\end{axis}
\end{tikzpicture}
}

\only<4|handout:4>{
\begin{tikzpicture}[]

\def\a{8}%grand rayon
\def\b{2}%petit rayon


\def\xmin{-\a-\b-1}
\def\xmax{\a+\b+1}
\def\ymin{-\a-\b-1}
\def\ymax{\a+\b+1}
\def\zmin{-\b-0.5}
\def\zmax{\b+0.5}

\begin{axis}[
view={110}{25},
unit vector ratio=1 1 1,
%hide z axis, 
axis lines*       = center,
xmin=\xmin,
xmax=\xmax,
ymin=\ymin,
ymax=\ymax,
zmin=\zmin,
zmax=\zmax,
xticklabels={,,},
yticklabels={,,},
zticklabels={,,},
width=12cm,
height = 12cm,
xlabel=\empty,
ylabel=\empty,
zlabel=\empty,
]

\pgfplotsset{ticks=none}

\pgfmathsetseed{42}		


%tore
\addplot3 [surf, domain=\xmin:\xmax, y domain=\ymin:\ymax,
colormap/cool,
shader=flat,
z buffer=sort,
domain=0:2*pi,
y domain=0:2*pi,
opacity = 0.2,
fill opacity = 0.4,
] ( { (\a+\b*cos(deg(x)))*cos(deg(y)) }, 
	{ (\a+\b*cos(deg(x)))*sin(deg(y)) }, 
	{ \b*sin(deg(x))} );

%cercle en theta=0
\draw[thick, samples=50] plot[domain={0}:{2*pi}, variable = \t] ({\b*cos(deg(\t))+\a}, {0}, {\b*sin(deg(\t))});

%cercle en theta=pi/4
\draw[thick, samples=50] plot[domain={0}:{2*pi}, variable = \t] ({(\b*cos(deg(\t))+\a)*sqrt(2)/2}, {(\a+\b*cos(deg(\t)))*sin(deg(pi/4))}, {\b*sin(deg(\t))});

%cercle du centre
\draw[thin, samples=50, dashed] plot[domain={0}:{2*pi}, variable = \t] ({\a*cos(deg(\t))}, {\a*sin(deg(\t))}, {0});

%angle theta
%
%droite
\draw (0,0,0) -- ({(\a+\b)/sqrt(2)}, {(\a+\b)/sqrt(2)}, 0);
%arc de cercle
\draw plot[domain={0}:{pi/4}, variable = \t] ({\a/4*cos(deg(\t))}, {\a/4*sin(deg(\t))}, 0);
%label theta
\node at ({(\a+3)/4*cos(deg(pi/8))}, {(\a+3)/4*sin(deg(pi/8))}, 0) {\footnotesize{$\theta$}};

%angle alpha
%
%droite
\draw ({\a/sqrt(2)}, {\a/sqrt(2)}, 0) -- ({\a/sqrt(2)+\b/2}, {\a/sqrt(2)+\b/2}, {\b/sqrt(2)}) ;
%label alpha
\node at ({(\a+1.3)*cos(deg(pi/4))}, {(\a+1.3)*sin(deg(pi/4))}, 0.5) {\footnotesize{$\alpha$}};

\end{axis}
\end{tikzpicture}
}

\only<5|handout:5>{
\begin{tikzpicture}[declare function = {paraboloide(\x,\y) = -0.1*(\x+2)^2- 0.15*(\y-1)^2+5;}]

\def\m{15}
\def\n{15};



\def\xmin{-2}
\def\xmax{4}
\def\ymin{-2}
\def\ymax{4}

\def\stepx{(\xmax - \xmin)/\m};
\def\stepy{(\ymax - \ymin)/\n};


\begin{axis}[
unit vector ratio=1 1.5 1,
%hide z axis, 
axis lines*       = center,
xmin=-4,
xmax=4,
ymin=-4,
ymax=6,
zmin=-2,
zmax=5.5,
xticklabels={,,},
yticklabels={,,},
zticklabels={,,},
width=12cm,
height = 12cm,
xlabel=\empty,
ylabel=\empty,
zlabel=\empty,
]

\pgfplotsset{ticks=none}

\pgfmathsetseed{42}		

\addplot3 [surf, domain=\xmin:\xmax, y domain=\ymin:\ymax,
colormap/cool,
shader=flat,
z buffer=sort,
domain=\xmin:\xmax,
y domain=\ymin:\ymax,
opacity = 0.2,
fill opacity = 0.4,
] { paraboloide(x,y) };

\draw[thick, red, samples=50] plot[domain={\xmin}:{\xmax}, variable = \x] (axis cs: {(\x)}, {sin(deg(\x))}, {paraboloide(\x, {sin(deg(\x))}});
\draw[thick, blue, samples=50] plot[domain={\ymin}:{\ymax}, variable = \x] (axis cs: {cos(deg(\x))}, {\x}, {paraboloide({cos(deg(\x))}, {\x})});


\def\ya{0.69482};
\def\xa{0.76817};
\def\za{paraboloide({\xa}, {\ya})};

\def\xb{\xa+1};
\def\yb{\ya+cos(deg(\xa))};
\def\zb{\za-(\xa+2)/5-3/10*(sin(deg(\xa))-1)*cos(\xa)};

\draw[red, ->] ({\xa}, {\ya}, {\za}) -- ({\xb}, {\yb}, {\zb}) node[right]{\footnotesize{$\vec{r}_u$}};


\def\yc{0.69482};
\def\xc{0.76817};
\def\zc{paraboloide({\xc}, {\yc})};

\def\xd{\xc-sin(deg(\yc))};
\def\yd{\yc+\yc};
\def\zd{\zc+(cos(deg(\yc))+2)^2/5-3/20(\yc-1)};

\draw[blue, ->] ({\xc}, {\yc}, {\zc}) -- ({\xd}, {\yd}, {\zd}) node[right]{\footnotesize{$\vec{r}_v$}};

\fill (axis cs: \xa,\ya,{\za}) circle (1pt);

\end{axis}
\end{tikzpicture}

}

\end{center}

\end{frame}

%==============================================
% Fonctions plus compliquées
%==============================================
\begin{frame}[t,fragile]
\frametitle{Ressources additionnelles}
\vspace{-1\baselineskip}
\begin{figure}
\begin{minipage}{0.45\linewidth}
\includegraphics[width=5cm]{Figures/pgfplotExemple2.png}
\end{minipage}
\begin{minipage}{0.45\linewidth}
\includegraphics[width=5cm]{Figures/pgfplotExemple.png}
\end{minipage}
\end{figure}
Exemples : {\footnotesize\url{http://pgfplots.net/}}\\
Tutoriel (fr) : {\footnotesize \url{ http://bertrandmasson.free.fr/index.php?article28/comment-faire-de-beaux-graphiques-avec-tikz-et-pgfplots}}
\end{frame}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Logiciels
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Logiciels}
%=============================
%TikzEdt 
%=============================
    \begin{frame}[plain]{TikzEdt}

            
        \begin{tikzpicture}[remember picture, overlay]
            \node[at=(current page.center)] {
                \includegraphics[width=\paperwidth]{Figures/tikzedt.png}
            };
        \end{tikzpicture}
     \end{frame}

%=============================
%TikzEdt pour/contre
%=============================
\begin{frame}[t,fragile]
\frametitle{\bfseries TikzEdt}

\begin{columns}[t]
\column{5cm}
\underline{\large \textbf{ Avantages }}

\uncover<2->{
\begin{itemize}
\item Éditeur WYSIWYG
\item Permet la modification du code
\item Simple d'utilisation
\end{itemize}
}
\column{5cm}
\underline{\large \textbf{ Inconvénients }}

\uncover<3->{
\begin{itemize}
\item Windows seulement
\item Ne supporte pas les animations Beamer
\item Incorporation de librairies difficiles
\end{itemize}
}
\end{columns}

\vspace{10pt}

\uncover<4->{

\underline{\large \textbf{Verdict : }}

Placer les éléments avec TikzEdt.

Styliser dans votre éditeur \LaTeX.
}

\end{frame}

%=============================
%GeoGebra
%=============================
\begin{frame}[plain]
		\frametitle{GeoGebra}
    \begin{tikzpicture}[remember picture,overlay]
        \node[at=(current page.center)] {
            \includegraphics[width=\paperwidth]{Figures/geogebra.png}
        };
    \end{tikzpicture}
 \end{frame}

%=============================
%GeoGebra pour/contre
%=============================
\begin{frame}[t,fragile]
\frametitle{\bfseries Geogebra}

\begin{columns}[t]
\column{5cm}
\underline{\large \textbf{ Avantages }}

\uncover<2->{
\begin{itemize}
\item Éditeur WYSIWYG
\item Maths
\item Figure géométrique
\item Facile de faire des figures complexes ou en 3d
\end{itemize}
}
\column{5cm}
\underline{\large \textbf{ Inconvénients }}

\uncover<3->{
\begin{itemize}
\item Donne un code difficile à modifier 
\item Contrôle de certains attributs long

\end{itemize}
}
\end{columns}



\end{frame}




%==============================================
% Outil de création d'arbres
%==============================================
\begin{frame}[t,fragile]
\frametitle{\bfseries Construire un arbre très rapidement}
Outil de création rapide d'un arbre en ligne: \url{http://math.et.info.free.fr/TikZ/Arbres.html}
%En 2 minute
%:-+-+-+- Engendré par : http://math.et.info.free.fr/TikZ/Arbre/
\begin{center}
% Racine en Haut, développement vers le bas
\begin{tikzpicture}[xscale=0.8,yscale=0.8,font=\tiny]
% Styles (MODIFIABLES)
\tikzstyle{fleche}=[->,>=latex,thick]
\tikzstyle{noeud}=[fill=yellow,circle,draw]
\tikzstyle{feuille}=[fill=yellow,circle,draw]
\tikzstyle{etiquette}=[midway,fill=white,draw]
% Dimensions (MODIFIABLES)
\def\DistanceInterNiveaux{3}
\def\DistanceInterFeuilles{2.5}
% Dimensions calculées (NON MODIFIABLES)
\def\NiveauA{(-0)*\DistanceInterNiveaux}
\def\NiveauB{(-1)*\DistanceInterNiveaux}
\def\NiveauC{(-2)*\DistanceInterNiveaux}
\def\InterFeuilles{(1)*\DistanceInterFeuilles}
% Noeuds (MODIFIABLES : Styles et Coefficients d'InterFeuilles)
\node[noeud] (R) at ({(2)*\InterFeuilles},{\NiveauA}) {Jeu};
\node[noeud] (Ra) at ({(0.5)*\InterFeuilles},{\NiveauB}) {cool};
\node[feuille] (Raa) at ({(0)*\InterFeuilles},{\NiveauC}) {génial};
\node[feuille] (Rab) at ({(1)*\InterFeuilles},{\NiveauC}) {bof};
\node[noeud] (Rb) at ({(2.5)*\InterFeuilles},{\NiveauB}) {super};
\node[feuille] (Rba) at ({(2)*\InterFeuilles},{\NiveauC}) {génial};
\node[feuille] (Rbb) at ({(3)*\InterFeuilles},{\NiveauC}) {nul};
\node[noeud] (Rc) at ({(4)*\InterFeuilles},{\NiveauB}) {pas mal};
\node[feuille] (Rca) at ({(4)*\InterFeuilles},{\NiveauC}) {pas mal};
% Arcs (MODIFIABLES : Styles)
\draw[fleche] (R)--(Ra) node[etiquette] {0.50};
\draw[fleche] (Ra)--(Raa) node[etiquette] {0.25};
\draw[fleche] (Ra)--(Rab) node[etiquette] {0.75};
\draw[fleche] (R)--(Rb) node[etiquette] {0.20};
\draw[fleche] (Rb)--(Rba) node[etiquette] {0.50};
\draw[fleche] (Rb)--(Rbb) node[etiquette] {0.50};
\draw[fleche] (R)--(Rc) node[etiquette] {0.30};
\draw[fleche] (Rc)--(Rca) node[etiquette] {1};
\end{tikzpicture}
\end{center}
%:-+-+-+-+- Fin



\end{frame}
