X-Git-Url: https://melusine.eu.org/syracuse/G/git/?p=delaunay.git;a=blobdiff_plain;f=luamesh.sty;fp=luamesh.sty;h=1b045803fce96566c49ae493fa76657737416aee;hp=14bc1b1e7671f397eddb77445abb00105186cb20;hb=581ccb9539f0af81056af73d3354fd895f1d7d55;hpb=de12f6c65e1e5533bf5971313ba6d0dced4a5666 diff --git a/luamesh.sty b/luamesh.sty index 14bc1b1..1b04580 100644 --- a/luamesh.sty +++ b/luamesh.sty @@ -35,7 +35,7 @@ \definecolor{TeXCluaMeshCircleTikZ}{rgb}{0.1,0.6,0.1} %% % -%%%%%%%%%%%%%%%% the buildMesh command +%%%%%%%%%%%%%%%% the buildMesh command inc %% the user can write code (tikz or MP) %% before and after the generated code \define@boolkey{buildMeshInc}{tikz}[true]{}% @@ -570,4 +570,188 @@ % \fi% }% -% \ No newline at end of file +% +%%%%%%%%%%%%%%%% 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% +}% +%% 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}{}% +% +\newcommand*{\gmshVoronoiBWinc}[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")% + }% + \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")% + }% + % + \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% +}% +%% 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}{}% +% +\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")% + }% + \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")% + }% + % + \fi% +}%