
\ProvidesPackage{IncipitQCM}
\RequirePackage[utf8x]{inputenc}
\RequirePackage[T1]{fontenc}
\RequirePackage[np]{numprint}
\RequirePackage{tkz-base}
\RequirePackage{tkz-euclide}
\usetikzlibrary{calc}
\RequirePackage{fp}
\RequirePackage{stmaryrd}
\RequirePackage{dashundergaps}
\RequirePackage{ProfCollege}
\RequirePackage{mathrsfs}
\RequirePackage{fdsymbol}
\RequirePackage{transparent}
%\usefonttheme{serif}
\RequirePackage{selectNrandom}

\newif\ifexcel \excelfalse
\DeclareOption{excel}{\exceltrue}
\DeclareOption*{}
\ProcessOptions
\ifexcel \RequirePackage{booktabs, multicol, multirow}
\fi

\RequirePackage{eurosym}
\RequirePackage{shortlst}
\RequirePackage{geometry}
\geometry{a4paper,hmargin=1cm,top=2.5cm,bottom=1.5cm}


\newcommand{\calculppcm}[2]{
\opgcd{#1}{#2}{pgcd}
\opdiv*{\number\numexpr#1*\number\numexpr#2}{pgcd}{q}{r}
\xdef\ppcm{\csname Op@q\endcsname}
}
\newcommand{\nbalea}[3]{\makeatletter
	\FPeval{n@a}{random*2-1}
	\FPeval{#1}{clip(n@a/abs(n@a)*trunc(random*(#3-#2)+#2,0))}
\makeatother}

\newcommand{\casesrondes}{\AMCboxStyle{shape=oval,size=2.5ex,down=0ex,rule=1pt,outsidesep=.1em,color=black}}


	%%%%%%%%%%%					QUADRILLAGES			%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\quadrillageSeyes}[2]{\draw[very thin, color=blue!10, ystep=0.2, xstep=0.8]
#1 grid #2;
\draw[thin, color=purple!30, xstep=0.8, ystep=0.8] #1 grid #2; }

\newcommand{\petitscarreaux}[2]{\draw[thin, color=blue!10!black!20, ystep=0.5, xstep=0.5]
#1 grid #2; }

\newcommand{\papiermillimetre}[2]{	\draw [step=0.1cm,orange!60!gray,ultra thin]  #1 grid #2;
	\draw [step=0.5cm,orange!60!gray, thin]  #1 grid #2;
	\draw [step=1cm,orange!60!gray, thick]  #1 grid #2;
	\draw [step=5cm,orange!60!gray,very thick]  #1 grid #2;}
%%%%%%%%%%%%%			COULEURS			%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\colorlet{rouge}{red!80!black}
\colorlet{vert}{green!60!black}
\colorlet{bleu}{blue!60!black}

%%%%%%%%%%%%%			ITEMIZE*			%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newenvironment{itemize*}%  % Définition d'un nouvel environnement
    {\begin{itemize}%
      \setlength{\itemsep}{0pt}%
      \setlength{\parskip}{0pt}}%
    {\end{itemize}}
\newenvironment{enumerate*}%  % Définition d'un nouvel environnement
    {\begin{enumerate}%
      \setlength{\itemsep}{0pt}%
      \setlength{\parskip}{0pt}}%
    {\end{enumerate}}



%%%%%%%%%%%%%%%OUTILS TIKZ%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\mesgle}[3][1.25]{
\tkzFindAngle(#2) \tkzGetAngle{van}	
\FPround{\van}{\van}{#3}
\tkzLabelAngle[pos=#1](#2){\footnotesize $\np{\van}^{\circ}$}
\tkzMarkAngle[size=#1-.5](#2)
}
\newcommand{\meslge}[3]{
\tkzCalcLength[cm](#1)\tkzGetLength{vlo}
\FPround{\vlo}{\vlo}{#2}
\tkzLabelSegment[#3](#1){\footnotesize $\np{\vlo}~cm$}
}




\newcommand{\droitegraduee}[3][0]{
\FPeval\echelle{clip(#1+neg(round(ln(#3-#2)/ln(10),0)))}
\FPeval\depart{clip(round(#2*(pow(echelle,10)),5))}
\FPeval\fin{clip(round(#3*(pow(echelle,10)),5))}
\FPeval\decalage{trunc(depart,0)}

\tkzDefPoints{\depart-\decalage-.5 /0/Adepart,\fin-\decalage+.5 /0/Bfin}
\tkzDrawSegment[->](Adepart,Bfin)
\foreach \i in {\fpeval{\depart-\decalage} ,...,\fpeval{\fin-\decalage}}{
	\draw(\i,-.05)--(\i,.05);
	\draw(\i , .5*\passecondaire) node[above] {$\i$};
	\ifthenelse{\equal{\i}{\fpeval{\fin-\decalage}}}{}{
	\draw(\i+.5,-.025)--(\i+.5,.025);}
	\draw(\i,.05) node[above]{\np{\fpeval{(\decalage+\i)/10**\echelle}}};
	\foreach \j in {-.4,-.3,...,-.1,.1,.2,...,.4}{
		\draw(\i+\j,-.02)--(\i+\j,.02);
		}
	}
}

\newcommand{\placerpoint}[2][]{
\FPeval\abscisse{clip(round(#2*pow(echelle,10)-decalage,5))}
\draw (\abscisse,-.1)node[below]{$\ifthenelse{\equal{#1}{}}{\np{#2}}{#1}
$};
\draw[->](\abscisse,-.15)--(\abscisse,0);
}

%************
\ExplSyntaxOn

\NewDocumentCommand\nommepoints{ m }{  
  \zazou_polygonom:n {#1}
}

\clist_new:N \l_zazou_names_clist
\tl_new:N    \l_zazou_bary_spec_tl

\cs_new:Npn \zazou_polygonom:n #1 {

  \clist_set:Nn \l_zazou_names_clist 
                { #1 }

  \tl_set:Nn \l_zazou_bary_spec_tl 
             { \clist_use:Nn \l_zazou_names_clist {=1,} }

  \tl_put_right:Nn \l_zazou_bary_spec_tl { =1 }
  
  \tkzDefBarycentricPoint( \tl_use:N \l_zazou_bary_spec_tl )  \tkzGetPoint{Barycentre}

    
  \clist_map_inline:Nn \l_zazou_names_clist {
    \tkzFindSlopeAngle(##1,Barycentre)
    \tkzLabelPoint[anchor=\tkzAngleResult](##1){$##1$}
  }
}

\ExplSyntaxOff



\ExplSyntaxOn

\NewDocumentCommand\letnommepoints{ m }{  
  \letzazou_polygonom:n {#1}
}

\clist_new:N \letl_zazou_names_clist
\tl_new:N    \letl_zazou_bary_spec_tl
       \newcommand{\nomlettre}[1]{\csname let#1\endcsname}

\cs_new:Npn \letzazou_polygonom:n #1 {

  \clist_set:Nn \letl_zazou_names_clist 
                { #1 }

  \tl_set:Nn \letl_zazou_bary_spec_tl 
             { \clist_use:Nn \letl_zazou_names_clist {=1,} }

  \tl_put_right:Nn \letl_zazou_bary_spec_tl { =1 }
  
  \tkzDefBarycentricPoint( \tl_use:N \letl_zazou_bary_spec_tl )  \tkzGetPoint{Barycentre}

    
  \clist_map_inline:Nn \letl_zazou_names_clist {
    \tkzFindSlopeAngle(##1,Barycentre)

    \tkzLabelPoint[anchor=\tkzAngleResult](##1){$\nomlettre{##1}$}
  }
}

\ExplSyntaxOff


\newcommand{\tkzCercle}[2]{
\tkzDefPointBy[rotation=center #1 angle 90](#2) \tkzGetPoint{troisiemepoint}
\tkzDrawArc[color=black](#1,#2)(troisiemepoint)
\tkzDrawArc[color=black](#1,troisiemepoint)(#2)
} 
%%%%%%%%%%%%%%%%%%MARQUEURS ET FLECHES%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\NewDocumentCommand{\marqueur}{O{0}O{.5}m}{\tikz[remember picture, overlay]\node[xshift=#1ex, yshift=#2em](#3){};}
\newcommand{\flechec}[3][45]{\tikz[remember picture, overlay] \draw(#2)edge[bend left=#1,-stealth](#3);}
\newcommand{\fleched}[2]{\begin{tikzpicture}[remember picture, overlay] \tkzDrawSegment[-stealth](#1,#2) \end{tikzpicture}}
\newcommand{\trait}[2]{\begin{tikzpicture}[remember picture, overlay] \tkzDrawSegment(#1,#2) \end{tikzpicture}}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\endinput
