end
+-- print points of the mesh
+function tracePointsMP(listPoints,points)
+ output = "";
+ output = output .. " pair MeshPoints[];"
+ for i=1,#listPoints do
+ output = output .. "MeshPoints[".. i .. "] = (" .. listPoints[i].x .. "," .. listPoints[i].y .. ");"
+ end
+ if(points=="points") then
+ for i=1,#listPoints do
+ if(listPoints[i].type == "bbox") then
+ output = output .. "dotlabel.llft (btex $\\MeshPoint_{" .. i .. "}$ etex, (" .. listPoints[i].x ..",".. listPoints[i].y .. ")*u ) withcolor \\luameshmpcolorBbox ;"
+ else
+ output = output .. "dotlabel.llft (btex $\\MeshPoint_{" .. i .. "}$ etex, (" .. listPoints[i].x ..",".. listPoints[i].y .. ")*u ) withcolor \\luameshmpcolor ;"
+ end
+ end
+ else
+ for i=1,#listPoints do
+ if(listPoints[i].type == "bbox") then
+ output = output .. "drawdot (" .. listPoints[i].x ..",".. listPoints[i].y .. ")*u ) withcolor \\luameshmpcolorBbox ;"
+ else
+ output = output .. "drawdot (" .. listPoints[i].x ..",".. listPoints[i].y .. ")*u ) withcolor \\luameshmpcolor ;"
+ end
+ end
+ end
+ return output
+end
+
+
-- buildMesh with TikZ
function buildMeshTikZ(chaine,mode,points,bbox,full,scale,color)
tex.sprint(output)
end
+-- print points to mesh
+function printPointsMP(chaine,mode,points,bbox,scale)
+ listPoints = buildList(chaine, mode)
+ if(bbox == "bbox" ) then
+ listPoints = buildBoundingBox(listPoints)
+ end
+ output = tracePointsMP(listPoints,points)
+ output = "\\leavevmode\\begin{mplibcode}beginfig(0);u:="..scale.. ";" .. output .."endfig;\\end{mplibcode}"
+ tex.sprint(output)
+end
+
+
+-- print points to mesh
+function printPointsMPinc(chaine,beginning, ending, mode,points,bbox,scale)
+ listPoints = buildList(chaine, mode)
+ if(bbox == "bbox" ) then
+ listPoints = buildBoundingBox(listPoints)
+ end
+ output = tracePointsMP(listPoints,points)
+ output = "\\begin{mplibcode}u:="..scale..";"..beginning .. output .. ending .. "\\end{mplibcode}"
+ tex.sprint(output)
+end
+
-- buildMesh with MP include code
function buildMeshMPBWinc(chaine,beginning, ending,mode,points,bbox,scale)
\fi%
}%
%
+%%%%%%%%%%%%%%%%% the trace Points macro
+%% engine of drawing
+\newif\ifluameshengineMP%
+\define@boolkey{tracePoints}{tikz}[true]{}%
+%% show the bounding box for delaunay
+\define@choicekey*{tracePoints}{bbox}[\val\nr]{none, show}{%
+ \ifcase\nr\relax%
+ \def\luameshval@tp@bbox{none}%
+ \or%
+ \def\luameshval@tp@bbox{bbox}%
+ \fi%
+}%
+%% the scale
+\define@key{tracePoints}{scale}[1cm]{\def\luameshval@tp@scale{#1}}%
+%% print points
+\define@choicekey*{tracePoints}{print}[\val\nr]{none, points}{%
+ \ifcase\nr\relax%
+ \def\luameshval@tp@print{none}%
+ \or%
+ \def\luameshval@tp@print{points}%
+ \fi%
+}%
+%% the name of the point
+\define@key{tracePoints}{meshpoint}[P]{\def\luameshval@tp@meshpoint{#1}}%
+%% the mode for reading the points
+\define@choicekey*{tracePoints}{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}}%
+%% the name of the color of drawing the bbox
+\define@key{tracePoints}{colorBbox}[black]{\def\luameshval@tp@colorbbox{#1}}%
+%
+\presetkeys{tracePoints}{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
+ % (x1,y1);(x2,y2);... or the name file containing the points
+ \setkeys{tracePoints}{#1} %
+ \def\MeshPoint{\luameshval@tp@meshpoint}%
+ \ifKV@buildMesh@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")%
+ }%
+ \else % we are using MP
+ \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")%
+ }%
+ %
+ \fi%
+}%
+%
+
+%%%%%%%%%%%%%%%% the trace Points macro inc
+%% engine of drawing
+\newif\ifluameshengineMP%
+\define@boolkey{tracePointsInc}{tikz}[true]{}%
+%% show the bounding box for delaunay
+\define@choicekey*{tracePointsInc}{bbox}[\val\nr]{none, show}{%
+ \ifcase\nr\relax%
+ \def\luameshval@tp@bbox{none}%
+ \or%
+ \def\luameshval@tp@bbox{bbox}%
+ \fi%
+}%
+%% the scale
+\define@key{tracePointsInc}{scale}[1cm]{\def\luameshval@tp@scale{#1}}%
+%% print points
+\define@choicekey*{tracePointsInc}{print}[\val\nr]{none, points}{%
+ \ifcase\nr\relax%
+ \def\luameshval@tp@print{none}%
+ \or%
+ \def\luameshval@tp@print{points}%
+ \fi%
+}%
+%% the name of the point
+\define@key{tracePointsInc}{meshpoint}[P]{\def\luameshval@tp@meshpoint{#1}}%
+%% the mode for reading the points
+\define@choicekey*{tracePointsInc}{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{tracePointsInc}{color}[black]{\def\luameshval@tp@color{#1}}%
+%% the name of the color of drawing the bbox
+\define@key{tracePointsInc}{colorBbox}[black]{\def\luameshval@tp@colorbbox{#1}}%
+%
+\presetkeys{tracePointsInc}{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
+ % (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
+ \directlua{%
+ buildMeshTikZ("#2","\luameshval@tp@mode","\luameshval@tp@print","\luameshval@tp@bbox","full","\luameshval@tp@sc%ale","\luameshval@tp@color")%
+ }%
+ \else % we are using MP
+ \mplibcolor{\luameshmpcolor}{\luameshval@tp@color}
+ \mplibcolor{\luameshmpcolorBbox}{\luameshval@tp@colorbbox}
+ \directlua{%
+ printPointsMPinc("#2","#3","#4","\luameshval@tp@mode","\luameshval@tp@print","\luameshval@tp@bbox","\luameshval@tp@scale")%
+ }%
+ \fi%
+}%
%
%
%%