\documentclass{beamer}

\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage[francais]{babel}

\usepackage{tikz}

\mode<presentation>
{
  %\usetheme{Berkeley}
  %\usetheme{Warsaw}
  %\usetheme{Malmoe}
  \usetheme{CambridgeUS}
}

\title{Construction de sections planes}
\subtitle{Cours de 4ème Année \scriptsize{$5\,hrs/sem$}}
\author{Hugues Vermeiren}
\institute[UREM-ULB]{UREM de Bruxelles}


\begin{document}

\frame{\titlepage}

\frame{\tableofcontents}

\section{Sections de Cube}

\begin{frame}
	\begin{center}
	\begin{tikzpicture}[
				scale=2.0,
				%				
%				A standard viewpoint (default is x=(1,0) y=(0,1) z=(-sqrt(2)/2,-sqrt(2)/2))
%				x={(-0.5cm,-0.3cm)},
%				y={(1cm,0cm)},
%				z={(0cm,1cm)},
				%
%				Another viewpoint...
				x={(-.6cm,-0.3cm)},
				y={(0.6cm,-0.3cm)},
				z={(0.2cm,0.8cm)},				
				MyPoints/.style={x={(1cm,0cm)},y={(0cm,1cm)},draw=blue,fill=white,thick},
				DataPoints/.style={x={(1cm,0cm)},y={(0cm,1cm)},draw=red,fill=white,thick},
				NewPoints/.style={x={(1cm,0cm)},y={(0cm,1cm)},draw=green!50!black!50!,fill=white,thick},
				]
		\pgfmathparse{0.03} \let\ptsize\pgfmathresult
		%Cube vertices
		\coordinate (O) at (0,0,0);
		\coordinate (I) at (1,0,0);
		\coordinate (J) at (0,1,0);
		\coordinate (K) at (0,0,1);
		\coordinate (A) at (1,1,0);
		\coordinate (A2) at (1,1,-1);
		\coordinate (B) at (1,1,1);
		\coordinate (D) at (1,0,1);
		\coordinate (D2) at (1,-1,1);
		\coordinate (C) at (0,1,1);
		\coordinate (C2) at (0,3.5,1);
		%Axes		
		\coordinate (I2) at (1.75,0,0);
		\coordinate (J2) at (0,1.75,0);
		\coordinate (K2) at (0,0,1.75);
		%Intermediate points
		\coordinate (X1) at (.5,1,1);
		\coordinate (X2) at (.75,0,1);
		\coordinate (X3) at (1,1,-0.5);
		\coordinate (X4) at (1,{1/3},0);
		\coordinate (X5) at (1,0,0.25);
		%Section points
		\coordinate (R) at (0,3,1);
		\coordinate (S) at (1,-1,1);
		\coordinate (T) at ({5/6},1,0);
		
		
		\onslide<1-11>{
			%Draw cube
			\draw (I)--(A)--(B)--(D)--cycle;
			\draw (B)--(C)--(J)--(A);
			\draw (C)--(K)--(D);
			\draw[dashed] (O)--(I);
			\draw[dashed] (O)--(J);
			\draw[dashed] (O)--(K);
			%Draw axes
			\draw[->] (I)--(I2) node[below left]{$x$};
			\draw[->] (J)--(J2) node[right]{$y$};
			\draw[->] (K)--(K2) node[above left]{$z$};
			%Draw cube vertices
			\fill[MyPoints] (A) circle (\ptsize) node[below left]{$A$};
			\fill[MyPoints] (B) circle (\ptsize) node[above]{$B$};
			\fill[MyPoints] (C) circle (\ptsize) node[above right]{$C$};
			\fill[MyPoints] (D) circle (\ptsize) node[below left]{$D$};
			\fill[MyPoints] (O) circle (\ptsize) node[above left]{$O$};
			\fill[MyPoints] (I) circle (\ptsize) node[above left]{$I$};
			\fill[MyPoints] (J) circle (\ptsize) node[above right]{$J$};
			\fill[MyPoints] (K) circle (\ptsize) node[above left]{$K$};
%			%Draw the cube vertices if you don't care about label placement
%			\foreach \i in {O,I,J,K,A,B,C,D}
%				\fill[MyPoints] (\i) circle (\ptsize) node[right]{$\i$};
			}
			
		\onslide<2->{
			\fill[DataPoints] (R) circle (\ptsize) node[above right,red]{$R$};
			\fill[DataPoints] (S) circle (\ptsize) node[above right,red]{$S$};
			\fill[DataPoints] (T) circle (\ptsize) node[below right,red]{$T$};		
			\draw[dashed] (C)--(C2);
			\draw[dashed] (D)--(D2);
			}
			
		\onslide<3->{
			\draw[green] (-0.25,4,1)--(1.25,-2,1);%Two points far away on line SR
			\fill[DataPoints] (R) circle (\ptsize) node[above right,red]{$R$};
			\fill[DataPoints] (S) circle (\ptsize) node[above right,red]{$S$};			
			\fill[NewPoints] (X1) circle (\ptsize) node[above,green]{\scriptsize{$U$}};
			\fill[NewPoints] (X2) circle (\ptsize) node[above,green]{\scriptsize{$V$}};
			}
		
		\onslide<4->{
			\draw[green] ({1/3},1,1.5)--({13/12},1,-0.75);%Two points far away on line X1T
			\fill[NewPoints] (X1) circle (\ptsize);
			\fill[DataPoints] (T) circle (\ptsize) node[below right,red]{$T$};
		}
		
		\onslide<5->{
			\draw[dashed] (A)--(A2);
			\fill[NewPoints] (X3) circle (\ptsize) node[below right,green]{\scriptsize{$W$}};	
		}		
		
		\onslide<6->{
			\draw[green] (1,-1.5,{11/8})--(1,{5/4},{-11/16});%Two points far away on line SX3
			\fill[DataPoints] (S) circle (\ptsize) node[above right,red]{$S$};
			\fill[NewPoints] (X3) circle (\ptsize);
			\fill[NewPoints] (X4) circle (\ptsize)node[above right,green]{\scriptsize{$P$}};
			\fill[NewPoints] (X5) circle (\ptsize)node[above right,green]{\scriptsize{$Q$}};						
			}
		
		\onslide<7-11>{
			\draw[red,thick] (X2)--(X1);
			\fill[NewPoints] (X1) circle (\ptsize);
			\fill[NewPoints] (X2) circle (\ptsize);
		}
		\onslide<8-11>{
			\draw[red,thick] (X1)--(T);
			\fill[NewPoints] (X1) circle (\ptsize);
			\fill[DataPoints] (T) circle (\ptsize) node[below right,red]{$T$};
		}
		\onslide<9-11>{
			\draw[red,thick] (T)--(X4);
			\fill[DataPoints] (T) circle (\ptsize) node[below right,red]{$T$};
			\fill[NewPoints] (X4) circle (\ptsize);
		}
		\onslide<10-11>{
			\draw[red,thick] (X4)--(X5);
			\fill[NewPoints] (X4) circle (\ptsize);
			\fill[NewPoints] (X5) circle (\ptsize);
		}
		\onslide<11>{
			\draw[red,thick] (X5)--(X2);
			\fill[NewPoints] (X5) circle (\ptsize);
			\fill[NewPoints] (X2) circle (\ptsize);
		}
		
		\onslide<12->{
			%Draw the section of the cube
			\fill[thick,draw=blue,fill=blue!25!] (T)--(X1)--(X2)--(X5)--(X4)--cycle;
			
			%ReDraw cube
			\draw (I)--(A)--(B)--(D)--cycle;
			\draw (B)--(C)--(J)--(A);
			\draw (C)--(K)--(D);
			\draw[dashed] (O)--(I);
			\draw[dashed] (O)--(J);
			\draw[dashed] (O)--(K);
			%ReDraw cube vertices
			\fill[MyPoints] (A) circle (\ptsize) node[below left]{$A$};
			\fill[MyPoints] (B) circle (\ptsize) node[above]{$B$};
			\fill[MyPoints] (C) circle (\ptsize) node[above right]{$C$};
			\fill[MyPoints] (D) circle (\ptsize) node[below left]{$D$};
			\fill[MyPoints] (O) circle (\ptsize) node[above left]{$O$};
			\fill[MyPoints] (I) circle (\ptsize) node[above left]{$I$};
			\fill[MyPoints] (J) circle (\ptsize) node[above right]{$J$};
			\fill[MyPoints] (K) circle (\ptsize) node[above left]{$K$};
			%ReDraw axes
			\draw[->] (I)--(I2) node[below left]{$x$};
			\draw[->] (J)--(J2) node[right]{$y$};
			\draw[->] (K)--(K2) node[above left]{$z$};					
			%Redraw some points
			\fill[NewPoints] (X1) circle (\ptsize);
			\fill[NewPoints] (X2) circle (\ptsize);
			\fill[NewPoints] (X4) circle (\ptsize)node[above right,green]{\scriptsize{$P$}};
			\fill[NewPoints] (X5) circle (\ptsize)node[above right,green]{\scriptsize{$Q$}};
			\fill[DataPoints] (T) circle (\ptsize) node[below right,red]{$T$};
			}
	\end{tikzpicture}
	\end{center}
	
	\bigskip
	
	\begin{overlayarea}{\textwidth}{8cm}
		\begin{center}
			\only<1>{Voici un cube!}
			\only<2>{$R$ est sur la droite $(KC)$,
						 $S$ est sur la droite $(BD)$,
						 $T$ est sur l'arête $[AJ]$.\\
						 Construire la section du cube par le plan $RST$.
						}
			\only<3>{La droite $(RS)$ est dans le plan de la face supérieure.\\
						 Elle coupe donc les arêtes $[BC]$ et $[DK]$ respectivement en $U$ et $V$.
						}
			\only<4>{La droite $(UT)$ est dans la face $BCJA$...
						}
			\only<5>{
						 ... et coupe la droite $(AB)$ en $W$.
						}
			\only<6>{
						 La droite $SW$ est dans le plan de la face $IABD$.\\
						 Elle coupe les arêtes $[IA]$, $[ID]$ respectivement en $P$ et $Q$.
						}
			\only<7-11>{
						 La section du cube est donc le polygone (plan) $VUTPQ$
						}
			\only<12>{
						 C'est un pentagone.\\
						 Le plan de section coupe toutes les faces du cube sauf la face $OJCK$.
						}
		\end{center}
	\end{overlayarea}
	
	
\end{frame}

\end{document}
