1 \NeedsTeXFormat{LaTeX2e}%
2 \def\PackageName{luamesh}%
3 \def\fileversion{v0.2}%
4 \def\filedate{2016/11/29}%
5 \ProvidesPackage{luamesh}[\filedate\space\fileversion]%
8 \RequirePackage{xkeyval,xcolor,ifthen}%
9 %% one global option: mp or tikz
11 %\define@key{luamesh.sty}{mp}[]{\luameshmptrue}%
12 %\define@key{luamesh.sty}{tikz}[]{\luameshmpfalse}%
14 %\RequirePackage{etoolbox} % pour robustifier les commandes
18 \RequirePackage{luamplib}%
20 \RequirePackage{tikz}%
24 \directlua{require("luamesh.lua")}%
27 % for tikz (default value)
28 % default color for the plot of a global mesh
29 \definecolor{TeXCluaMeshTikZ}{rgb}{0.,0.,0.}
30 % default color for a new element
31 \definecolor{TeXCluaMeshNewTikZ}{rgb}{0.5,0.1,0.1}
32 % defaut color for the background of new element
33 \definecolor{TeXCluaMeshBackTikZ}{rgb}{0.99,0.85,0.85}
34 % default color for circoncircle
35 \definecolor{TeXCluaMeshCircleTikZ}{rgb}{0.1,0.6,0.1}
38 %%%%%%%%%%%%%%%% the buildMesh command inc
39 %% the user can write code (tikz or MP)
40 %% before and after the generated code
41 \define@boolkey{buildMeshInc}{tikz}[true]{}%
42 %% show the bounding box for delaunay
43 \define@choicekey*{buildMeshInc}{bbox}[\val\nr]{none, show}{%
45 \def\luameshval@bmi@bbox{none}%
47 \def\luameshval@bmi@bbox{bbox}%
51 \define@key{buildMeshInc}{scale}[1cm]{\def\luameshval@bmi@scale{#1}}%
53 \define@choicekey*{buildMeshInc}{print}[\val\nr]{none, points}{%
55 \def\luameshval@bmi@print{none}%
57 \def\luameshval@bmi@print{points}%
60 %% the name of the point
61 \define@key{buildMeshInc}{meshpoint}[P]{\def\luameshval@bmi@meshpoint{#1}}%
62 %% the mode for reading the points
63 \define@choicekey*{buildMeshInc}{mode}[\val\nr]{int, ext}{%
65 \def\luameshval@bmi@mode{int}%
67 \def\luameshval@bmi@mode{ext}%
70 %% the name of the color of drawing
71 \define@key{buildMeshInc}{color}[black]{\def\luameshval@bmi@color{#1}}%
72 %% the name of the color of drawing the bbox
73 \define@key{buildMeshInc}{colorBbox}[black]{\def\luameshval@bmi@colorbbox{#1}}%
75 \presetkeys{buildMeshInc}{tikz=false,bbox=none,scale, meshpoint,mode=int,print=none,color,colorBbox}{}%
77 \newcommand*{\buildMeshBWinc}[4][]{%
78 % #1 : optionnal arguments
79 % #2 : the string containing the list of points
80 % (x1,y1);(x2,y2);... or the name file containing the points
81 % #3 : the code to place before the generated one
82 % #4 : the code to place after the generated one
83 \setkeys{buildMeshInc}{#1} %
84 \def\MeshPoint{\luameshval@bmi@meshpoint}%
85 \ifKV@buildMeshInc@tikz% if we are using tikz
87 buildMeshTikZBWinc("#2","\luaescapestring{\unexpanded{#3}}","\luaescapestring{\unexpanded{#4}}","\luameshval@bmi@mode","\luameshval@bmi@print","\luameshval@bmi@bbox","\luameshval@bmi@scale","\luameshval@bmi@color","\luameshval@bmi@colorbbox")%
89 \else % we are using MP
90 \mplibcolor{\luameshmpcolor}{\luameshval@bmi@color}%
91 \mplibcolor{\luameshmpcolorBbox}{\luameshval@bmi@colorbbox}%
93 buildMeshMPBWinc("#2","\luaescapestring{\unexpanded{#3}}","\luaescapestring{\unexpanded{#4}}","\luameshval@bmi@mode","\luameshval@bmi@print","\luameshval@bmi@bbox","\luameshval@bmi@scale")%
99 %%%%%%%%%%%%%%%% the buildMeshBW command
100 %% the code is complete and we don't have any callbacks
101 \define@boolkey{buildMesh}{tikz}[true]{}%
102 %% show the bounding box for delaunay
103 \define@choicekey*{buildMesh}{bbox}[\val\nr]{none, show}{%
105 \def\luameshval@bm@bbox{none}%
107 \def\luameshval@bm@bbox{bbox}%
111 \define@key{buildMesh}{scale}[1cm]{\def\luameshval@bm@scale{#1}}%
113 \define@choicekey*{buildMesh}{print}[\val\nr]{none, points}{%
115 \def\luameshval@bm@print{none}%
117 \def\luameshval@bm@print{points}%
120 %% the name of the point
121 \define@key{buildMesh}{meshpoint}[P]{\def\luameshval@bm@meshpoint{#1}}%
122 %% the mode for reading the points
123 \define@choicekey*{buildMesh}{mode}[\val\nr]{int, ext}{%
125 \def\luameshval@bm@mode{int}%
127 \def\luameshval@bm@mode{ext}%
130 %% the name of the color of drawing
131 \define@key{buildMesh}{color}[black]{\def\luameshval@bm@color{#1}}%
132 %% the name of the color of drawing the bbox
133 \define@key{buildMesh}{colorBbox}[black]{\def\luameshval@bm@colorbbox{#1}}%
135 \presetkeys{buildMesh}{tikz=false,bbox=none,scale, meshpoint,mode=int,print=none,color,colorBbox}{}%
137 \newcommand{\buildMeshBW}[2][]{%
138 % #1 : optionnal arguments
139 % #2 : the string containing the list of points
140 % (x1,y1);(x2,y2);... or the name file containing the points
141 \setkeys{buildMesh}{#1} %
142 \def\MeshPoint{\luameshval@bm@meshpoint}%
143 \ifKV@buildMesh@tikz% if we are using tikz
145 buildMeshTikZBW("#2","\luameshval@bm@mode","\luameshval@bm@print","\luameshval@bm@bbox","\luameshval@bm@scale","\luameshval@bm@color","\luameshval@bm@colorbbox")%
147 \else % we are using MP
148 \mplibcolor{\luameshmpcolor}{\luameshval@bm@color}%
149 \mplibcolor{\luameshmpcolorBbox}{\luameshval@bm@colorbbox}%
151 buildMeshMPBW("#2","\luameshval@bm@mode","\luameshval@bm@print","\luameshval@bm@bbox","\luameshval@bm@scale")%
156 %%%%%%%%%%%%%%%% the buildVoronoi command
157 %% the user can write code (tikz or MP)
158 %% before and after the generated code
159 \define@boolkey{buildVoronoiInc}{tikz}[true]{}%
160 %% show the bounding box for delaunay
161 \define@choicekey*{buildVoronoiInc}{bbox}[\val\nr]{none, show}{%
163 \def\luameshval@bvi@bbox{none}%
165 \def\luameshval@bvi@bbox{bbox}%
169 \define@key{buildVoronoiInc}{scale}[1cm]{\def\luameshval@bvi@scale{#1}}%
171 \define@choicekey*{buildVoronoiInc}{print}[\val\nr]{none, points}{%
173 \def\luameshval@bvi@print{none}%
175 \def\luameshval@bvi@print{points}%
178 %% style dashed Delaunay
179 \define@choicekey*{buildVoronoiInc}{styleDelaunay}[\val\nr]{none, dashed}{%
181 \def\luameshval@bvi@styleDelaunay{none}%
183 \def\luameshval@bvi@styleDelaunay{dashed}%
186 %% style dashed Voronoi
187 \define@choicekey*{buildVoronoiInc}{styleVoronoi}[\val\nr]{none, dashed}{%
189 \def\luameshval@bvi@styleVoronoi{none}%
191 \def\luameshval@bvi@styleVoronoi{dashed}%
194 %% the name of the point
195 \define@key{buildVoronoiInc}{meshpoint}[P]{\def\luameshval@bvi@meshpoint{#1}}%
196 %% the name of the circum point
197 \define@key{buildVoronoiInc}{circumpoint}[P]{\def\luameshval@bvi@circumpoint{#1}}%
198 %% the mode for reading the points
199 \define@choicekey*{buildVoronoiInc}{mode}[\val\nr]{int, ext}{%
201 \def\luameshval@bvi@mode{int}%
203 \def\luameshval@bvi@mode{ext}%
206 %% the mode for reading the points
207 \define@choicekey*{buildVoronoiInc}{delaunay}[\val\nr]{none, show}{%
209 \def\luameshval@bvi@delaunay{none}%
211 \def\luameshval@bvi@delaunay{show}%
214 %% the name of the color of drawing
215 \define@key{buildVoronoiInc}{color}[black]{\def\luameshval@bvi@color{#1}}%
216 %% the name of the color of drawing Voronoi
217 \define@key{buildVoronoiInc}{colorVoronoi}[red]{\def\luameshval@bvi@colorvoronoi{#1}}%
218 %% the name of the color of drawing the bbox
219 \define@key{buildVoronoiInc}{colorBbox}[black]{\def\luameshval@bvi@colorbbox{#1}}%
221 \presetkeys{buildVoronoiInc}{tikz=false,bbox=none,scale, meshpoint,circumpoint,mode=int,print=none,color,colorVoronoi,colorBbox,delaunay=none,styleDelaunay=none,styleVoronoi=none}{}%
223 \newcommand*{\buildVoronoiBWinc}[4][]{%
224 % #1 : optionnal arguments
225 % #2 : the string containing the list of points
226 % (x1,y1);(x2,y2);... or the name file containing the points
227 % #3 : the code to place before the generated one
228 % #4 : the code to place after the generated one
229 \setkeys{buildVoronoiInc}{#1} %
230 \def\MeshPoint{\luameshval@bvi@meshpoint}%
231 \def\CircumPoint{\luameshval@bvi@circumpoint}%
232 \ifKV@buildVoronoiInc@tikz% if we are using tikz
234 buildVoronoiTikZBWinc("#2","\luaescapestring{\unexpanded{#3}}","\luaescapestring{\unexpanded{#4}}","\luameshval@bvi@mode","\luameshval@bvi@print","\luameshval@bvi@bbox","\luameshval@bvi@scale","\luameshval@bvi@delaunay","\luameshval@bvi@color","\luameshval@bvi@colorbbox","\luameshval@bvi@colorvoronoi","\luameshval@bvi@styleDelaunay","\luameshval@bvi@styleVoronoi")%
236 \else % we are using MP
237 \mplibcolor{\luameshmpcolor}{\luameshval@bvi@color}%
238 \mplibcolor{\luameshmpcolorBbox}{\luameshval@bvi@colorbbox}%
239 \mplibcolor{\luameshmpcolorVoronoi}{\luameshval@bvi@colorvoronoi}%
241 buildVoronoiMPBWinc("#2","\luaescapestring{\unexpanded{#3}}","\luaescapestring{\unexpanded{#4}}","\luameshval@bvi@mode","\luameshval@bvi@print","\luameshval@bvi@bbox","\luameshval@bvi@scale","\luameshval@bvi@delaunay","\luameshval@bvi@styleDelaunay","\luameshval@bvi@styleVoronoi")%
247 %%%%%%%%%%%%%%%% the buildVoronoiBW command
248 %% the code is complete and we don't have any callbacks
249 \define@boolkey{buildVoronoi}{tikz}[true]{}%
250 %% show the bounding box for delaunay
251 \define@choicekey*{buildVoronoi}{bbox}[\val\nr]{none, show}{%
253 \def\luameshval@bv@bbox{none}%
255 \def\luameshval@bv@bbox{bbox}%
259 \define@key{buildVoronoi}{scale}[1cm]{\def\luameshval@bv@scale{#1}}%
261 \define@choicekey*{buildVoronoi}{print}[\val\nr]{none, points}{%
263 \def\luameshval@bv@print{none}%
265 \def\luameshval@bv@print{points}%
268 %% the name of the point
269 \define@key{buildVoronoi}{meshpoint}[P]{\def\luameshval@bv@meshpoint{#1}}%
270 %% the name of the circum point
271 \define@key{buildVoronoi}{circumpoint}[P]{\def\luameshval@bv@circumpoint{#1}}%
272 %% the mode for reading the points
273 \define@choicekey*{buildVoronoi}{mode}[\val\nr]{int, ext}{%
275 \def\luameshval@bv@mode{int}%
277 \def\luameshval@bv@mode{ext}%
280 %% style dashed Delaunay
281 \define@choicekey*{buildVoronoi}{styleDelaunay}[\val\nr]{none, dashed}{%
283 \def\luameshval@bv@styleDelaunay{none}%
285 \def\luameshval@bv@styleDelaunay{dashed}%
288 %% style dashed Voronoi
289 \define@choicekey*{buildVoronoi}{styleVoronoi}[\val\nr]{none, dashed}{%
291 \def\luameshval@bv@styleVoronoi{none}%
293 \def\luameshval@bv@styleVoronoi{dashed}%
296 %% the mode for reading the points
297 \define@choicekey*{buildVoronoi}{delaunay}[\val\nr]{none, show}{%
299 \def\luameshval@bv@delaunay{none}%
301 \def\luameshval@bv@delaunay{show}%
304 %% the name of the color of drawing
305 \define@key{buildVoronoi}{color}[black]{\def\luameshval@bv@color{#1}}%
306 %% the name of the color of drawing Voronoi
307 \define@key{buildVoronoi}{colorVoronoi}[red]{\def\luameshval@bv@colorVoronoi{#1}}%
308 %% the name of the color of drawing the bbox
309 \define@key{buildVoronoi}{colorBbox}[black]{\def\luameshval@bv@colorbbox{#1}}%
311 \presetkeys{buildVoronoi}{tikz=false,bbox=none,scale,
312 meshpoint,circumpoint,mode=int,print=none,color,colorVoronoi,colorBbox,delaunay=none,styleDelaunay=none, styleVoronoi=none}{}%
314 \newcommand{\buildVoronoiBW}[2][]{%
315 % #1 : optionnal arguments
316 % #2 : the string containing the list of points
317 % (x1,y1);(x2,y2);... or the name file containing the points
318 \setkeys{buildVoronoi}{#1} %
319 \def\MeshPoint{\luameshval@bv@meshpoint}%
320 \def\CircumPoint{\luameshval@bv@circumpoint}%
321 \ifKV@buildVoronoi@tikz% if we are using tikz
323 buildVoronoiTikZBW("#2","\luameshval@bv@mode","\luameshval@bv@print","\luameshval@bv@bbox","\luameshval@bv@scale","\luameshval@bv@delaunay","\luameshval@bv@color","\luameshval@bv@colorbbox","\luameshval@bv@colorVoronoi","\luameshval@bv@styleDelaunay","\luameshval@bv@styleVoronoi")%
325 \else % we are using MP
326 \mplibcolor{\luameshmpcolor}{\luameshval@bv@color}%
327 \mplibcolor{\luameshmpcolorBbox}{\luameshval@bv@colorbbox}%
328 \mplibcolor{\luameshmpcolorVoronoi}{\luameshval@bv@colorVoronoi}%
330 buildVoronoiMPBW("#2","\luameshval@bv@mode","\luameshval@bv@print","\luameshval@bv@bbox","\luameshval@bv@scale","\luameshval@bv@delaunay","\luameshval@bv@styleDelaunay","\luameshval@bv@styleVoronoi")%
337 %%%%%%%%%%%%%%%%% the draw Points macro
338 %% plot the list of points given in argument
340 \define@boolkey{drawPoints}{tikz}[true]{}%
341 %% show the bounding box for delaunay
342 \define@choicekey*{drawPoints}{bbox}[\val\nr]{none, show}{%
344 \def\luameshval@tp@bbox{none}%
346 \def\luameshval@tp@bbox{bbox}%
350 \define@key{drawPoints}{scale}[1cm]{\def\luameshval@tp@scale{#1}}%
352 \define@choicekey*{drawPoints}{print}[\val\nr]{none, points}{%
354 \def\luameshval@tp@print{none}%
356 \def\luameshval@tp@print{points}%
359 %% the name of the point
360 \define@key{drawPoints}{meshpoint}[P]{\def\luameshval@tp@meshpoint{#1}}%
361 %% the mode for reading the points
362 \define@choicekey*{drawPoints}{mode}[\val\nr]{int, ext}{%
364 \def\luameshval@tp@mode{int}%
366 \def\luameshval@tp@mode{ext}%
369 %% the name of the color of drawing
370 \define@key{drawPoints}{color}[black]{\def\luameshval@tp@color{#1}}%
371 %% the name of the color of drawing the bbox
372 \define@key{drawPoints}{colorBbox}[black]{\def\luameshval@tp@colorbbox{#1}}%
374 \presetkeys{drawPoints}{tikz=false,bbox=none,scale, meshpoint,mode=int,print=none,color,colorBbox}{}%
376 \newcommand{\drawPointsMesh}[2][]{%
377 % #1 : optionnal arguments
378 % #2 : the string containing the list of points
379 % (x1,y1);(x2,y2);... or the name file containing the points
380 \setkeys{drawPoints}{#1} %
381 \def\MeshPoint{\luameshval@tp@meshpoint}%
382 \ifKV@drawPoints@tikz% if we are using tikz
384 printPointsTikZ("#2","\luameshval@tp@mode","\luameshval@tp@print","\luameshval@tp@bbox","\luameshval@tp@scale","\luameshval@tp@color","\luameshval@tp@colorbbox")%
386 \else % we are using MP
387 \mplibcolor{\luameshmpcolor}{\luameshval@tp@color}%
388 \mplibcolor{\luameshmpcolorBbox}{\luameshval@tp@colorbbox}%
390 printPointsMP("#2","\luameshval@tp@mode","\luameshval@tp@print","\luameshval@tp@bbox","\luameshval@tp@scale")%
397 %%%%%%%%%%%%%%%% the draw Points macro inc with callbacks
399 \define@boolkey{drawPointsInc}{tikz}[true]{}%
400 %% show the bounding box for delaunay
401 \define@choicekey*{drawPointsInc}{bbox}[\val\nr]{none, show}{%
403 \def\luameshval@tpi@bbox{none}%
405 \def\luameshval@tpi@bbox{bbox}%
409 \define@key{drawPointsInc}{scale}[1cm]{\def\luameshval@tpi@scale{#1}}%
411 \define@choicekey*{drawPointsInc}{print}[\val\nr]{none, points}{%
413 \def\luameshval@tpi@print{none}%
415 \def\luameshval@tpi@print{points}%
418 %% the name of the point
419 \define@key{drawPointsInc}{meshpoint}[P]{\def\luameshval@tpi@meshpoint{#1}}%
420 %% the mode for reading the points
421 \define@choicekey*{drawPointsInc}{mode}[\val\nr]{int, ext}{%
423 \def\luameshval@tpi@mode{int}%
425 \def\luameshval@tpi@mode{ext}%
430 %% the name of the color of drawing
431 \define@key{drawPointsInc}{color}[black]{\def\luameshval@tpi@color{#1}}%
432 %% the name of the color of drawing the bbox
433 \define@key{drawPointsInc}{colorBbox}[black]{\def\luameshval@tpi@colorbbox{#1}}%
435 \presetkeys{drawPointsInc}{tikz=false,bbox=none,scale, meshpoint,mode=int,print=none,color,colorBbox}{}%
437 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
438 \newcommand*{\drawPointsMeshinc}[4][]{%
439 % #1 : optionnal arguments
440 % #2 : the string containing the list of points
441 % (x1,y1);(x2,y2);... or the name file containing the points
442 % #3 : the code to place before the generated one
443 % #4 : the code to place after the generated one
444 \setkeys{drawPointsInc}{#1} %
445 \def\MeshPoint{\luameshval@tpi@meshpoint}%
446 \ifKV@drawPointsInc@tikz% if we are using tikz
448 printPointsTikZinc("#2","\luaescapestring{\unexpanded{#3}}","\luaescapestring{\unexpanded{#4}}","\luameshval@tpi@mode","\luameshval@tpi@print","\luameshval@tpi@bbox","\luameshval@tpi@scale","\luameshval@tpi@color","\luameshval@tpi@colorbbox")%
450 \else % we are using MP
451 \mplibcolor{\luameshmpcolor}{\luameshval@tpi@color}%
452 \mplibcolor{\luameshmpcolorBbox}{\luameshval@tpi@colorbbox}%
454 printPointsMPinc("#2","\luaescapestring{\unexpanded{#3}}","\luaescapestring{\unexpanded{#4}}","\luameshval@tpi@mode","\luameshval@tpi@print","\luameshval@tpi@bbox","\luameshval@tpi@scale")%
459 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
460 %% the meshAddOnePointBW commande
462 \define@boolkey{MeshAddOneBW}{tikz}[true]{}%
464 \define@key{MeshAddOneBW}{scale}[1cm]{\def\luameshval@ap@scale{#1}}%
465 %% the name of the points
466 \define@key{MeshAddOneBW}{meshpoint}[P]{\def\luameshval@ap@meshpoint{#1}}%
467 %% the name of the new point
468 \define@key{MeshAddOneBW}{newpoint}[P]{\def\luameshval@ap@newpoint{#1}}%
469 %% a complete picture or some code of the engine
470 \define@choicekey*{MeshAddOneBW}{step}[\val\nr]{badtriangles, cavity, newtriangles}{%
472 \def\luameshval@ap@step{badT}%
474 \def\luameshval@ap@step{cavity}%
476 \def\luameshval@ap@step{newT}%
480 %% the color of drawing
481 \define@key{MeshAddOneBW}{color}[black]{\def\luameshval@ap@color{#1}}%
482 %% the color of background of new element
483 \define@key{MeshAddOneBW}{colorBack}[black!20]{\def\luameshval@ap@colorback{#1}}%
484 %% the color of new element
485 \define@key{MeshAddOneBW}{colorNew}[red]{\def\luameshval@ap@colornew{#1}}%
486 %% the color of circoncircle
487 \define@key{MeshAddOneBW}{colorCircle}[green]{\def\luameshval@ap@colorcircle{#1}}%
488 %% the name of the color of drawing the bbox
489 \define@key{MeshAddOneBW}{colorBbox}[black]{\def\luameshval@ap@colorbbox{#1}}%
491 %% a complete picture or some code of the engine
492 \define@choicekey*{MeshAddOneBW}{mode}[\val\nr]{int, ext}{%
494 \def\luameshval@ap@mode{int}%
496 \def\luameshval@ap@mode{ext}%
499 \define@choicekey*{MeshAddOneBW}{bbox}[\val\nr]{none, show}{%
501 \def\luameshval@ap@bbox{none}%
503 \def\luameshval@ap@bbox{bbox}%
506 \presetkeys{MeshAddOneBW}{tikz=false,scale, meshpoint,newpoint,color,colorBack,colorNew,colorCircle,step=badtriangles,mode=int,bbox=none,colorBbox}{}%
508 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
509 \newcommand*{\meshAddPointBW}[3][]{%
510 % #1 : optionnal arguments
511 % #2 : the string containing the list of points
512 % (x1,y1);(x2,y2);... or the name file containing the points
513 \setkeys{MeshAddOneBW}{#1} %
514 \def\MeshPoint{\luameshval@ap@meshpoint}%
515 \def\NewPoint{\luameshval@ap@newpoint}%
516 \ifKV@MeshAddOneBW@tikz% if we are using tikz
518 TeXOnePointTikZBW("#2","#3","\luameshval@ap@step","\luameshval@ap@scale","\luameshval@ap@mode","\luameshval@ap@bbox","\luameshval@ap@color","\luameshval@ap@colorback","\luameshval@ap@colornew","\luameshval@ap@colorcircle","\luameshval@ap@colorbbox")%
520 \else % we are using MP
521 \mplibcolor{\luameshmpcolor}{\luameshval@ap@color}
522 \mplibcolor{\luameshmpcolorBack}{\luameshval@ap@colorback}
523 \mplibcolor{\luameshmpcolorNew}{\luameshval@ap@colornew}
524 \mplibcolor{\luameshmpcolorCircle}{\luameshval@ap@colorcircle}
525 \mplibcolor{\luameshmpcolorBbox}{\luameshval@ap@colorbbox}
527 TeXOnePointMPBW("#2","#3","\luameshval@ap@step","\luameshval@ap@scale","\luameshval@ap@mode","\luameshval@ap@bbox")%
532 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
533 %%% the meshAddPointBWinc commande with callbacks
535 \define@boolkey{MeshAddOneBWinc}{tikz}[true]{}%
537 \define@key{MeshAddOneBWinc}{scale}[1cm]{\def\luameshval@api@scale{#1}}%
538 %% the name of the points
539 \define@key{MeshAddOneBWinc}{meshpoint}[P]{\def\luameshval@api@meshpoint{#1}}%
540 %% the name of the new point
541 \define@key{MeshAddOneBWinc}{newpoint}[P]{\def\luameshval@api@newpoint{#1}}%
542 %% a complete picture or some code of the engine
543 \define@choicekey*{MeshAddOneBWinc}{step}[\val\nr]{badtriangles, cavity, newtriangles}{%
545 \def\luameshval@api@step{badT}%
547 \def\luameshval@api@step{cavity}%
549 \def\luameshval@api@step{newT}%
553 %% the color of drawing
554 \define@key{MeshAddOneBWinc}{color}[black]{\def\luameshval@api@color{#1}}%
555 %% the color of background of new element
556 \define@key{MeshAddOneBWinc}{colorBack}[black!20]{\def\luameshval@api@colorback{#1}}%
557 %% the color of new element
558 \define@key{MeshAddOneBWinc}{colorNew}[red]{\def\luameshval@api@colornew{#1}}%
559 %% the color of circoncircle
560 \define@key{MeshAddOneBWinc}{colorCircle}[green]{\def\luameshval@api@colorcircle{#1}}%
561 \define@key{MeshAddOneBWinc}{colorBbox}[black]{\def\luameshval@api@colorbbox{#1}}%
563 %% a complete picture or some code of the engine
564 \define@choicekey*{MeshAddOneBWinc}{mode}[\val\nr]{int, ext}{%
566 \def\luameshval@api@mode{int}%
568 \def\luameshval@api@mode{ext}%
571 \define@choicekey*{MeshAddOneBWinc}{bbox}[\val\nr]{none, show}{%
573 \def\luameshval@api@bbox{none}%
575 \def\luameshval@api@bbox{bbox}%
578 \presetkeys{MeshAddOneBWinc}{tikz=false,scale, meshpoint,newpoint,color,colorBack,colorNew,colorCircle,step=badtriangles,mode=int,bbox=none,colorBbox}{}%
580 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
581 \newcommand*{\meshAddPointBWinc}[5][]{%
582 % #1 : optionnal arguments
583 % #2 : the string containing the list of points
584 % (x1,y1);(x2,y2);... or the name file containing the points
585 % #3 : the code to place before the generated one
586 % #4 : the code to place after the generated one
587 \setkeys{MeshAddOneBWinc}{#1} %
588 \def\MeshPoint{\luameshval@api@meshpoint}%
589 \def\NewPoint{\luameshval@api@newpoint}%
590 \ifKV@MeshAddOneBWinc@tikz% if we are using tikz
592 TeXOnePointTikZBWinc("#2","#3","\luaescapestring{\unexpanded{#4}}","\luaescapestring{\unexpanded{#5}}","\luameshval@ap@step","\luameshval@ap@scale","\luameshval@ap@mode","\luameshval@ap@bbox","\luameshval@ap@color","\luameshval@ap@colorback","\luameshval@ap@colornew","\luameshval@ap@colorcircle","\luameshval@ap@colorbbox")%
594 \else % we are using MP
595 \mplibcolor{\luameshmpcolor}{\luameshval@api@color}
596 \mplibcolor{\luameshmpcolorBack}{\luameshval@api@colorback}
597 \mplibcolor{\luameshmpcolorNew}{\luameshval@api@colornew}
598 \mplibcolor{\luameshmpcolorCircle}{\luameshval@api@colorcircle}
599 \mplibcolor{\luameshmpcolorBbox}{\luameshval@api@colorbbox}
601 TeXOnePointMPBWinc("#2","#3","\luaescapestring{\unexpanded{#4}}","\luaescapestring{\unexpanded{#5}}","\luameshval@api@step","\luameshval@api@scale","\luameshval@api@mode","\luameshval@api@bbox")%
607 %%%%%%%%%%%%%%%% the drawGmsh command inc
608 %% the user can write code (tikz or MP)
609 %% before and after the generated code
610 \define@boolkey{drawGmshInc}{tikz}[true]{}%
612 \define@key{drawGmshInc}{scale}[1cm]{\def\luameshvaldgi@scale{#1}}%
614 \define@choicekey*{drawGmshInc}{print}[\val\nr]{none, points}{%
616 \def\luameshvaldgi@print{none}%
618 \def\luameshvaldgi@print{points}%
621 %% the name of the point
622 \define@key{drawGmshInc}{meshpoint}[P]{\def\luameshvaldgi@meshpoint{#1}}%
623 %% the name of the color of drawing
624 \define@key{drawGmshInc}{color}[black]{\def\luameshvaldgi@color{#1}}%
626 \presetkeys{drawGmshInc}{tikz=false,scale, meshpoint,print=none,color}{}%
628 \newcommand*{\drawGmshinc}[4][]{%
629 % #1 : optionnal arguments
630 % #2 : the string containing the gmsh file
631 % #3 : the code to place before the generated one
632 % #4 : the code to place after the generated one
633 \setkeys{drawGmshInc}{#1} %
634 \def\MeshPoint{\luameshvaldgi@meshpoint}%
635 \ifKV@drawGmshInc@tikz% if we are using tikz
637 drawGmshTikZinc("#2","\luaescapestring{\unexpanded{#3}}","\luaescapestring{\unexpanded{#4}}","\luameshvaldgi@print","\luameshvaldgi@scale","\luameshvaldgi@color")%
639 \else % we are using MP
640 \mplibcolor{\luameshmpcolor}{\luameshvaldgi@color}%
642 drawGmshMPinc("#2","\luaescapestring{\unexpanded{#3}}","\luaescapestring{\unexpanded{#4}}","\luameshvaldgi@print","\luameshvaldgi@scale")%
648 %%%%%%%%%%%%%%%% the drawGmshBW command
649 %% the code is complete and we don't have any callbacks
650 \define@boolkey{drawGmsh}{tikz}[true]{}%
652 \define@key{drawGmsh}{scale}[1cm]{\def\luameshvaldg@scale{#1}}%
654 \define@choicekey*{drawGmsh}{print}[\val\nr]{none, points}{%
656 \def\luameshvaldg@print{none}%
658 \def\luameshvaldg@print{points}%
661 %% the name of the point
662 \define@key{drawGmsh}{meshpoint}[P]{\def\luameshvaldg@meshpoint{#1}}%
663 %% the name of the color of drawing
664 \define@key{drawGmsh}{color}[black]{\def\luameshvaldg@color{#1}}%
666 \presetkeys{drawGmsh}{tikz=false,scale, meshpoint,print=none,color}{}%
668 \newcommand{\drawGmsh}[2][]{%
669 % #1 : optionnal arguments
671 \setkeys{drawGmsh}{#1} %
672 \def\MeshPoint{\luameshvaldg@meshpoint}%
673 \ifKV@drawGmsh@tikz% if we are using tikz
675 drawGmshTikZ("#2","\luameshvaldg@print","\luameshvaldg@scale","\luameshvaldg@color")%
677 \else % we are using MP
678 \mplibcolor{\luameshmpcolor}{\luameshvaldg@color}%
680 drawGmshMP("#2","\luameshvaldg@print","\luameshvaldg@scale")%
685 %%%%%%%%%%%%%%%% the gmshVoronoi command
686 %% the user can write code (tikz or MP)
687 %% before and after the generated code
688 \define@boolkey{gmshVoronoiInc}{tikz}[true]{}%
690 \define@key{gmshVoronoiInc}{scale}[1cm]{\def\luameshval@gvi@scale{#1}}%
692 \define@choicekey*{gmshVoronoiInc}{print}[\val\nr]{none, points}{%
694 \def\luameshval@gvi@print{none}%
696 \def\luameshval@gvi@print{points}%
699 %% the name of the point
700 \define@key{gmshVoronoiInc}{meshpoint}[P]{\def\luameshval@gvi@meshpoint{#1}}%
701 %% the name of the circum point
702 \define@key{gmshVoronoiInc}{circumpoint}[P]{\def\luameshval@gvi@circumpoint{#1}}%
703 %% the mode for reading the points
704 \define@choicekey*{gmshVoronoiInc}{delaunay}[\val\nr]{none, show}{%
706 \def\luameshval@gvi@delaunay{none}%
708 \def\luameshval@gvi@delaunay{show}%
711 %% style dashed Delaunay
712 \define@choicekey*{gmshVoronoiInc}{styleDelaunay}[\val\nr]{none, dashed}{%
714 \def\luameshval@gvi@styleDelaunay{none}%
716 \def\luameshval@gvi@styleDelaunay{dashed}%
719 %% style dashed Voronoi
720 \define@choicekey*{gmshVoronoiInc}{styleVoronoi}[\val\nr]{none, dashed}{%
722 \def\luameshval@gvi@styleVoronoi{none}%
724 \def\luameshval@gvi@styleVoronoi{dashed}%
727 %% the name of the color of drawing
728 \define@key{gmshVoronoiInc}{color}[black]{\def\luameshval@gvi@color{#1}}%
729 %% the name of the color of drawing Voronoi
730 \define@key{gmshVoronoiInc}{colorVoronoi}[red]{\def\luameshval@gvi@colorvoronoi{#1}}%
732 \presetkeys{gmshVoronoiInc}{tikz=false,scale,
733 meshpoint,circumpoint,print=none,color,colorVoronoi,delaunay=none,styleVoronoi=none, styleDelaunay=none}{}%
735 \newcommand*{\gmshVoronoiinc}[4][]{%
736 % #1 : optionnal arguments
738 % #3 : the code to place before the generated one
739 % #4 : the code to place after the generated one
740 \setkeys{gmshVoronoiInc}{#1} %
741 \def\MeshPoint{\luameshval@gvi@meshpoint}%
742 \def\CircumPoint{\luameshval@gvi@circumpoint}%
743 \ifKV@gmshVoronoiInc@tikz% if we are using tikz
745 gmshVoronoiTikZinc("#2","\luaescapestring{\unexpanded{#3}}","\luaescapestring{\unexpanded{#4}}","\luameshval@gvi@print","\luameshval@gvi@scale","\luameshval@gvi@delaunay","\luameshval@gvi@color","\luameshval@gvi@colorvoronoi","\luameshval@gvi@styleDelaunay","\luameshval@gvi@styleVoronoi")%
747 \else % we are using MP
748 \mplibcolor{\luameshmpcolor}{\luameshval@gvi@color}%
749 \mplibcolor{\luameshmpcolorVoronoi}{\luameshval@gvi@colorvoronoi}%
751 gmshVoronoiMPinc("#2","\luaescapestring{\unexpanded{#3}}","\luaescapestring{\unexpanded{#4}}","\luameshval@gvi@print","\luameshval@gvi@scale","\luameshval@gvi@delaunay","\luameshval@gvi@styleDelaunay","\luameshval@gvi@styleVoronoi")%
757 %%%%%%%%%%%%%%%% the gmshVoronoiBW command
758 %% the code is complete and we don't have any callbacks
759 \define@boolkey{gmshVoronoi}{tikz}[true]{}%
761 \define@key{gmshVoronoi}{scale}[1cm]{\def\luameshval@gv@scale{#1}}%
763 \define@choicekey*{gmshVoronoi}{print}[\val\nr]{none, points}{%
765 \def\luameshval@gv@print{none}%
767 \def\luameshval@gv@print{points}%
770 %% the name of the point
771 \define@key{gmshVoronoi}{meshpoint}[P]{\def\luameshval@gv@meshpoint{#1}}%
772 %% the name of the circum point
773 \define@key{gmshVoronoi}{circumpoint}[P]{\def\luameshval@gv@circumpoint{#1}}%
774 %% the mode for reading the points
775 \define@choicekey*{gmshVoronoi}{delaunay}[\val\nr]{none, show}{%
777 \def\luameshval@gv@delaunay{none}%
779 \def\luameshval@gv@delaunay{show}%
782 %% style dashed Delaunay
783 \define@choicekey*{gmshVoronoi}{styleDelaunay}[\val\nr]{none, dashed}{%
785 \def\luameshval@gv@styleDelaunay{none}%
787 \def\luameshval@gv@styleDelaunay{dashed}%
790 %% style dashed Voronoi
791 \define@choicekey*{gmshVoronoi}{styleVoronoi}[\val\nr]{none, dashed}{%
793 \def\luameshval@gv@styleVoronoi{none}%
795 \def\luameshval@gv@styleVoronoi{dashed}%
798 %% the name of the color of drawing
799 \define@key{gmshVoronoi}{color}[black]{\def\luameshval@gv@color{#1}}%
800 %% the name of the color of drawing Voronoi
801 \define@key{gmshVoronoi}{colorVoronoi}[red]{\def\luameshval@gv@colorVoronoi{#1}}%
803 \presetkeys{gmshVoronoi}{tikz=false,scale, meshpoint,circumpoint,print=none,color,colorVoronoi,delaunay=none,styleVoronoi=none, styleDelaunay=none}{}%
805 \newcommand{\gmshVoronoi}[2][]{%
806 % #1 : optionnal arguments
808 \setkeys{gmshVoronoi}{#1} %
809 \def\MeshPoint{\luameshval@gv@meshpoint}%
810 \def\CircumPoint{\luameshval@gv@circumpoint}%
811 \ifKV@gmshVoronoi@tikz% if we are using tikz
813 gmshVoronoiTikZ("#2","\luameshval@gv@print","\luameshval@gv@scale","\luameshval@gv@delaunay","\luameshval@gv@color","\luameshval@gv@colorVoronoi","\luameshval@gv@styleDelaunay","\luameshval@gv@styleVoronoi")%
815 \else % we are using MP
816 \mplibcolor{\luameshmpcolor}{\luameshval@gv@color}%
817 \mplibcolor{\luameshmpcolorVoronoi}{\luameshval@gv@colorVoronoi}%
819 gmshVoronoiMP("#2","\luameshval@gv@print","\luameshval@gv@scale","\luameshval@gv@delaunay","\luameshval@gv@styleDelaunay","\luameshval@gv@styleVoronoi")%