Doc: Avancées, apparence des commandes
[delaunay.git] / doc / luamesh-doc.tex
1 % luamesh: compute and draw meshes with lua, luamplib and tikz
2 %
3 % Originally written by Maxime Chupin <mc@melusine.eu.org>,
4 % 2010.
5 %
6 % Distributed under the terms of the GNU free documentation licence:
7 % http://www.gnu.org/licenses/fdl.html
8 % without any invariant section or cover text.
9
10 \documentclass{lltxdoc}
11 \usepackage{tcolorbox}
12 \title{\Verb+luamesh+: compute and draw meshes with \lualatex}
13 \author{Maxime Chupin \email{mc@melusine.eu.org}}
14 \date{\today}
15
16 \newcommand*\commande{\noindent\hspace{-30pt}%
17 \SaveVerb[aftersave={%
18 \UseVerb{Vitem}
19 }%
20 ]{Vitem}}
21
22 \usepackage{xargs}
23 \newcommand*\textme[1]{\color{black}{\rmfamily\textit{#1}}}
24 \newcommand*\meta[1]{% % meta
25 \textme{\ensuremath{\langle}#1\ensuremath{\rangle}}}
26 \newcommand*\optstar{% % optional star
27 \meta{\ensuremath{*}}\xspace}
28 \DefineShortVerb{\|}
29
30 \setlength{\fboxsep}{2pt}
31 \fvset{%
32 codes={\catcode`\«\active \catcode`\×\active },
33 defineactive={\makefancyog\makefancytimes},
34 formatcom=\color{red},
35 frame=single
36 }
37 % rendre «...» équivalent à \meta{...}
38 {\catcode`\«\active
39 \newcommandx\makefancyog[0][addprefix=\global]{%
40 \def«##1»{\meta{##1}}}}
41 % rendre × équivalent à \optstar
42 {\catcode`\×\active
43 \newcommandx\makefancytimes[0][addprefix=\global]{%
44 \def×{\optstar{}}}}
45
46
47 \tcbuselibrary{listings,breakable}
48
49 \definecolor{vert}{rgb}{0.1,0.4,0.1}
50 \definecolor{bleu}{rgb}{0.1,0.1,0.4}
51 \lstset{
52 numberstyle=\footnotesize\color{vert},
53 keywordstyle=\ttfamily\bfseries\color{blue},
54 basicstyle=\ttfamily\footnotesize,
55 commentstyle=\itshape\color{vert},
56 stringstyle=\ttfamily,
57 showstringspaces=false,
58 language=[LaTeX]TeX,
59 breaklines=true,
60 breakindent=30pt,
61 defaultdialect=[LaTeX]TeX,
62 % frame=tb
63 }
64
65 \lstdefinelanguage{lua}
66 {morekeywords={for,end,function,do,if,else,elseif,then,
67 tex.print,tex.sprint,io.read,io.open,string.find,string.explode,require},
68 morecomment=[l]{--},
69 morecomment=[s]{--[[}{]]},
70 morestring=[b]''
71 }
72
73 \newtcblisting{Exemple}{%
74 arc=0pt,outer arc=0pt,
75 colback=red!2!white,
76 colframe=red!75!black,
77 breakable,
78 boxsep=0pt,left=5pt,right=5pt,top=5pt,bottom=5pt, bottomtitle =
79 3pt, toptitle=3pt,
80 boxrule=0pt,bottomrule=0.5pt,toprule=0.5pt, toprule at break =
81 0pt, bottomrule at break = 0pt,
82 listing options={breaklines},
83 }
84
85 \newtcblisting{commandshell}{colback=black,colupper=white,colframe=black,
86 arc=0pt,
87 listing only,boxsep=0pt,listing
88 options={style=tcblatex,language=sh},
89 every listing line={\textcolor{red}{\small\ttfamily\bfseries user \$> }}}
90
91 \newtcblisting{latexcode}{
92 arc=0pt,
93 listing only,boxsep=0pt,listing
94 options={style=tcblatex}}
95
96
97 \newcommand\luamesh{\Verb+luamesh+\xspace}
98
99 \begin{document}
100
101 \maketitle
102
103 \begin{abstract}
104 The package \Verb|luamesh| allows to compute and draw 2D triangulation
105 of Delaunay. The algorithm is written with lua, and depending of the
106 choice of the ``engine'', the draw is done by MetaPost (with
107 \Verb|luamplib|) or by \Verb|tikz|.
108
109 The Delaunay triangulation algorithm is the Bowyer and Watson
110 algorithm. Several macros are provided to draw the global mesh, the
111 set of points, a particular step of the algorithm.
112 \end{abstract}
113
114 \section{Installation}
115
116 \subsection{With Linux}
117
118 To install \luamesh with \TeX live, you have to create the local
119 \Verb+texmf+ directory in your \Verb+home+.
120
121 \begin{commandshell}
122 mkdir ~/texmf
123 \end{commandshell}
124
125 Then we have to files to place in the correct directories. First, the
126 \Verb+luamesh.sty+ file must be in the directory:
127 \begin{center}
128 \Verb+~/texmf/tex/latex/luamesh/+
129 \end{center}
130 and secondly, the \Verb+luamesh.lua+ must be in the directory:
131 \begin{center}
132 \Verb+~/texmf/scripts/luamesh/+
133 \end{center}
134
135 Once you have done this, \luamesh can be included in your document
136 with
137 \begin{latexcode}
138 \usepackage{luamesh}
139 \end{latexcode}
140
141 \subsection{Dependencies}
142
143 This package is built upon two main packages to draw the
144 triangulations :
145 \begin{enumerate}
146 \item \Verb+luamplib+ to use MetaPost via the \luatex library
147 \Verb+mplib+;
148 \item or \Verb+tikz+.
149 \end{enumerate}
150 We will see how to choose between these two \emph{drawing engines}.
151
152 Moreover, the following packages are necessary:
153 \begin{enumerate}
154 \item \Verb+xkeyval+ to manage the optional arguments;
155 \item \Verb+xcolor+ to use colors (needed by \Verb+luamplib+);
156 \item \Verb+ifthen+ to help the programming with \TeX.
157 \end{enumerate}
158
159
160 \section{The Basic Macros}
161
162 If you want to use this package, you must compile your document with
163 \Verb+lualatex+:
164
165 \begin{commandshell}
166 lualatex mylatexfile.tex
167 \end{commandshell}
168
169 Let us recall that this package provides macros to draw two
170 dimensional triangulations (or meshes).
171
172 \subsection{Draw a Complete Mesh}
173
174 \commande|\buildMeshBW[«options»]{«list of points» or «file name»}|\medskip
175
176 This macro produce the Delaunay triangulation (using the Bowyer and
177 Watson algorithm) of the given \meta{list of points}. The list of
178 points must be given in the following way :
179 \begin{center}
180 \verb+(x1,y1);(x2,y2);(x3,y3);...;(xn,yn)+
181 \end{center}
182
183 \begin{Exemple}
184 \buildMeshBW{(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)}
185 \end{Exemple}
186
187 \subsubsection{The Options}
188
189 There are several options to customize the drawing.
190 \begin{description}
191 \item[\color{red}\texttt{mode = int (default) or ext}:] the mode option allow to
192 use either the previously described set of point in the argument, or
193 a file, containing, line by line (2 columns), the points. Such a
194 file looks like :
195 \begin{verbatim}
196 x1 y1
197 x2 y2
198 x3 y3
199 ...
200 xn yn
201 \end{verbatim}
202 \end{description}
203
204 \subsection{Draw the Set of Points}
205
206 \commande|\tracePointsMesh[«options»]{«list of points» or «file name»}|
207
208
209 \subsection{Draw a Step of the Bowyer and Watson Algorithm}
210
211 \commande|\meshAddPointBW[«options»]{«list of points» or «file name»}{«point» or «number of line»}|
212
213
214 \section{The \emph{inc} Macros}
215
216 \section{Gallery of Examples}
217
218 \end{document}
219
220
221
222 %%% Local Variables:
223 %%% flyspell-mode: 1
224 %%% ispell-local-dictionary: "american"
225 %%% End:

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.