Doc: fin + références
[delaunay.git] / doc / luamesh-doc.tex
index 57ba342..80469eb 100644 (file)
@@ -9,10 +9,11 @@
 
 \documentclass{lltxdoc}
 \usepackage{tcolorbox}
-\usepackage{xargs}
 \usepackage{enumitem}
 \usepackage[tikz]{bclogo}
 \usepackage{wrapfig}
+
+
 \title{\Verb+luamesh+: compute and draw meshes with \lualatex}
 \author{Maxime Chupin \email{mc@melusine.eu.org}}
 \date{\today}
   }%
   {\end{tcolorbox}\medskip}
 
-
+\lstset{moredelim=*[s][\color{red}\rmfamily\itshape]{<}{>}}
+\lstset{moredelim=*[s][\color{blue}\rmfamily\itshape]{<<}{>>}}
+\usepackage[colorlinks=true]{hyperref}
 \begin{document}
 %% === Page de garde ===================================================
 \thispagestyle{empty}
@@ -190,6 +193,8 @@ with a git project on the \Verb+melusine+ machine:
 I would also like to thank the first user, an intensive
 \emph{test} user, and a very kind English corrector: Nicole Spillane.
 
+\tableofcontents
+
 \section{Installation}
 
 
@@ -558,7 +563,8 @@ macros, with the suffix \Verb+inc+ that allow the user to add code
 (MetaPost or \Verb+tikz+, depending of the drawing engine) before and
 after the code generated by \luamesh.
 
-The three macros are:
+The three macros are:\medskip
+
 
 \commande|\buildMeshBWinc[«options»]{«list of points» or «file name»}{«code before»}{«code after»}|\medskip
 
@@ -580,15 +586,178 @@ When we use the MetaPost drawing engine, the macros previously
 described produced a code of the form
 \begin{latexcode}
 \begin{luamplib}
+  u:=<scale>;
+  beginfig(0);
+  <code for the drawing>
+  endfig;
+\end{luamplib}
+\end{latexcode}
 
+Then, the arguments \meta{code before} and \meta{code after} are
+inserted as follows:
+\begin{latexcode}
+\begin{luamplib}
+  u:=<scale>;
+  <<code before>>
+  <code for the drawing>
+  <<code after>>
 \end{luamplib}
 \end{latexcode}
+\begin{warning}
+With the \emph{inc} macros, the user has to add the \Verb+beginfig();+
+and \Verb+endfig;+ commands to produce a picture. Indeed, this allows
+to use the \Verb+\everymplib+ command from the \Verb+\luamplib+ package.
+\end{warning}
+
+\subsubsection{The \LaTeX{} Colors Inside the MetaPost Code}
 
+The configurable colors
+of the \LaTeX{} macro are accessible inside the MetaPost code. For
+\Verb+\buildMeshBWinc+ and \Verb+\drawPointsMeshinc+, we have
+\Verb+\luameshmpcolor+,
+and \Verb+\luameshmpcolorBbox+.
+For the macro \Verb+\meshAddPointBWinc+ we have three additional
+colors : \Verb+\luameshmpcolorBack+, \Verb+\luameshmpcolorNew+, and
+\Verb+\luameshmpcolorCircle+. Of course, we can define MetoPost
+colors as well. Finally, the \Verb+luamplib+ mechanism of
+\Verb+\mpcolor+ is also available.
+
+\subsubsection{The Mesh Points}
+
+At the beginning of the automatically generated code, a list of
+MetaPost \Verb+pair+s are defined corresponding to all the vertices of
+the mesh (when the option \Verb+bbox=show+, the last 4 points are the
+\emph{bounding box points}). The points are available with the
+\Verb+MeshPoints[]+ table of variables. The \Verb+MeshPoints[i]+ are
+defined using the unit length \Verb+u+.
+
+\subsubsection{Examples}
+
+Here is three examples for the different macros.
+\begin{Exemple}
+\drawPointsMeshinc[
+color = blue!50,
+print = points,
+meshpoint = x,
+scale=0.8cm,
+]{(0.3,0.3);(1.5,1);(4,0);(4.5,2.5);(1.81,2.14);(2.5,0.5);(2.8,1.5)}%
+{% code before
+  beginfig(0);
+}%
+{% code after
+  label(btex Mesh $\mathbb{T}$ etex, (0,2u)) withcolor \luameshmpcolor;
+  endfig;
+}
+\buildMeshBWinc[%
+bbox = show,
+color = red,
+colorBbox = blue!30,
+print = points,
+meshpoint = x,
+scale=0.8cm
+]{(0.3,0.3);(1.5,1);(4,0);(4.5,2.5);(1.81,2.14);(2.5,0.5);(2.8,1.5)}%
+{% code before
+  beginfig(0);
+}
+{% code after
+  drawdblarrow MeshPoints[3] -- MeshPoints[9] withpen pencircle scaled 1pt
+  withcolor (0.3,0.7,0.2);
+  endfig;
+}
+\meshAddPointBWinc[
+meshpoint = \alpha,
+newpoint = y,
+colorBack=red!10,
+colorNew = green!50!red,
+colorCircle = blue,
+colorBbox = black!20,
+bbox = show,
+scale=0.8cm,
+step=badtriangles]
+{(0.3,0.3);(1.5,1);(4,0);(4.5,2.5);(1.81,2.14);(2.5,0.5)}{(2.8,1.5)}%
+{%code before
+  picture drawing;
+  drawing := image(
+}{%code after
+  );
+  beginfig(0);
+  fill MeshPoints[7]--MeshPoints[8]--MeshPoints[9]--MeshPoints[10]--cycle
+  withcolor \mpcolor{blue!10};
+  draw drawing;
+  endfig;
+}
+\end{Exemple}
+\begin{warning}
+  The variables \Verb+MeshPoints[]+ are not defined for the argument
+  corresponding to the code to place before the code generated by
+  \luamesh. Hence, to use such variables, we have to define a
+  \Verb+picture+ as shown in the third example above.
+\end{warning}
 
 
 \subsection{With TikZ}
 
-\section{Gallery of Examples}
+If we have chosen \Verb+tikz+ as the engine drawing, the added code
+will be written in \Verb+tikz+. In that case, the two arguments
+\meta{code before} and \meta{code after} will be inserted as follows:
+\begin{latexcode}
+\noindent
+\begin{tikzpicture}[x=<scale>,y=<scale>]
+  <<code before>>
+  <generated code>
+  <<code after>>
+\end{tikzpicture}
+\end{latexcode}
+
+Because the engine is \Verb+tikz+ their is no issue with colors, the
+\LaTeX{} colors (e.g.: \Verb+xcolor+) can be directly used.
+
+\subsubsection{The Mesh Points}
+
+The points of the mesh are defined here as \Verb+tikz+
+\Verb+\coordinate+ named as follows
+\begin{latexcode}
+\coordinate (MeshPoints1) at (...,...);
+\coordinate (MeshPoints2) at (...,...);
+\coordinate (MeshPoints3) at (...,...);
+%etc.
+\end{latexcode}
+
+Once again these coordinates are not yet defined for the \meta{code
+  before} argument.
+
+\subsubsection{Examples}
+
+\begin{Exemple}
+  \drawPointsMeshinc[
+  tikz,
+  color = blue!50,
+  print = points,
+  meshpoint = x,
+  scale=0.8cm,
+  ]{(0.3,0.3);(1.5,1);(4,0);(4.5,2.5);(1.81,2.14);(2.5,0.5);(2.8,1.5)}%
+  {% code before
+  }%
+  {% code after
+    \node[color = blue!50]  at (0,2) {Mesh $\mathbb{T}$} ;
+  }
+  \buildMeshBWinc[%
+  tikz,
+  bbox = show,
+  color = red,
+  colorBbox = blue!30,
+  print = points,
+  meshpoint = x,
+  scale=0.8cm
+  ]{(0.3,0.3);(1.5,1);(4,0);(4.5,2.5);(1.81,2.14);(2.5,0.5);(2.8,1.5)}%
+  {% code before
+  }
+  {% code after
+    \draw[<->,thick, color=green] (MeshPoints3) -- (MeshPoints9);
+  }
+\end{Exemple}
+
+\input{dum.bbl}
 
 \end{document}
 

Licence Creative Commons Les fichiers de Syracuse sont mis à disposition (sauf mention contraire) selon les termes de la
Licence Creative Commons Attribution - Pas d’Utilisation Commerciale - Partage dans les Mêmes Conditions 4.0 International.