% under Creative Commons attribution license.
% Hugues Vermeiren UREM ULB-Bruxelles.
\documentclass[a4paper,12pt,oneside]{article}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage[francais]{babel}
\usepackage[top=2cm, bottom=1.5cm, left=2.0cm, right=2.0cm]{geometry}
\geometry{a4paper}
\usepackage{amsmath,amssymb, mathrsfs}
\usepackage{fancyhdr}
\usepackage{tikz}
\usetikzlibrary{arrows}

\lhead{UREM-BXL}
\chead{Groupe \LaTeX}
\rhead{Novembre 2009}
\lfoot{\emph{Hugues Vermeiren}}
\cfoot{Page \thepage}
\rfoot{}
\renewcommand{\footrulewidth}{0.4pt}
\pagestyle{fancy}

\newcommand{\numquest}{
	\thenq{}) \stepcounter{nq}
}

\newcommand{\mabrique}[4]{%
			% Parameters :	#1=origin of vector 1, #2=end of vector 1
			%								#1=origin of vector 1, #2=end of vector 2
			% To be choosen among vertices A,B,...,G,H.
			$\overrightarrow{#1#2}\bullet{}\overrightarrow{#3#4}=$
				
			\begin{center}
				\begin{tikzpicture}[scale=0.75,%
					scale=1.0,%
					x={(-0.5cm,-0.3cm)},%
					y={(1cm,0cm)},%
					z={(0cm,1cm)},%
					MyPoints/.style={x={(1cm,0cm)},y={(0cm,1cm)},draw=blue,fill=white,thick},%
					]%
					% Define here the size of the parallelepiped
					% Feel free to modify, but take care of the scale option if too large
					\pgfmathparse{3}\let\depth\pgfmathresult{}
					\pgfmathparse{5}\let\width\pgfmathresult{}
					\pgfmathparse{2}\let\height\pgfmathresult{}
					%			
					\coordinate (A) at (\depth,0,\height);
					\coordinate (B) at (\depth,\width,\height);
					\coordinate (C) at (0,\width,\height);
					\coordinate (D) at (0,0,\height);
					\coordinate (E) at (\depth,0,0);
					\coordinate (F) at (\depth,\width,0);
					\coordinate (G) at (0,\width,0);
					\coordinate (H) at (0,0,0);
					% Draw edges
					\draw (A)--(B)--(C)--(D)--cycle;
					\draw (A)--(E)--(F)--(B)--cycle;
					\draw (F)--(G)--(C);
					\draw[dashed] (D)--(H)--(E) (H)--(G);
					% Ticks
					\foreach \i in {1,...,{\width}}{%
						\fill (0,\i,0) circle (2pt);
						}
					\foreach \i in {1,...,\depth}{%
						\fill (\i,0,0) circle (2pt);
						}
					\foreach \i in {1,...,\height}{%	
						\fill (0,0,\i) circle (2pt);
					}
					% Draw vectors
					\draw[->,>=triangle 45,very thick](#1)--(#2);
					\draw[->,>=triangle 45,very thick](#3)--(#4);	
					% Draw vertices
					\foreach \i in {A,B,C,D,E,F,G,H}{%
						\fill[MyPoints] (\i) circle (3pt);
						}
					% Name points
					\path (A) node[left]{$A$};
					\path (B) node[below right]{$B$};
					\path (C) node[right]{$C$};
					\path (D) node[above left]{$D$};
					\path (E) node[left]{$E$};
					\path (F) node[below right]{$F$};
					\path (G) node[right]{$G$};
					\path (H) node[above right]{$H$};
					%
			\end{tikzpicture}
		\end{center}
}

\newcounter{nq}
\setcounter{nq}{1}

\begin{document}
		\noindent
		Les parallèlépipèdes rectangles représentés ci-dessous sont tels que:\\
		$AB=5$, $AE=2$ et $EH=3$.\\
		Calculer les produits scalaires:
		
		\bigskip
		\hrule
		\vspace{0.25cm}
		\begin{minipage}{0.42\linewidth}
				\numquest
				\mabrique{A}{E}{C}{G}
		\end{minipage}
		\hfill
		\begin{minipage}{0.42\linewidth}
				\numquest
				\mabrique{A}{C}{G}{E}
		\end{minipage}

		\hrule
		\vspace{0.25cm}
		\begin{minipage}{0.42\linewidth}
				\numquest
				\mabrique{A}{G}{F}{E}
		\end{minipage}
		\hfill
		\begin{minipage}{0.42\linewidth}
				\numquest
				\mabrique{B}{F}{F}{E}
		\end{minipage}
		
		\hrule
		\vspace{0.25cm}
		\begin{minipage}{0.42\linewidth}
				\numquest
				\mabrique{D}{F}{C}{E}
		\end{minipage}
		\hfill
		\begin{minipage}{0.42\linewidth}
				\numquest
				\mabrique{A}{H}{D}{H}
		\end{minipage}		
		
		\hrule
		\vspace{0.25cm}
		\begin{minipage}{0.42\linewidth}
				\numquest
				\mabrique{E}{B}{G}{B}
		\end{minipage}
		\hfill
		\begin{minipage}{0.42\linewidth}
				\numquest
				\mabrique{H}{G}{C}{F}
		\end{minipage}
		
		\hrule
		\vspace{0.25cm}
		\begin{minipage}{0.42\linewidth}
				\numquest
				\mabrique{D}{C}{F}{E}
		\end{minipage}
		\hfill
		\begin{minipage}{0.42\linewidth}
				\numquest
				\mabrique{D}{F}{H}{A}
		\end{minipage}
		
		\hrule
\end{document}
