tex.sprint(output)
end
+
+-- buildMesh with MP include code
+function buildMeshMPBWinc(chaine,beginning, ending,mode,points,bbox,scale)
+ listPoints = buildList(chaine, mode)
+ triangulation = BowyerWatson(listPoints,bbox)
+ output = traceMeshMP(listPoints, triangulation,points)
+ output = "\\begin{mplibcode}u:="..scale..";"..beginning .. output .. ending .. "\\end{mplibcode}"
+ tex.sprint(output)
+end
+
-- buildMesh
function buildRect(largeur,a,b,nbrA, nbrB)
listPoints = rectangleList(a,b,nbrA,nbrB)
%%%%%%%%%%%%%%%% the buildMesh command
%% engine of drawing
\newif\ifluameshengineMP%
+\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}%
+ \or%
+ \def\luameshval@bm@bbox{bbox}%
+ \fi%
+}%
+%% the scale
+\define@key{buildMeshInc}{scale}[1cm]{\def\luameshval@bm@scale{#1}}%
+%% print ponits ?
+\define@choicekey*{buildMeshInc}{print}[\val\nr]{none, points}{%
+ \ifcase\nr\relax%
+ \def\luameshval@bm@print{none}%
+ \or%
+ \def\luameshval@bm@print{points}%
+ \fi%
+}%
+%% the name of the point
+\define@key{buildMeshInc}{meshpoint}[P]{\def\luameshval@bm@meshpoint{#1}}%
+%% the mode for reading the points
+\define@choicekey*{buildMeshInc}{mode}[\val\nr]{int, ext}{%
+ \ifcase\nr\relax%
+ \def\luameshval@bm@mode{int}%
+ \or%
+ \def\luameshval@bm@mode{ext}%
+ \fi%
+}%
+%
+%color
+%% the name of the color of drawing
+\define@key{buildMeshInc}{color}[black]{\def\luameshval@bm@color{#1}}%
+%% the name of the color of drawing the bbox
+\define@key{buildMeshInc}{colorBbox}[black]{\def\luameshval@bm@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
+ \directlua{%
+ buildMeshTikZ("#2","\luameshval@bm@mode","\luameshval@bm@print","\luameshval@bm@bbox","full","\luameshval@bm@scale","\luameshval@bm@color")%
+ }%
+ \else % we are using MP
+ \mplibcolor{\luameshmpcolor}{\luameshval@bm@color}
+ \mplibcolor{\luameshmpcolorBbox}{\luameshval@bm@colorbbox}
+ \directlua{%
+ buildMeshMPBWinc("#2","#3","#4","\luameshval@bm@mode","\luameshval@bm@print","\luameshval@bm@bbox","\luameshval@bm@scale")%
+ }%
+ %
+ \fi%
+}%
+%
+%%%%%%%%%%%%%%%% the buildMeshBW command
+%% engine of drawing
+\newif\ifluameshengineMP%
\define@boolkey{buildMesh}{tikz}[true]{}%
%% show the bounding box for delaunay
\define@choicekey*{buildMesh}{bbox}[\val\nr]{none, show}{%
}%
%% the scale
\define@key{buildMesh}{scale}[1cm]{\def\luameshval@bm@scale{#1}}%
-%% print ponits ?
+%% print points
\define@choicekey*{buildMesh}{print}[\val\nr]{none, points}{%
\ifcase\nr\relax%
\def\luameshval@bm@print{none}%
\fi%
}%
%
-%color
+% 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
\fi%
}%
%
+%
+%
%%
%
%%the meshAddOnePointBW commande