X-Git-Url: https://melusine.eu.org/syracuse/G/git/?a=blobdiff_plain;f=luamesh.sty;h=1b045803fce96566c49ae493fa76657737416aee;hb=b8c8621a9a46ea7e87e0684988471eee782c9368;hp=de6d9e7214e673172d30fc55175a9975403c714d;hpb=a00e38bda1dd258080ec6a649d61b1f577ccb71a;p=delaunay.git diff --git a/luamesh.sty b/luamesh.sty index de6d9e7..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]{}% @@ -177,6 +177,8 @@ }% %% the name of the point \define@key{buildVoronoiInc}{meshpoint}[P]{\def\luameshval@bvi@meshpoint{#1}}% +%% the name of the circum point +\define@key{buildVoronoiInc}{circumpoint}[P]{\def\luameshval@bvi@circumpoint{#1}}% %% the mode for reading the points \define@choicekey*{buildVoronoiInc}{mode}[\val\nr]{int, ext}{% \ifcase\nr\relax% @@ -185,12 +187,22 @@ \def\luameshval@bvi@mode{ext}% \fi% }% +%% the mode for reading the points +\define@choicekey*{buildVoronoiInc}{delaunay}[\val\nr]{none, show}{% + \ifcase\nr\relax% + \def\luameshval@bvi@delaunay{none}% + \or% + \def\luameshval@bvi@delaunay{show}% + \fi% +}% %% the name of the color of drawing \define@key{buildVoronoiInc}{color}[black]{\def\luameshval@bvi@color{#1}}% +%% the name of the color of drawing Voronoi +\define@key{buildVoronoiInc}{colorVoronoi}[red]{\def\luameshval@bvi@colorvoronoi{#1}}% %% the name of the color of drawing the bbox \define@key{buildVoronoiInc}{colorBbox}[black]{\def\luameshval@bvi@colorbbox{#1}}% % -\presetkeys{buildVoronoiInc}{tikz=false,bbox=none,scale, meshpoint,mode=int,print=none,color,colorBbox}{}% +\presetkeys{buildVoronoiInc}{tikz=false,bbox=none,scale, meshpoint,circumpoint,mode=int,print=none,color,colorVoronoi,colorBbox,delaunay=none}{}% % \newcommand*{\buildVoronoiBWinc}[4][]{% % #1 : optionnal arguments @@ -200,15 +212,17 @@ % #4 : the code to place after the generated one \setkeys{buildVoronoiInc}{#1} % \def\MeshPoint{\luameshval@bvi@meshpoint}% + \def\CircumPoint{\luameshval@bvi@circumpoint}% \ifKV@buildVoronoiInc@tikz% if we are using tikz \directlua{% - buildVoronoiTikZBWinc("#2","\luaescapestring{\unexpanded{#3}}","\luaescapestring{\unexpanded{#4}}","\luameshval@bvi@mode","\luameshval@bvi@print","\luameshval@bvi@bbox","\luameshval@bvi@scale","\luameshval@bvi@color","\luameshval@bvi@colorbbox")% + 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")% }% \else % we are using MP \mplibcolor{\luameshmpcolor}{\luameshval@bvi@color}% \mplibcolor{\luameshmpcolorBbox}{\luameshval@bvi@colorbbox}% + \mplibcolor{\luameshmpcolorVoronoi}{\luameshval@bvi@colorvoronoi}% \directlua{% - buildVoronoiMPBWinc("#2","\luaescapestring{\unexpanded{#3}}","\luaescapestring{\unexpanded{#4}}","\luameshval@bvi@mode","\luameshval@bvi@print","\luameshval@bvi@bbox","\luameshval@bvi@scale")% + buildVoronoiMPBWinc("#2","\luaescapestring{\unexpanded{#3}}","\luaescapestring{\unexpanded{#4}}","\luameshval@bvi@mode","\luameshval@bvi@print","\luameshval@bvi@bbox","\luameshval@bvi@scale","\luameshval@bvi@delaunay")% }% % \fi% @@ -273,7 +287,7 @@ \def\CircumPoint{\luameshval@bv@circumpoint}% \ifKV@buildVoronoi@tikz% if we are using tikz \directlua{% - buildVoronoiTikZBW("#2","\luameshval@bv@mode","\luameshval@bv@print","\luameshval@bv@bbox","\luameshval@bv@scale","\luameshval@bv@color","\luameshval@bv@colorbbox")% + 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")% }% \else % we are using MP \mplibcolor{\luameshmpcolor}{\luameshval@bv@color}% @@ -556,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% +}%