end
+-- buildVoronoi with MP
+function buildVoronoiMPBWinc(chaine,beginning, ending,mode,points,bbox,scale,tri)
+ listPoints = buildList(chaine, mode)
+ triangulation = BowyerWatson(listPoints,bbox)
+ listVoronoi = buildVoronoi(listPoints, triangulation)
+ output = traceVoronoiMP(listPoints,triangulation,listVoronoi,points,tri)
+ output = "\\leavevmode\\begin{mplibcode}u:="..scale..";"..beginning .. output .. ending .. "\\end{mplibcode}"
+ tex.sprint(output)
+end
+
+
+-- buildVoronoi with TikZ
+function buildVoronoiTikZBWinc(chaine,beginning, ending,mode,points,bbox,scale,tri,color,colorBbox,colorVoronoi)
+ listPoints = buildList(chaine, mode)
+ triangulation = BowyerWatson(listPoints,bbox)
+ listVoronoi = buildVoronoi(listPoints, triangulation)
+ output = traceVoronoiTikZ(listPoints,triangulation,listVoronoi,points,tri,color,colorBbox,colorVoronoi)
+ output = "\\noindent\\begin{tikzpicture}[x=" .. scale .. ",y=" .. scale .."]" ..beginning.. output..ending .."\\end{tikzpicture}"
+ tex.sprint(output)
+end
+
+
-- trace a triangulation with TikZ
function traceMeshTikZ(listPoints, triangulation,points,color,colorBbox)
}%
%% 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{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
% #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%
\buildVoronoiBW[tikz,mode=ext,delaunay=show,colorVoronoi=green!60!blue]{mesh.txt}\par
\buildVoronoiBW[tikz,mode=ext,print=points,delaunay=show,bbox=show,meshpoint=x,circumpoint=y]{mesh.txt}
+\buildVoronoiBWinc[mode=ext]{mesh.txt}{beginfig(0);}{endfig;}
+\buildVoronoiBWinc[tikz,mode=ext]{mesh.txt}{}{}
+
+
+\buildVoronoiBWinc[tikz,mode=ext,print=points,delaunay=show,meshpoint=x,circumpoint=y]{mesh.txt}{}{\draw[color=blue,thick] (0,0)--(3,3);}
+
\end{document}