diff options
Diffstat (limited to 'macros/latex/contrib/tkz/tkz-base/doc/latex/TKZdoc-base-BB.tex')
-rw-r--r-- | macros/latex/contrib/tkz/tkz-base/doc/latex/TKZdoc-base-BB.tex | 236 |
1 files changed, 236 insertions, 0 deletions
diff --git a/macros/latex/contrib/tkz/tkz-base/doc/latex/TKZdoc-base-BB.tex b/macros/latex/contrib/tkz/tkz-base/doc/latex/TKZdoc-base-BB.tex new file mode 100644 index 0000000000..74950a060f --- /dev/null +++ b/macros/latex/contrib/tkz/tkz-base/doc/latex/TKZdoc-base-BB.tex @@ -0,0 +1,236 @@ +\section{Gestion de la bounding box} +La bounding box initiale après usage de la macro \tkzcname{tkzInit} est définie par le rectangle basé sur les points $(0,0)$ et $(10,10)$. La macro \tkzcname{tkzInit} permet de modifier cette bounding box initiale en utilisant les arguments (\tkzname{xmin}, \tkzname{xmax}, \tkzname{ymin}, et \tkzname{ymax}). Bien sûr tout tracé extérieur modifie la bounding box. \TIKZ tient à jour cette bounding box. Il est possible d'influer sur ce comportement soit directement avec des commandes ou des options de \TIKZ comme une commande comme \tkzcname{useasboundingbox} ou l'option \tkzname{use as bounding box}. Une conséquence possible est de réserver une boite pour une figure mais la figure peut déborder de la boite et se repandre au-dessus du texte principal. +La commande suivante \tkzcname{pgfresetboundingbox} permet d'effacer une bounding box et d'en établir une nouvelle. + +%Enfin Il est parfois utile de contenir une figure dans une b + +%current bounding box or current path bounding box remember picture et overlay + +%<---------------------------------------------------------------------------> +% tkzShowBB +%<---------------------------------------------------------------------------> +\subsection{tkzShowBB} +La macro la plus simple. +\begin{NewMacroBox}{tkzShowBB}{\oarg{local options}} +Cette macro permet de visualiser la bounding box. Un cadre rectangulaire entoure celle-ci. Cette macro accepte les options de \TIKZ. +\end{NewMacroBox} + + +\subsubsection{Exemple 2 avec \tkzcname{tkzShowBB}} +\begin{tkzexample}[latex=8cm,small] +\begin{tikzpicture}[scale=.5] + \tkzInit[ymax=5,xmax=8] + \tkzGrid + \tkzDefPoint(3,0){A} + \begin{scope} + \tkzClipBB + \tkzDrawCircle[R](A,5 cm) + \tkzShowBB + \end{scope} +\tkzDrawCircle[R,red](A,4 cm) +\end{tikzpicture} +\end{tkzexample} +%<---------------------------------------------------------------------------> +% tkzClipBB +%<---------------------------------------------------------------------------> +\subsection{tkzClipBB} +\begin{NewMacroBox}{tkzClipBB}{}% +Il s'agit de limiter les futures constructions à la bounding box actuelle. +\end{NewMacroBox} + +\subsubsection{Exemple avec \tkzcname{tkzClipBB} et les bissectrices} + +\begin{tkzexample}[latex=6cm,small] + \begin{tikzpicture} + \tkzInit[xmin=-3,xmax=6, ymin=-1,ymax=6] + \tkzDefPoint(0,0){O}\tkzDefPoint(3,1){I} + \tkzDefPoint(1,4){J} + \tkzDefLine[bisector](I,O,J) \tkzGetPoint{i} + \tkzDefLine[bisector out](I,O,J) \tkzGetPoint{j} + \tkzDrawPoints(O,I,J,i,j) + \tkzClipBB + \tkzDrawLines[add = 1 and 2,color=red](O,I O,J) + \tkzDrawLines[add = 1 and 2,color=blue](O,i O,j) + \tkzShowBB + \end{tikzpicture} +\end{tkzexample} + + +%<---------------------------------------------------------------------------> +% tkzSetBB +%<---------------------------------------------------------------------------> +\subsection{tkzSetBB} +\begin{NewMacroBox}{tkzSetBB}{\parg{$x_A~;~y_A$} \parg{$x_B~;~y_B$} ou bien {\parg{$A$} \parg{$B$}}} +{Cette macro permet de définir le rectangle ayant pour coordonnées $(x_A~;~y_A$) et $(x_B~;~y_B)$ comme la nouvelle bounding box.} +\end{NewMacroBox} + +\subsubsection{Exemple avec \tkzcname{tkzShowBB}} +\begin{tkzexample}[latex=8cm,small] +above\\ +left +\begin{tikzpicture} + \tkzDefPoint(0,0){A} + \tkzDefPoint(3,3){B} + \tkzDefPoint(1,1){C} + \tkzSetBB(A)(2,2) + \tkzDrawSegment(A,B) + \tkzDrawPoints(A,C) + \tkzShowBB +\end{tikzpicture}right +\end{tkzexample} +%<---------------------------------------------------------------------------> +% tkzSaveBB +%<---------------------------------------------------------------------------> +\subsection{tkzSaveBB}{} +\begin{NewMacroBox}{tkzSaveBB}{} +Cette macro permet de sauvegarder la bounding box, autrement dit elle enregistre les coordonnées de deux points qui définissent un rectangle. +\end{NewMacroBox} + +\begin{tkzexample}[latex=7cm,small] +Une figure au-dessus du texte\\ +\begin{tikzpicture} + \begin{scope} + \tkzSetBB(0,0)(6,2) \tkzShowBB[fill=blue!20] + \tkzSaveBB + \end{scope} + \tkzDefPoint(3,3){A}\tkzShowBB + \tkzDrawCircle[R,fill=yellow,opacity=.2](A,2cm) + \tkzRestoreBB +\end{tikzpicture} +\end{tkzexample} + + + + +%<---------------------------------------------------------------------------> +% tkzRestoreBB +%<---------------------------------------------------------------------------> +\subsection{tkzRestoreBB} +\begin{NewMacroBox}{tkzRestoreBB}{} +Cette macro récupère la sauvegarde de la bounding box. Comme vous le constater, la figure déborde de la boîte. La bounding box a été réduite. +\end{NewMacroBox} +\subsubsection{Exemple d'utilisation de \tkzcname{tkzRestoreBB}} +\begin{tkzexample}[latex=8cm,small] + \vspace{ 2cm} +Start\\ +\begin{tikzpicture} + \tkzDefPoint(-2,-2){A} + \tkzDefPoint(2,1){B} + \tkzDefPoint(0,0){O} + \tkzSaveBB + \tkzShowBB[red,line width=1pt] + \tkzRestoreBB + \tkzDrawCircle(O,B) + \tkzClipBB + \tkzFillCircle[gray!20](O,B) +\end{tikzpicture} +End +\end{tkzexample} + + +%<---------------------------------------------------------------------------> +% tkzClip +%<---------------------------------------------------------------------------> +\subsection{tkzClip} +\begin{NewMacroBox}{tkzClip}{\oarg{local options}} +Le rôle de cette macro est de rendre invisible ce qui est hors du rectangle défini par $(xmin~;~ymin)$ et $(xmax~;~ymax)$. + +\medskip +\begin{tabular}{lll} +\hline +options & défaut & définition \\ +\midrule +\TOline{space} {1} {valeur ajoutée à droite, à gauche, en bas et en haut du background} +\bottomrule +\end{tabular} + +\medskip + +{Le rôle de l'option \tkzname{space} est d'agrandir la partie visible du dessin. Cette partie devient le rectangle définit par $(xmin-space~;~ymin-space)$ et $(xmax+space~;~ymax+space)$. \tkzname{space} peut être négatif! L'unité est le cm et ne doit pas être indiquée. } +\end{NewMacroBox} + +\subsubsection{Premier exemple avec \tkzcname{tkzClip}} \hypertarget{clip}{} + +\begin{tkzexample}[latex=8cm,small] +\begin{tikzpicture} + \tkzInit[xmax=3, ymax=3] + \tkzGrid + \tkzAxeXY + \draw[red] (-1,-1)--(5,5); +\end{tikzpicture} +\end{tkzexample} + +\begin{tkzexample}[latex=8cm,small] +\begin{tikzpicture} + \tkzInit[xmax=3, ymax=3] + \tkzGrid + \tkzAxeXY + \tkzClip + \draw[red] (-1,-1)--(5,5); +\end{tikzpicture} +\end{tkzexample} +%<---------------------------------------------------------------------------> +Il est possible d'ajouter un peu d'espace \tkzcname{tkzClip[space]} + +\subsubsection{\tkzcname{tkzClip} et l'option \tkzname{space}} +Les dimensions pour définir le rectangle clippé sont \tkzname{xmin-1}, \tkzname{ymin-1}, \tkzname{xmax+1} et \tkzname{ymax+1}. +\begin{tkzexample}[latex=8cm,small] +\begin{tikzpicture} + \tkzInit[xmax=3, ymax=3] + \tkzGrid \tkzAxeXY + \draw[red] (-0.5,-0.5)--(3.5,3.5); +\end{tikzpicture} +\end{tkzexample} + +\begin{tkzexample}[latex=8cm,small] +\begin{tikzpicture} + \tkzInit[xmax=3, ymax=3] + \tkzGrid \tkzAxeXY + \tkzClip[space=-0.5] + \draw[red] (-0.5,-0.5)--(3.5,3.5); +\end{tikzpicture} +\end{tkzexample} + +\subsection{style tkzreverseclip} + +\begin{tkzexample}[latex=7cm,small] +\begin{tikzpicture}[scale=.5] + \tkzInit[xmin=-5,xmax=5,ymin=-5,ymax=5] + \pgfinterruptboundingbox + \tkzDefPoints{-.5/0/P1,.5/0/P2} + \foreach \i [count=\j from 3] in {2,...,7}{% + \tkzDefShiftPoint[P\i]({45*(\i-1)}:1 cm){P\j} + } + \endpgfinterruptboundingbox + \tkzClipOutPolygon(P1,P2,P3,P4,P5,P6,P7,P8) + \tkzCalcLength[cm](P1,P5)\tkzGetLength{r} + \begin{scope}[blend group=screen] + \foreach \i in {1,...,8}{% + \pgfmathparse{100-5*\i} + \tkzFillCircle[R,color=blue!% + \pgfmathresult](P\i,\r) + } + \end{scope} +\end{tikzpicture} +\end{tkzexample} + + +\subsection{option tikz : trim left or right} +voir le \tkzimp{pgfmanual} + +\subsection{Commandes de TikZ \tkzcname{pgfinterruptboundingbox} et \tkzcname{endpgfinterruptboundingbox}} +Cette commande interrompt temporairement le calcul de la boîte et configure une nouvelle boîte + +\begin{tkzexample}[latex=8cm,small] +\begin{tikzpicture} +\tkzDefPoint(0,5){A}\tkzDefPoint(5,4){B} +\tkzDefPoint(0,0){C}\tkzDefPoint(5,1){D} +\pgfinterruptboundingbox + \tkzInterLL(A,B)(C,D)\tkzGetPoint{I} +\endpgfinterruptboundingbox +\tkzClipBB + \tkzDrawCircle(I,B) +\tkzDrawSegments(A,B C,D A,C) +\end{tikzpicture} +\end{tkzexample} +\endinput
\ No newline at end of file |