end
+-- trace Voronoi with TikZ
+function traceVoronoiTikZ(listPoints, triangulation,listVoronoi, points, tri,color,colorBbox,colorVoronoi)
+ listCircumC = listCircumCenter(listPoints,triangulation)
+ output = ""
+ for i=1,#listPoints do
+ output = output .. "\\coordinate (MeshPoints".. i .. ") at (" .. listPoints[i].x .. "," .. listPoints[i].y .. ");"
+ end
+ for i=1,#listCircumC do
+ output = output .. "\\coordinate (CircumPoints".. i .. ") at (" .. listCircumC[i].x .. "," .. listCircumC[i].y .. ");"
+ end
+ if(tri=="show") then
+ for i=1,#triangulation do
+ PointI = listPoints[triangulation[i][1]]
+ PointJ = listPoints[triangulation[i][2]]
+ PointK = listPoints[triangulation[i][3]]
+ if(triangulation[i].type == "bbox") then
+ output = output .. "\\draw[color="..colorBbox.."] (".. PointI.x ..",".. PointI.y ..")--("..PointJ.x..",".. PointJ.y ..")--("..PointK.x..",".. PointK.y ..")--cycle;"
+ else
+ output = output .. "\\draw[color="..color.."] (".. PointI.x ..",".. PointI.y ..")--("..PointJ.x..",".. PointJ.y ..")--("..PointK.x..",".. PointK.y ..")--cycle;"
+ end
+ end
+ end
+ for i=1,#listVoronoi do
+ PointI = listCircumC[listVoronoi[i][1]]
+ PointJ = listCircumC[listVoronoi[i][2]]
+ output = output .. "\\draw[color="..colorVoronoi.."] (".. PointI.x ..",".. PointI.y ..")--("..PointJ.x..",".. PointJ.y ..");"
+ end
+ if(points=="points") then
+ j=1
+ for i=1,#listPoints do
+ if(listPoints[i].type == "bbox") then
+ if(listPoints[i].type == "bbox") then
+ output = output .. "\\draw[color="..colorBbox.."] (" .. listPoints[i].x ..",".. listPoints[i].y .. ") node {$\\bullet$} node[anchor=north east] {$\\MeshPoint^*_{" .. j .. "}$};"
+ j=j+1
+ else
+ output = output .. "\\draw[color="..color.."] (" .. listPoints[i].x ..",".. listPoints[i].y .. ") node {$\\bullet$} node[anchor=north east] {$\\MeshPoint_{" .. i .. "}$};"
+ end
+ end
+ end
+ for i=1,#listCircumC do
+ output = output .. "\\draw[color="..colorVoronoi.."] (" .. listCircumC[i].x ..",".. listCircumC[i].y .. ") node {$\\bullet$} node[anchor=north east] {$\\CircumPoint_{" .. i .. "}$};"
+ end
+ else
+ j=1
+ for i=1,#listPoints do
+ if(listPoints[i].type == "bbox") then
+ output = output .. "\\draw[color="..colorBbox.."] (" .. listPoints[i].x ..",".. listPoints[i].y .. ") node {$\\bullet$} ;"
+ j=j+1
+ else
+ output = output .. "\\draw[color="..color.."] (" .. listPoints[i].x ..",".. listPoints[i].y .. ") node {$\\bullet$} ;"
+ end
+ end
+ for i=1,#listCircumC do
+ output = output .. "\\draw[color="..colorVoronoi.."] (" .. listCircumC[i].x ..",".. listCircumC[i].y .. ") node {$\\bullet$};"
+ end
+ end
+ return output
+end
+
+
-- buildVoronoi with MP
function buildVoronoiMPBW(chaine,mode,points,bbox,scale,tri)
end
+-- buildVoronoi with TikZ
+function buildVoronoiTikZBW(chaine,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 .."]" .. output .."\\end{tikzpicture}" tex.sprint(output)
+end
+
+
-- trace a triangulation with TikZ
function traceMeshTikZ(listPoints, triangulation,points,color,colorBbox)
% buildVoronoiMP("mesh.txt","ext","points","","1cm","show")
% }
\buildVoronoiBW[mode=ext]{mesh.txt}
-\buildVoronoiBW[mode=ext,delaunay=show]{mesh.txt}\par
-\buildVoronoiBW[mode=ext,print=points,delaunay=show,bbox=show]{mesh.txt}
+\buildVoronoiBW[mode=ext,delaunay=show,colorVoronoi=green!60!blue]{mesh.txt}\par
+\buildVoronoiBW[mode=ext,print=points,delaunay=show,bbox=show,meshpoint=x,circumpoint=y]{mesh.txt}
+
+
+\buildVoronoiBW[tikz,mode=ext]{mesh.txt}
+\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}
\end{document}