+ \def\MeshPoint{\luameshval@api@meshpoint}%
+ \def\NewPoint{\luameshval@api@newpoint}%
+ \ifKV@MeshAddOneBWinc@tikz% if we are using tikz
+ \directlua{%
+ 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")%
+ }%
+ \else % we are using MP
+ \mplibcolor{\luameshmpcolor}{\luameshval@api@color}
+ \mplibcolor{\luameshmpcolorBack}{\luameshval@api@colorback}
+ \mplibcolor{\luameshmpcolorNew}{\luameshval@api@colornew}
+ \mplibcolor{\luameshmpcolorCircle}{\luameshval@api@colorcircle}
+ \mplibcolor{\luameshmpcolorBbox}{\luameshval@api@colorbbox}
+ \directlua{%
+ TeXOnePointMPBWinc("#2","#3","\luaescapestring{\unexpanded{#4}}","\luaescapestring{\unexpanded{#5}}","\luameshval@api@step","\luameshval@api@scale","\luameshval@api@mode","\luameshval@api@bbox")%
+ }%
+ %
+ \fi%
+}%
+%
+%%%%%%%%%%%%%%%% the drawGmsh command inc
+%% the user can write code (tikz or MP)
+%% before and after the generated code
+\define@boolkey{drawGmshInc}{tikz}[true]{}%
+%% the scale
+\define@key{drawGmshInc}{scale}[1cm]{\def\luameshvaldgi@scale{#1}}%
+%% print ponits ?
+\define@choicekey*{drawGmshInc}{print}[\val\nr]{none, points}{%
+ \ifcase\nr\relax%
+ \def\luameshvaldgi@print{none}%
+ \or%
+ \def\luameshvaldgi@print{points}%
+ \fi%
+}%
+%% the name of the point
+\define@key{drawGmshInc}{meshpoint}[P]{\def\luameshvaldgi@meshpoint{#1}}%
+%% the name of the color of drawing
+\define@key{drawGmshInc}{color}[black]{\def\luameshvaldgi@color{#1}}%
+%
+\presetkeys{drawGmshInc}{tikz=false,scale, meshpoint,print=none,color}{}%
+%
+\newcommand*{\drawGmshinc}[4][]{%
+ % #1 : optionnal arguments
+ % #2 : the string containing the gmsh file
+ % #3 : the code to place before the generated one
+ % #4 : the code to place after the generated one
+ \setkeys{drawGmshInc}{#1} %
+ \def\MeshPoint{\luameshvaldgi@meshpoint}%
+ \ifKV@drawGmshInc@tikz% if we are using tikz
+ \directlua{%
+ drawGmshTikZinc("#2","\luaescapestring{\unexpanded{#3}}","\luaescapestring{\unexpanded{#4}}","\luameshvaldgi@print","\luameshvaldgi@scale","\luameshvaldgi@color")%
+ }%
+ \else % we are using MP
+ \mplibcolor{\luameshmpcolor}{\luameshvaldgi@color}%
+ \directlua{%
+ drawGmshMPinc("#2","\luaescapestring{\unexpanded{#3}}","\luaescapestring{\unexpanded{#4}}","\luameshvaldgi@print","\luameshvaldgi@scale")%
+ }%
+ %
+ \fi%
+}%
+%
+%%%%%%%%%%%%%%%% the drawGmshBW command
+%% the code is complete and we don't have any callbacks
+\define@boolkey{drawGmsh}{tikz}[true]{}%
+%% the scale
+\define@key{drawGmsh}{scale}[1cm]{\def\luameshvaldg@scale{#1}}%
+%% print points
+\define@choicekey*{drawGmsh}{print}[\val\nr]{none, points}{%
+ \ifcase\nr\relax%
+ \def\luameshvaldg@print{none}%
+ \or%
+ \def\luameshvaldg@print{points}%
+ \fi%
+}%
+%% the name of the point
+\define@key{drawGmsh}{meshpoint}[P]{\def\luameshvaldg@meshpoint{#1}}%
+%% the name of the color of drawing
+\define@key{drawGmsh}{color}[black]{\def\luameshvaldg@color{#1}}%
+%
+\presetkeys{drawGmsh}{tikz=false,scale, meshpoint,print=none,color}{}%
+%
+\newcommand{\drawGmsh}[2][]{%
+ % #1 : optionnal arguments
+ % #2 : the gmsh file
+ \setkeys{drawGmsh}{#1} %
+ \def\MeshPoint{\luameshvaldg@meshpoint}%
+ \ifKV@drawGmsh@tikz% if we are using tikz
+ \directlua{%
+ drawGmshTikZ("#2","\luameshvaldg@print","\luameshvaldg@scale","\luameshvaldg@color")%
+ }%
+ \else % we are using MP
+ \mplibcolor{\luameshmpcolor}{\luameshvaldg@color}%
+ \directlua{%
+ drawGmshMP("#2","\luameshvaldg@print","\luameshvaldg@scale")%
+ }%
+ %
+ \fi%
+}%
+%%%%%%%%%%%%%%%% the gmshVoronoi command
+%% the user can write code (tikz or MP)
+%% before and after the generated code
+\define@boolkey{gmshVoronoiInc}{tikz}[true]{}%
+%% the scale
+\define@key{gmshVoronoiInc}{scale}[1cm]{\def\luameshval@gvi@scale{#1}}%
+%% print ponits ?
+\define@choicekey*{gmshVoronoiInc}{print}[\val\nr]{none, points}{%
+ \ifcase\nr\relax%
+ \def\luameshval@gvi@print{none}%
+ \or%
+ \def\luameshval@gvi@print{points}%
+ \fi%
+}%
+%% the name of the point
+\define@key{gmshVoronoiInc}{meshpoint}[P]{\def\luameshval@gvi@meshpoint{#1}}%
+%% the name of the circum point
+\define@key{gmshVoronoiInc}{circumpoint}[P]{\def\luameshval@gvi@circumpoint{#1}}%
+%% the mode for reading the points
+\define@choicekey*{gmshVoronoiInc}{delaunay}[\val\nr]{none, show}{%
+ \ifcase\nr\relax%
+ \def\luameshval@gvi@delaunay{none}%
+ \or%
+ \def\luameshval@gvi@delaunay{show}%
+ \fi%
+}%
+%% style dashed Delaunay
+\define@choicekey*{gmshVoronoiInc}{styleDelaunay}[\val\nr]{none, dashed}{%
+ \ifcase\nr\relax%
+ \def\luameshval@gvi@styleDelaunay{none}%
+ \or%
+ \def\luameshval@gvi@styleDelaunay{dashed}%
+ \fi%
+}%
+%% style dashed Voronoi
+\define@choicekey*{gmshVoronoiInc}{styleVoronoi}[\val\nr]{none, dashed}{%
+ \ifcase\nr\relax%
+ \def\luameshval@gvi@styleVoronoi{none}%
+ \or%
+ \def\luameshval@gvi@styleVoronoi{dashed}%
+ \fi%
+}%
+%% the name of the color of drawing
+\define@key{gmshVoronoiInc}{color}[black]{\def\luameshval@gvi@color{#1}}%
+%% the name of the color of drawing Voronoi
+\define@key{gmshVoronoiInc}{colorVoronoi}[red]{\def\luameshval@gvi@colorvoronoi{#1}}%
+%
+\presetkeys{gmshVoronoiInc}{tikz=false,scale,
+ meshpoint,circumpoint,print=none,color,colorVoronoi,delaunay=none,styleVoronoi=none, styleDelaunay=none}{}%
+%
+\newcommand*{\gmshVoronoiinc}[4][]{%
+ % #1 : optionnal arguments
+ % #2 : the gmsh file
+ % #3 : the code to place before the generated one
+ % #4 : the code to place after the generated one
+ \setkeys{gmshVoronoiInc}{#1} %
+ \def\MeshPoint{\luameshval@gvi@meshpoint}%
+ \def\CircumPoint{\luameshval@gvi@circumpoint}%
+ \ifKV@gmshVoronoiInc@tikz% if we are using tikz
+ \directlua{%
+ 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")%
+ }%
+ \else % we are using MP
+ \mplibcolor{\luameshmpcolor}{\luameshval@gvi@color}%
+ \mplibcolor{\luameshmpcolorVoronoi}{\luameshval@gvi@colorvoronoi}%
+ \directlua{%
+ gmshVoronoiMPinc("#2","\luaescapestring{\unexpanded{#3}}","\luaescapestring{\unexpanded{#4}}","\luameshval@gvi@print","\luameshval@gvi@scale","\luameshval@gvi@delaunay","\luameshval@gvi@styleDelaunay","\luameshval@gvi@styleVoronoi")%
+ }%
+ %
+ \fi%
+}%
+%
+%%%%%%%%%%%%%%%% the gmshVoronoiBW command
+%% the code is complete and we don't have any callbacks
+\define@boolkey{gmshVoronoi}{tikz}[true]{}%
+%% the scale
+\define@key{gmshVoronoi}{scale}[1cm]{\def\luameshval@gv@scale{#1}}%
+%% print points
+\define@choicekey*{gmshVoronoi}{print}[\val\nr]{none, points}{%
+ \ifcase\nr\relax%
+ \def\luameshval@gv@print{none}%
+ \or%
+ \def\luameshval@gv@print{points}%
+ \fi%
+}%
+%% the name of the point
+\define@key{gmshVoronoi}{meshpoint}[P]{\def\luameshval@gv@meshpoint{#1}}%
+%% the name of the circum point
+\define@key{gmshVoronoi}{circumpoint}[P]{\def\luameshval@gv@circumpoint{#1}}%
+%% the mode for reading the points
+\define@choicekey*{gmshVoronoi}{delaunay}[\val\nr]{none, show}{%
+ \ifcase\nr\relax%
+ \def\luameshval@gv@delaunay{none}%
+ \or%
+ \def\luameshval@gv@delaunay{show}%
+ \fi%
+}%
+%% style dashed Delaunay
+\define@choicekey*{gmshVoronoi}{styleDelaunay}[\val\nr]{none, dashed}{%
+ \ifcase\nr\relax%
+ \def\luameshval@gv@styleDelaunay{none}%
+ \or%
+ \def\luameshval@gv@styleDelaunay{dashed}%
+ \fi%
+}%
+%% style dashed Voronoi
+\define@choicekey*{gmshVoronoi}{styleVoronoi}[\val\nr]{none, dashed}{%
+ \ifcase\nr\relax%
+ \def\luameshval@gv@styleVoronoi{none}%
+ \or%
+ \def\luameshval@gv@styleVoronoi{dashed}%
+ \fi%
+}%
+%% the name of the color of drawing
+\define@key{gmshVoronoi}{color}[black]{\def\luameshval@gv@color{#1}}%
+%% the name of the color of drawing Voronoi
+\define@key{gmshVoronoi}{colorVoronoi}[red]{\def\luameshval@gv@colorVoronoi{#1}}%
+%
+\presetkeys{gmshVoronoi}{tikz=false,scale, meshpoint,circumpoint,print=none,color,colorVoronoi,delaunay=none,styleVoronoi=none, styleDelaunay=none}{}%
+%
+\newcommand{\gmshVoronoi}[2][]{%
+ % #1 : optionnal arguments
+ % #2 : the gmsh file
+ \setkeys{gmshVoronoi}{#1} %
+ \def\MeshPoint{\luameshval@gv@meshpoint}%
+ \def\CircumPoint{\luameshval@gv@circumpoint}%
+ \ifKV@gmshVoronoi@tikz% if we are using tikz
+ \directlua{%
+ gmshVoronoiTikZ("#2","\luameshval@gv@print","\luameshval@gv@scale","\luameshval@gv@delaunay","\luameshval@gv@color","\luameshval@gv@colorVoronoi","\luameshval@gv@styleDelaunay","\luameshval@gv@styleVoronoi")%
+ }%
+ \else % we are using MP
+ \mplibcolor{\luameshmpcolor}{\luameshval@gv@color}%
+ \mplibcolor{\luameshmpcolorVoronoi}{\luameshval@gv@colorVoronoi}%
+ \directlua{%
+ gmshVoronoiMP("#2","\luameshval@gv@print","\luameshval@gv@scale","\luameshval@gv@delaunay","\luameshval@gv@styleDelaunay","\luameshval@gv@styleVoronoi")%
+ }%
+ %
+ \fi%
+}%
+%
+%
+%
+%%%%%%%%%%%%%%%% the meshPolygon command
+%%
+\define@boolkey{meshPolygon}{tikz}[true]{}%
+
+%% the scale
+\define@key{meshPolygon}{scale}[1cm]{\def\luameshval@mp@scale{#1}}%
+%% print points
+\define@choicekey*{meshPolygon}{print}[\val\nr]{none, points,dotpoints}{%
+ \ifcase\nr\relax%
+ \def\luameshval@mp@print{none}%
+ \or%
+ \def\luameshval@mp@print{points}%
+ \or%
+ \def\luameshval@mp@print{dotpoints}%
+ \fi%
+}%
+%% the name of the point
+\define@key{meshPolygon}{meshpoint}[P]{\def\luameshval@mp@meshpoint{#1}}%
+%% the grid parameter
+\define@key{meshPolygon}{h}[0.2]{\def\luameshval@mp@h{#1}}%
+%% the mode for reading the points
+\define@choicekey*{meshPolygon}{mode}[\val\nr]{int, ext}{%
+ \ifcase\nr\relax%
+ \def\luameshval@mp@mode{int}%
+ \or%
+ \def\luameshval@mp@mode{ext}%
+ \fi%
+}%
+%% the mode for the generation of gridpoints
+\define@choicekey*{meshPolygon}{gridpoints}[\val\nr]{rect, perturb}{%
+ \ifcase\nr\relax%
+ \def\luameshval@mp@gridpoints{rect}%
+ \or%
+ \def\luameshval@mp@gridpoints{perturb}%
+ \fi%
+}%
+%% the different steps of the meshing
+\define@choicekey*{meshPolygon}{step}[\val\nr]{polygon, grid, points, mesh}{%
+ \ifcase\nr\relax%
+ \def\luameshval@mp@step{polygon}%
+ \or%
+ \def\luameshval@mp@step{grid}%
+ \or%
+ \def\luameshval@mp@step{points}%
+ \or%
+ \def\luameshval@mp@step{mesh}%
+ \fi%
+}%
+
+%% the name of the color of drawing
+\define@key{meshPolygon}{color}[black]{\def\luameshval@mp@color{#1}}%
+%% the name of the color of drawing Voronoi
+\define@key{meshPolygon}{colorPolygon}[red]{\def\luameshval@mp@colorPolygon{#1}}%
+%% the name of the color of drawing the bbox
+%
+\presetkeys{meshPolygon}{tikz=false,scale,mode=int,step=mesh,print=none,color,colorPolygon,h,meshpoint,gridpoints=rect}{}%
+%
+\newcommand{\meshPolygon}[2][]{%
+ % #1 : optionnal arguments
+ % #2 : the string containing the list of points
+ % (x1,y1);(x2,y2);... or the name file containing the points
+ \setkeys{meshPolygon}{#1} %
+ \def\MeshPoint{\luameshval@mp@meshpoint}%
+ \ifKV@meshPolygon@tikz% if we are using tikz
+ \directlua{%
+ drawMeshPolygonTikZ("#2","\luameshval@mp@mode","\luameshval@mp@h","\luameshval@mp@step","\luameshval@mp@print","\luameshval@mp@scale","\luameshval@mp@color","\luameshval@mp@colorPolygon","\luameshval@mp@gridpoints")%
+ }%
+ \else % we are using MP
+ \mplibcolor{\luameshmpcolor}{\luameshval@mp@color}%
+ \mplibcolor{\luameshmpcolorPoly}{\luameshval@mp@colorPolygon}%
+ \directlua{%
+ drawMeshPolygonMP("#2","\luameshval@mp@mode","\luameshval@mp@h","\luameshval@mp@step","\luameshval@mp@print","\luameshval@mp@scale","\luameshval@mp@gridpoints")%
+ }%
+ %
+ \fi%
+}%
+%%%%%%%%%%%%%%%% the meshPolygonInc command
+%%
+\define@boolkey{meshPolygonInc}{tikz}[true]{}%
+
+%% the scale
+\define@key{meshPolygonInc}{scale}[1cm]{\def\luameshval@mpi@scale{#1}}%
+%% print points
+\define@choicekey*{meshPolygonInc}{print}[\val\nr]{none, points,dotpoints}{%
+ \ifcase\nr\relax%
+ \def\luameshval@mpi@print{none}%
+ \or%
+ \def\luameshval@mpi@print{points}%
+ \or%
+ \def\luameshval@mpi@print{dotpoints}%
+ \fi%
+}%
+%% the mode for the generation of gridpoints
+\define@choicekey*{meshPolygonInc}{gridpoints}[\val\nr]{rect, perturb}{%
+ \ifcase\nr\relax%
+ \def\luameshval@mpi@gridpoints{rect}%
+ \or%
+ \def\luameshval@mpi@gridpoints{perturb}%
+ \fi%
+}%
+%% the name of the point
+\define@key{meshPolygonInc}{meshpoint}[P]{\def\luameshval@mpi@meshpoint{#1}}%
+%% the grid parameter
+\define@key{meshPolygonInc}{h}[0.2]{\def\luameshval@mpi@h{#1}}%
+%% the mode for reading the points
+\define@choicekey*{meshPolygonInc}{mode}[\val\nr]{int, ext}{%
+ \ifcase\nr\relax%
+ \def\luameshval@mpi@mode{int}%
+ \or%
+ \def\luameshval@mpi@mode{ext}%
+ \fi%
+}%
+%% the different steps of the meshing
+\define@choicekey*{meshPolygonInc}{step}[\val\nr]{polygon, grid, points, mesh}{%
+ \ifcase\nr\relax%
+ \def\luameshval@mpi@step{polygon}%
+ \or%
+ \def\luameshval@mpi@step{grid}%
+ \or%
+ \def\luameshval@mpi@step{points}%
+ \or%
+ \def\luameshval@mpi@step{mesh}%
+ \fi%
+}%
+
+%% the name of the color of drawing
+\define@key{meshPolygonInc}{color}[black]{\def\luameshval@mpi@color{#1}}%
+%% the name of the color of drawing Voronoi
+\define@key{meshPolygonInc}{colorPolygon}[red]{\def\luameshval@mpi@colorPolygon{#1}}%
+%% the name of the color of drawing the bbox
+%
+\presetkeys{meshPolygonInc}{tikz=false,scale,mode=int,step=mesh,print=none,color,colorPolygon,h,meshpoint,gridpoints=rect}{}%
+%
+\newcommand{\meshPolygonInc}[4][]{%
+ % #1 : optionnal arguments
+ % #2 : the string containing the list of points
+ % (x1,y1);(x2,y2);... or the name file containing the points
+ % #3 : the code to place before the generated one
+ % #4 : the code to place after the generated one
+ \setkeys{meshPolygonInc}{#1} %
+ \def\MeshPoint{\luameshval@mpi@meshpoint}%
+ \ifKV@meshPolygonInc@tikz% if we are using tikz