X-Git-Url: https://melusine.eu.org/syracuse/G/git/?a=blobdiff_plain;f=luamesh.sty;h=14bc1b1e7671f397eddb77445abb00105186cb20;hb=93a6d2fd77327d5abb1ee4a8324e5d0f79f29927;hp=ccb1863f0910dbf57eb9abb87a7b54104be39def;hpb=ce88841e4c39f70da4603909378967a0fd5c48ae;p=delaunay.git diff --git a/luamesh.sty b/luamesh.sty index ccb1863..14bc1b1 100644 --- a/luamesh.sty +++ b/luamesh.sty @@ -11,7 +11,7 @@ %\define@key{luamesh.sty}{mp}[]{\luameshmptrue}% %\define@key{luamesh.sty}{tikz}[]{\luameshmpfalse}% % -\RequirePackage{etoolbox} % pour robustifier les commandes +%\RequirePackage{etoolbox} % pour robustifier les commandes % % %\ifluameshmp% @@ -21,7 +21,7 @@ %\fi% % % load the lua code -\directlua{dofile("luamesh.lua")}% +\directlua{require("luamesh.lua")}% % %% % for tikz (default value) @@ -33,73 +33,71 @@ \definecolor{TeXCluaMeshBackTikZ}{rgb}{0.99,0.85,0.85} % default color for circoncircle \definecolor{TeXCluaMeshCircleTikZ}{rgb}{0.1,0.6,0.1} - - +%% +% %%%%%%%%%%%%%%%% the buildMesh command -%% engine of drawing -\newif\ifluameshengineMP% +%% the user can write code (tikz or MP) +%% before and after the generated code \define@boolkey{buildMeshInc}{tikz}[true]{}% %% show the bounding box for delaunay \define@choicekey*{buildMeshInc}{bbox}[\val\nr]{none, show}{% \ifcase\nr\relax% - \def\luameshval@bm@bbox{none}% + \def\luameshval@bmi@bbox{none}% \or% - \def\luameshval@bm@bbox{bbox}% + \def\luameshval@bmi@bbox{bbox}% \fi% }% %% the scale -\define@key{buildMeshInc}{scale}[1cm]{\def\luameshval@bm@scale{#1}}% +\define@key{buildMeshInc}{scale}[1cm]{\def\luameshval@bmi@scale{#1}}% %% print ponits ? \define@choicekey*{buildMeshInc}{print}[\val\nr]{none, points}{% \ifcase\nr\relax% - \def\luameshval@bm@print{none}% + \def\luameshval@bmi@print{none}% \or% - \def\luameshval@bm@print{points}% + \def\luameshval@bmi@print{points}% \fi% }% %% the name of the point -\define@key{buildMeshInc}{meshpoint}[P]{\def\luameshval@bm@meshpoint{#1}}% +\define@key{buildMeshInc}{meshpoint}[P]{\def\luameshval@bmi@meshpoint{#1}}% %% the mode for reading the points \define@choicekey*{buildMeshInc}{mode}[\val\nr]{int, ext}{% \ifcase\nr\relax% - \def\luameshval@bm@mode{int}% + \def\luameshval@bmi@mode{int}% \or% - \def\luameshval@bm@mode{ext}% + \def\luameshval@bmi@mode{ext}% \fi% }% -% -%color %% the name of the color of drawing -\define@key{buildMeshInc}{color}[black]{\def\luameshval@bm@color{#1}}% +\define@key{buildMeshInc}{color}[black]{\def\luameshval@bmi@color{#1}}% %% the name of the color of drawing the bbox -\define@key{buildMeshInc}{colorBbox}[black]{\def\luameshval@bm@colorbbox{#1}}% +\define@key{buildMeshInc}{colorBbox}[black]{\def\luameshval@bmi@colorbbox{#1}}% % \presetkeys{buildMeshInc}{tikz=false,bbox=none,scale, meshpoint,mode=int,print=none,color,colorBbox}{}% % -% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% the difinition BW Bowyer and Watson algo \newcommand*{\buildMeshBWinc}[4][]{% - % #1 : the string containing the list of points - % (x1,y1);(x2,y2);... or the name file containing the points - \setkeys{buildMesh}{#1} % - \def\MeshPoint{\luameshval@bm@meshpoint}% - \ifKV@buildMesh@tikz% if we are using tikz + % #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{buildMeshInc}{#1} % + \def\MeshPoint{\luameshval@bmi@meshpoint}% + \ifKV@buildMeshInc@tikz% if we are using tikz \directlua{% - buildMeshTikZ("#2","\luameshval@bm@mode","\luameshval@bm@print","\luameshval@bm@bbox","full","\luameshval@bm@scale","\luameshval@bm@color")% + 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")% }% \else % we are using MP - \mplibcolor{\luameshmpcolor}{\luameshval@bm@color} - \mplibcolor{\luameshmpcolorBbox}{\luameshval@bm@colorbbox} + \mplibcolor{\luameshmpcolor}{\luameshval@bmi@color}% + \mplibcolor{\luameshmpcolorBbox}{\luameshval@bmi@colorbbox}% \directlua{% - buildMeshMPBWinc("#2","#3","#4","\luameshval@bm@mode","\luameshval@bm@print","\luameshval@bm@bbox","\luameshval@bm@scale")% + buildMeshMPBWinc("#2","\luaescapestring{\unexpanded{#3}}","\luaescapestring{\unexpanded{#4}}","\luameshval@bmi@mode","\luameshval@bmi@print","\luameshval@bmi@bbox","\luameshval@bmi@scale")% }% % \fi% }% % %%%%%%%%%%%%%%%% the buildMeshBW command -%% engine of drawing -\newif\ifluameshengineMP% +%% the code is complete and we don't have any callbacks \define@boolkey{buildMesh}{tikz}[true]{}% %% show the bounding box for delaunay \define@choicekey*{buildMesh}{bbox}[\val\nr]{none, show}{% @@ -129,8 +127,6 @@ \def\luameshval@bm@mode{ext}% \fi% }% -% -% color %% the name of the color of drawing \define@key{buildMesh}{color}[black]{\def\luameshval@bm@color{#1}}% %% the name of the color of drawing the bbox @@ -138,33 +134,179 @@ % \presetkeys{buildMesh}{tikz=false,bbox=none,scale, meshpoint,mode=int,print=none,color,colorBbox}{}% % -% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% the difinition BW Bowyer and Watson algo \newcommand{\buildMeshBW}[2][]{% - % #1 : the string containing the list of points + % #1 : optionnal arguments + % #2 : the string containing the list of points % (x1,y1);(x2,y2);... or the name file containing the points \setkeys{buildMesh}{#1} % \def\MeshPoint{\luameshval@bm@meshpoint}% \ifKV@buildMesh@tikz% if we are using tikz \directlua{% - buildMeshTikZ("#2","\luameshval@bm@mode","\luameshval@bm@print","\luameshval@bm@bbox","full","\luameshval@bm@scale","\luameshval@bm@color")% + buildMeshTikZBW("#2","\luameshval@bm@mode","\luameshval@bm@print","\luameshval@bm@bbox","\luameshval@bm@scale","\luameshval@bm@color","\luameshval@bm@colorbbox")% }% \else % we are using MP - \mplibcolor{\luameshmpcolor}{\luameshval@bm@color} - \mplibcolor{\luameshmpcolorBbox}{\luameshval@bm@colorbbox} + \mplibcolor{\luameshmpcolor}{\luameshval@bm@color}% + \mplibcolor{\luameshmpcolorBbox}{\luameshval@bm@colorbbox}% \directlua{% buildMeshMPBW("#2","\luameshval@bm@mode","\luameshval@bm@print","\luameshval@bm@bbox","\luameshval@bm@scale")% }% % \fi% }% +%%%%%%%%%%%%%%%% the buildVoronoi command +%% the user can write code (tikz or MP) +%% before and after the generated code +\define@boolkey{buildVoronoiInc}{tikz}[true]{}% +%% show the bounding box for delaunay +\define@choicekey*{buildVoronoiInc}{bbox}[\val\nr]{none, show}{% + \ifcase\nr\relax% + \def\luameshval@bvi@bbox{none}% + \or% + \def\luameshval@bvi@bbox{bbox}% + \fi% +}% +%% the scale +\define@key{buildVoronoiInc}{scale}[1cm]{\def\luameshval@bvi@scale{#1}}% +%% print ponits ? +\define@choicekey*{buildVoronoiInc}{print}[\val\nr]{none, points}{% + \ifcase\nr\relax% + \def\luameshval@bvi@print{none}% + \or% + \def\luameshval@bvi@print{points}% + \fi% +}% +%% 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% + \def\luameshval@bvi@mode{int}% + \or% + \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}}% % -%%%%%%%%%%%%%%%%% the trace Points macro -%% engine of drawing -\newif\ifluameshengineMP% -\define@boolkey{tracePoints}{tikz}[true]{}% +\presetkeys{buildVoronoiInc}{tikz=false,bbox=none,scale, meshpoint,circumpoint,mode=int,print=none,color,colorVoronoi,colorBbox,delaunay=none}{}% +% +\newcommand*{\buildVoronoiBWinc}[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{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@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","\luameshval@bvi@delaunay")% + }% + % + \fi% +}% +% +%%%%%%%%%%%%%%%% the buildVoronoiBW command +%% the code is complete and we don't have any callbacks +\define@boolkey{buildVoronoi}{tikz}[true]{}% +%% show the bounding box for delaunay +\define@choicekey*{buildVoronoi}{bbox}[\val\nr]{none, show}{% + \ifcase\nr\relax% + \def\luameshval@bv@bbox{none}% + \or% + \def\luameshval@bv@bbox{bbox}% + \fi% +}% +%% the scale +\define@key{buildVoronoi}{scale}[1cm]{\def\luameshval@bv@scale{#1}}% +%% print points +\define@choicekey*{buildVoronoi}{print}[\val\nr]{none, points}{% + \ifcase\nr\relax% + \def\luameshval@bv@print{none}% + \or% + \def\luameshval@bv@print{points}% + \fi% +}% +%% the name of the point +\define@key{buildVoronoi}{meshpoint}[P]{\def\luameshval@bv@meshpoint{#1}}% +%% the name of the circum point +\define@key{buildVoronoi}{circumpoint}[P]{\def\luameshval@bv@circumpoint{#1}}% +%% the mode for reading the points +\define@choicekey*{buildVoronoi}{mode}[\val\nr]{int, ext}{% + \ifcase\nr\relax% + \def\luameshval@bv@mode{int}% + \or% + \def\luameshval@bv@mode{ext}% + \fi% +}% +%% the mode for reading the points +\define@choicekey*{buildVoronoi}{delaunay}[\val\nr]{none, show}{% + \ifcase\nr\relax% + \def\luameshval@bv@delaunay{none}% + \or% + \def\luameshval@bv@delaunay{show}% + \fi% +}% +%% the name of the color of drawing +\define@key{buildVoronoi}{color}[black]{\def\luameshval@bv@color{#1}}% +%% the name of the color of drawing Voronoi +\define@key{buildVoronoi}{colorVoronoi}[red]{\def\luameshval@bv@colorVoronoi{#1}}% +%% the name of the color of drawing the bbox +\define@key{buildVoronoi}{colorBbox}[black]{\def\luameshval@bv@colorbbox{#1}}% +% +\presetkeys{buildVoronoi}{tikz=false,bbox=none,scale, meshpoint,circumpoint,mode=int,print=none,color,colorVoronoi,colorBbox,delaunay=none}{}% +% +\newcommand{\buildVoronoiBW}[2][]{% + % #1 : optionnal arguments + % #2 : the string containing the list of points + % (x1,y1);(x2,y2);... or the name file containing the points + \setkeys{buildVoronoi}{#1} % + \def\MeshPoint{\luameshval@bv@meshpoint}% + \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@delaunay","\luameshval@bv@color","\luameshval@bv@colorbbox","\luameshval@bv@colorVoronoi")% + }% + \else % we are using MP + \mplibcolor{\luameshmpcolor}{\luameshval@bv@color}% + \mplibcolor{\luameshmpcolorBbox}{\luameshval@bv@colorbbox}% + \mplibcolor{\luameshmpcolorVoronoi}{\luameshval@bv@colorVoronoi}% + \directlua{% + buildVoronoiMPBW("#2","\luameshval@bv@mode","\luameshval@bv@print","\luameshval@bv@bbox","\luameshval@bv@scale","\luameshval@bv@delaunay")% + }% + % + \fi% +}% +% +% +%%%%%%%%%%%%%%%%% the draw Points macro +%% plot the list of points given in argument +% the engine +\define@boolkey{drawPoints}{tikz}[true]{}% %% show the bounding box for delaunay -\define@choicekey*{tracePoints}{bbox}[\val\nr]{none, show}{% +\define@choicekey*{drawPoints}{bbox}[\val\nr]{none, show}{% \ifcase\nr\relax% \def\luameshval@tp@bbox{none}% \or% @@ -172,9 +314,9 @@ \fi% }% %% the scale -\define@key{tracePoints}{scale}[1cm]{\def\luameshval@tp@scale{#1}}% +\define@key{drawPoints}{scale}[1cm]{\def\luameshval@tp@scale{#1}}% %% print points -\define@choicekey*{tracePoints}{print}[\val\nr]{none, points}{% +\define@choicekey*{drawPoints}{print}[\val\nr]{none, points}{% \ifcase\nr\relax% \def\luameshval@tp@print{none}% \or% @@ -182,38 +324,35 @@ \fi% }% %% the name of the point -\define@key{tracePoints}{meshpoint}[P]{\def\luameshval@tp@meshpoint{#1}}% +\define@key{drawPoints}{meshpoint}[P]{\def\luameshval@tp@meshpoint{#1}}% %% the mode for reading the points -\define@choicekey*{tracePoints}{mode}[\val\nr]{int, ext}{% +\define@choicekey*{drawPoints}{mode}[\val\nr]{int, ext}{% \ifcase\nr\relax% \def\luameshval@tp@mode{int}% \or% \def\luameshval@tp@mode{ext}% \fi% }% -% -% color %% the name of the color of drawing -\define@key{tracePoints}{color}[black]{\def\luameshval@tp@color{#1}}% +\define@key{drawPoints}{color}[black]{\def\luameshval@tp@color{#1}}% %% the name of the color of drawing the bbox -\define@key{tracePoints}{colorBbox}[black]{\def\luameshval@tp@colorbbox{#1}}% +\define@key{drawPoints}{colorBbox}[black]{\def\luameshval@tp@colorbbox{#1}}% % -\presetkeys{tracePoints}{tikz=false,bbox=none,scale, meshpoint,mode=int,print=none,color,colorBbox}{}% +\presetkeys{drawPoints}{tikz=false,bbox=none,scale, meshpoint,mode=int,print=none,color,colorBbox}{}% % -% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% the difinition BW Bowyer and Watson algo -\newcommand{\tracePointsMesh}[2][]{% - % #1 : the string containing the list of points +\newcommand{\drawPointsMesh}[2][]{% + % #1 : optionnal arguments + % #2 : the string containing the list of points % (x1,y1);(x2,y2);... or the name file containing the points - \setkeys{tracePoints}{#1} % + \setkeys{drawPoints}{#1} % \def\MeshPoint{\luameshval@tp@meshpoint}% - \ifKV@buildMesh@tikz% if we are using tikz + \ifKV@drawPoints@tikz% if we are using tikz \directlua{% - % buildMeshTikZ("#2","\luameshval@tp@mode","\luameshval@tp@print","\luameshval@tp@bbox","full","\luameshval@tp@scale","\luameshval@tp@color")% + printPointsTikZ("#2","\luameshval@tp@mode","\luameshval@tp@print","\luameshval@tp@bbox","\luameshval@tp@scale","\luameshval@tp@color","\luameshval@tp@colorbbox")% }% \else % we are using MP - \mplibcolor{\luameshmpcolor}{\luameshval@tp@color} - \mplibcolor{\luameshmpcolorBbox}{\luameshval@tp@colorbbox} + \mplibcolor{\luameshmpcolor}{\luameshval@tp@color}% + \mplibcolor{\luameshmpcolorBbox}{\luameshval@tp@colorbbox}% \directlua{% printPointsMP("#2","\luameshval@tp@mode","\luameshval@tp@print","\luameshval@tp@bbox","\luameshval@tp@scale")% }% @@ -222,211 +361,211 @@ }% % -%%%%%%%%%%%%%%%% the trace Points macro inc +%%%%%%%%%%%%%%%% the draw Points macro inc with callbacks %% engine of drawing -\newif\ifluameshengineMP% -\define@boolkey{tracePointsInc}{tikz}[true]{}% +\define@boolkey{drawPointsInc}{tikz}[true]{}% %% show the bounding box for delaunay -\define@choicekey*{tracePointsInc}{bbox}[\val\nr]{none, show}{% +\define@choicekey*{drawPointsInc}{bbox}[\val\nr]{none, show}{% \ifcase\nr\relax% - \def\luameshval@tp@bbox{none}% + \def\luameshval@tpi@bbox{none}% \or% - \def\luameshval@tp@bbox{bbox}% + \def\luameshval@tpi@bbox{bbox}% \fi% }% %% the scale -\define@key{tracePointsInc}{scale}[1cm]{\def\luameshval@tp@scale{#1}}% +\define@key{drawPointsInc}{scale}[1cm]{\def\luameshval@tpi@scale{#1}}% %% print points -\define@choicekey*{tracePointsInc}{print}[\val\nr]{none, points}{% +\define@choicekey*{drawPointsInc}{print}[\val\nr]{none, points}{% \ifcase\nr\relax% - \def\luameshval@tp@print{none}% + \def\luameshval@tpi@print{none}% \or% - \def\luameshval@tp@print{points}% + \def\luameshval@tpi@print{points}% \fi% }% %% the name of the point -\define@key{tracePointsInc}{meshpoint}[P]{\def\luameshval@tp@meshpoint{#1}}% +\define@key{drawPointsInc}{meshpoint}[P]{\def\luameshval@tpi@meshpoint{#1}}% %% the mode for reading the points -\define@choicekey*{tracePointsInc}{mode}[\val\nr]{int, ext}{% +\define@choicekey*{drawPointsInc}{mode}[\val\nr]{int, ext}{% \ifcase\nr\relax% - \def\luameshval@tp@mode{int}% + \def\luameshval@tpi@mode{int}% \or% - \def\luameshval@tp@mode{ext}% + \def\luameshval@tpi@mode{ext}% \fi% }% % % color %% the name of the color of drawing -\define@key{tracePointsInc}{color}[black]{\def\luameshval@tp@color{#1}}% +\define@key{drawPointsInc}{color}[black]{\def\luameshval@tpi@color{#1}}% %% the name of the color of drawing the bbox -\define@key{tracePointsInc}{colorBbox}[black]{\def\luameshval@tp@colorbbox{#1}}% +\define@key{drawPointsInc}{colorBbox}[black]{\def\luameshval@tpi@colorbbox{#1}}% % -\presetkeys{tracePointsInc}{tikz=false,bbox=none,scale, meshpoint,mode=int,print=none,color,colorBbox}{}% +\presetkeys{drawPointsInc}{tikz=false,bbox=none,scale, meshpoint,mode=int,print=none,color,colorBbox}{}% % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% the difinition BW Bowyer and Watson algo -\newcommand*{\tracePointsMeshinc}[4][]{% - % #1 : the string containing the list of points +\newcommand*{\drawPointsMeshinc}[4][]{% + % #1 : optionnal arguments + % #2 : the string containing the list of points % (x1,y1);(x2,y2);... or the name file containing the points - \setkeys{tracePointsInc}{#1} % - \def\MeshPoint{\luameshval@tp@meshpoint}% - \ifKV@tracePointsInc@tikz% if we are using tikz + % #3 : the code to place before the generated one + % #4 : the code to place after the generated one + \setkeys{drawPointsInc}{#1} % + \def\MeshPoint{\luameshval@tpi@meshpoint}% + \ifKV@drawPointsInc@tikz% if we are using tikz \directlua{% - buildMeshTikZ("#2","\luameshval@tp@mode","\luameshval@tp@print","\luameshval@tp@bbox","full","\luameshval@tp@sc%ale","\luameshval@tp@color")% + 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")% }% \else % we are using MP - \mplibcolor{\luameshmpcolor}{\luameshval@tp@color} - \mplibcolor{\luameshmpcolorBbox}{\luameshval@tp@colorbbox} + \mplibcolor{\luameshmpcolor}{\luameshval@tpi@color}% + \mplibcolor{\luameshmpcolorBbox}{\luameshval@tpi@colorbbox}% \directlua{% - printPointsMPinc("#2","#3","#4","\luameshval@tp@mode","\luameshval@tp@print","\luameshval@tp@bbox","\luameshval@tp@scale")% + printPointsMPinc("#2","\luaescapestring{\unexpanded{#3}}","\luaescapestring{\unexpanded{#4}}","\luameshval@tpi@mode","\luameshval@tpi@print","\luameshval@tpi@bbox","\luameshval@tpi@scale")% }% \fi% }% % -% -%% -% -%%the meshAddOnePointBW commande -%%engine of drawing -\newif\ifluameshengineMP% -\define@boolkey{MeshAddOne}{tikz}[true]{}% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% the meshAddOnePointBW commande +%%engine of draiwng +\define@boolkey{MeshAddOneBW}{tikz}[true]{}% %% the scale -\define@key{MeshAddOne}{scale}[1cm]{\def\luameshval@scale{#1}}% +\define@key{MeshAddOneBW}{scale}[1cm]{\def\luameshval@ap@scale{#1}}% %% the name of the points -\define@key{MeshAddOne}{meshpoint}[P]{\def\luameshval@meshpoint{#1}}% +\define@key{MeshAddOneBW}{meshpoint}[P]{\def\luameshval@ap@meshpoint{#1}}% %% the name of the new point -\define@key{MeshAddOne}{newpoint}[P]{\def\luameshval@newpoint{#1}}% +\define@key{MeshAddOneBW}{newpoint}[P]{\def\luameshval@ap@newpoint{#1}}% %% a complete picture or some code of the engine -\define@choicekey*{MeshAddOne}{step}[\val\nr]{badtriangles, cavity, newtriangles}{% +\define@choicekey*{MeshAddOneBW}{step}[\val\nr]{badtriangles, cavity, newtriangles}{% \ifcase\nr\relax% - \def\luameshval@step{badT}% + \def\luameshval@ap@step{badT}% \or% - \def\luameshval@step{cavity}% + \def\luameshval@ap@step{cavity}% \or% - \def\luameshval@step{newT}% + \def\luameshval@ap@step{newT}% \fi% }% % color %% the color of drawing -\define@key{MeshAddOne}{color}[black]{\def\luameshval@color{#1}}% +\define@key{MeshAddOneBW}{color}[black]{\def\luameshval@ap@color{#1}}% %% the color of background of new element -\define@key{MeshAddOne}{colorBack}[black!20]{\def\luameshval@colorback{#1}}% +\define@key{MeshAddOneBW}{colorBack}[black!20]{\def\luameshval@ap@colorback{#1}}% %% the color of new element -\define@key{MeshAddOne}{colorNew}[red]{\def\luameshval@colornew{#1}}% +\define@key{MeshAddOneBW}{colorNew}[red]{\def\luameshval@ap@colornew{#1}}% %% the color of circoncircle -\define@key{MeshAddOne}{colorCircle}[green]{\def\luameshval@colorcircle{#1}}% +\define@key{MeshAddOneBW}{colorCircle}[green]{\def\luameshval@ap@colorcircle{#1}}% %% the name of the color of drawing the bbox -\define@key{MeshAddOne}{colorBbox}[black]{\def\luameshval@colorbbox{#1}}% +\define@key{MeshAddOneBW}{colorBbox}[black]{\def\luameshval@ap@colorbbox{#1}}% % %% a complete picture or some code of the engine -\define@choicekey*{MeshAddOne}{mode}[\val\nr]{int, ext}{% +\define@choicekey*{MeshAddOneBW}{mode}[\val\nr]{int, ext}{% \ifcase\nr\relax% - \def\luameshval@mode{int}% + \def\luameshval@ap@mode{int}% \or% - \def\luameshval@mode{ext}% + \def\luameshval@ap@mode{ext}% \fi% }% -\define@choicekey*{MeshAddOne}{bbox}[\val\nr]{none, show}{% +\define@choicekey*{MeshAddOneBW}{bbox}[\val\nr]{none, show}{% \ifcase\nr\relax% - \def\luameshval@bbox{none}% + \def\luameshval@ap@bbox{none}% \or% - \def\luameshval@bbox{bbox}% + \def\luameshval@ap@bbox{bbox}% \fi% }% -\presetkeys{MeshAddOne}{tikz=false,scale, meshpoint,newpoint,color,colorBack,colorNew,colorCircle,step=badtriangles,mode=int,bbox=none,colorBbox}{}% +\presetkeys{MeshAddOneBW}{tikz=false,scale, meshpoint,newpoint,color,colorBack,colorNew,colorCircle,step=badtriangles,mode=int,bbox=none,colorBbox}{}% % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% the difinition BW Bowyer and Watson algo \newcommand*{\meshAddPointBW}[3][]{% - % #1 : the string containing the list of points + % #1 : optionnal arguments + % #2 : the string containing the list of points % (x1,y1);(x2,y2);... or the name file containing the points - \setkeys{MeshAddOne}{#1} % - \def\MeshPoint{\luameshval@meshpoint}% - \def\NewPoint{\luameshval@newpoint}% - \ifKV@MeshAddOne@tikz% if we are using tikz + \setkeys{MeshAddOneBW}{#1} % + \def\MeshPoint{\luameshval@ap@meshpoint}% + \def\NewPoint{\luameshval@ap@newpoint}% + \ifKV@MeshAddOneBW@tikz% if we are using tikz \directlua{% - buildMeshTikZ("#2","\luameshval@mode","\luameshval@print","\luameshval@bbox","full","\luameshval@scale","\luameshval@color")% + 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")% }% \else % we are using MP - \mplibcolor{\luameshmpcolor}{\luameshval@color} - \mplibcolor{\luameshmpcolorBack}{\luameshval@colorback} - \mplibcolor{\luameshmpcolorNew}{\luameshval@colornew} - \mplibcolor{\luameshmpcolorCircle}{\luameshval@colorcircle} - \mplibcolor{\luameshmpcolorBbox}{\luameshval@colorbbox} + \mplibcolor{\luameshmpcolor}{\luameshval@ap@color} + \mplibcolor{\luameshmpcolorBack}{\luameshval@ap@colorback} + \mplibcolor{\luameshmpcolorNew}{\luameshval@ap@colornew} + \mplibcolor{\luameshmpcolorCircle}{\luameshval@ap@colorcircle} + \mplibcolor{\luameshmpcolorBbox}{\luameshval@ap@colorbbox} \directlua{% - TeXOnePointMPBW("#2","#3","\luameshval@step","\luameshval@scale","\luameshval@mode","\luameshval@bbox")% + TeXOnePointMPBW("#2","#3","\luameshval@ap@step","\luameshval@ap@scale","\luameshval@ap@mode","\luameshval@ap@bbox")% }% % \fi% }% -%%% the meshAddPointBWinc commande +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%% the meshAddPointBWinc commande with callbacks %% engine of drawing -\newif\ifluameshengineMP% \define@boolkey{MeshAddOneBWinc}{tikz}[true]{}% %% the scale -\define@key{MeshAddOneBWinc}{scale}[1cm]{\def\luameshval@scale{#1}}% +\define@key{MeshAddOneBWinc}{scale}[1cm]{\def\luameshval@api@scale{#1}}% %% the name of the points -\define@key{MeshAddOneBWinc}{meshpoint}[P]{\def\luameshval@meshpoint{#1}}% +\define@key{MeshAddOneBWinc}{meshpoint}[P]{\def\luameshval@api@meshpoint{#1}}% %% the name of the new point -\define@key{MeshAddOneBWinc}{newpoint}[P]{\def\luameshval@newpoint{#1}}% +\define@key{MeshAddOneBWinc}{newpoint}[P]{\def\luameshval@api@newpoint{#1}}% %% a complete picture or some code of the engine \define@choicekey*{MeshAddOneBWinc}{step}[\val\nr]{badtriangles, cavity, newtriangles}{% \ifcase\nr\relax% - \def\luameshval@step{badT}% + \def\luameshval@api@step{badT}% \or% - \def\luameshval@step{cavity}% + \def\luameshval@api@step{cavity}% \or% - \def\luameshval@step{newT}% + \def\luameshval@api@step{newT}% \fi% }% % color %% the color of drawing -\define@key{MeshAddOneBWinc}{color}[black]{\def\luameshval@color{#1}}% +\define@key{MeshAddOneBWinc}{color}[black]{\def\luameshval@api@color{#1}}% %% the color of background of new element -\define@key{MeshAddOneBWinc}{colorBack}[black!20]{\def\luameshval@colorback{#1}}% +\define@key{MeshAddOneBWinc}{colorBack}[black!20]{\def\luameshval@api@colorback{#1}}% %% the color of new element -\define@key{MeshAddOneBWinc}{colorNew}[red]{\def\luameshval@colornew{#1}}% +\define@key{MeshAddOneBWinc}{colorNew}[red]{\def\luameshval@api@colornew{#1}}% %% the color of circoncircle -\define@key{MeshAddOneBWinc}{colorCircle}[green]{\def\luameshval@colorcircle{#1}}% -\define@key{MeshAddOneBWinc}{colorBbox}[black]{\def\luameshval@colorbbox{#1}}% +\define@key{MeshAddOneBWinc}{colorCircle}[green]{\def\luameshval@api@colorcircle{#1}}% +\define@key{MeshAddOneBWinc}{colorBbox}[black]{\def\luameshval@api@colorbbox{#1}}% % %% a complete picture or some code of the engine \define@choicekey*{MeshAddOneBWinc}{mode}[\val\nr]{int, ext}{% \ifcase\nr\relax% - \def\luameshval@mode{int}% + \def\luameshval@api@mode{int}% \or% - \def\luameshval@mode{ext}% + \def\luameshval@api@mode{ext}% \fi% }% \define@choicekey*{MeshAddOneBWinc}{bbox}[\val\nr]{none, show}{% \ifcase\nr\relax% - \def\luameshval@bbox{none}% + \def\luameshval@api@bbox{none}% \or% - \def\luameshval@bbox{bbox}% + \def\luameshval@api@bbox{bbox}% \fi% }% \presetkeys{MeshAddOneBWinc}{tikz=false,scale, meshpoint,newpoint,color,colorBack,colorNew,colorCircle,step=badtriangles,mode=int,bbox=none,colorBbox}{}% % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% the difinition BW embedded code between the 2 last arguments \newcommand*{\meshAddPointBWinc}[5][]{% - % #1 : the string containing the list of points + % #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{MeshAddOneBWinc}{#1} % - \def\MeshPoint{\luameshval@meshpoint}% - \def\NewPoint{\luameshval@newpoint}% - \ifKV@MeshAddOne@tikz% if we are using tikz + \def\MeshPoint{\luameshval@api@meshpoint}% + \def\NewPoint{\luameshval@api@newpoint}% + \ifKV@MeshAddOneBWinc@tikz% if we are using tikz \directlua{% - buildMeshTikZ("#2","\luameshval@mode","\luameshval@print","\luameshval@bbox","full","\luameshval@scale","\luameshval@color")% + 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@color} - \mplibcolor{\luameshmpcolorBack}{\luameshval@colorback} - \mplibcolor{\luameshmpcolorNew}{\luameshval@colornew} - \mplibcolor{\luameshmpcolorCircle}{\luameshval@colorcircle} - \mplibcolor{\luameshmpcolorBbox}{\luameshval@colorbbox} + \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","#4","#5","\luameshval@step","\luameshval@scale","\luameshval@mode","\luameshval@bbox")% + TeXOnePointMPBWinc("#2","#3","\luaescapestring{\unexpanded{#4}}","\luaescapestring{\unexpanded{#5}}","\luameshval@api@step","\luameshval@api@scale","\luameshval@api@mode","\luameshval@api@bbox")% }% % \fi%