Un peu de nettoyage et rajout de déclaration local
authorMaxime Chupin (escudo) <chupin@fougeriens.org>
Wed, 8 Feb 2017 23:54:38 +0000 (00:54 +0100)
committerMaxime Chupin (escudo) <chupin@fougeriens.org>
Wed, 8 Feb 2017 23:54:38 +0000 (00:54 +0100)
luamesh-tex.lua
luamesh.lua
test/delaunay.pdf
test/delaunay.tex

index 1581638..56b635c 100644 (file)
@@ -140,9 +140,9 @@ end
 
 -- buildVoronoi with MP
 function buildVoronoiMPBW(chaine,mode,points,bbox,scale,tri,styleD,styleV)
-   listPoints = buildList(chaine, mode)
-   triangulation = BowyerWatson(listPoints,bbox)
-   listVoronoi = buildVoronoi(listPoints, triangulation)
+   local listPoints = buildList(chaine, mode)
+   local triangulation = BowyerWatson(listPoints,bbox)
+   local listVoronoi = buildVoronoi(listPoints, triangulation)
    output = traceVoronoiMP(listPoints,triangulation,listVoronoi,points,tri,styleD,styleV)
    output = "\\leavevmode\\begin{mplibcode}beginfig(0);u:="..scale.. ";" .. output .."endfig;\\end{mplibcode}"
    tex.sprint(output)
@@ -151,9 +151,9 @@ end
 
 -- buildVoronoi with TikZ
 function buildVoronoiTikZBW(chaine,mode,points,bbox,scale,tri,color,colorBbox,colorVoronoi,styleD,styleV)
-   listPoints = buildList(chaine, mode)
-   triangulation = BowyerWatson(listPoints,bbox)
-   listVoronoi = buildVoronoi(listPoints, triangulation)
+   local listPoints = buildList(chaine, mode)
+   local triangulation = BowyerWatson(listPoints,bbox)
+   local listVoronoi = buildVoronoi(listPoints, triangulation)
    output = traceVoronoiTikZ(listPoints,triangulation,listVoronoi,points,tri,color,colorBbox,colorVoronoi,styleD,styleV)
    output = "\\noindent\\begin{tikzpicture}[x=" .. scale .. ",y=" .. scale .."]" .. output .."\\end{tikzpicture}"   tex.sprint(output)
 end
@@ -161,9 +161,9 @@ end
 
 -- buildVoronoi with MP
 function buildVoronoiMPBWinc(chaine,beginning, ending,mode,points,bbox,scale,tri,styleD,styleV)
-   listPoints = buildList(chaine, mode)
-   triangulation = BowyerWatson(listPoints,bbox)
-   listVoronoi = buildVoronoi(listPoints, triangulation)
+   local listPoints = buildList(chaine, mode)
+   local triangulation = BowyerWatson(listPoints,bbox)
+   local listVoronoi = buildVoronoi(listPoints, triangulation)
    output = traceVoronoiMP(listPoints,triangulation,listVoronoi,points,tri,styleD,styleV)
    output = "\\leavevmode\\begin{mplibcode}u:="..scale..";"..beginning .. output .. ending .. "\\end{mplibcode}"
    tex.sprint(output)
@@ -172,9 +172,9 @@ end
 
 -- buildVoronoi with TikZ
 function buildVoronoiTikZBWinc(chaine,beginning, ending,mode,points,bbox,scale,tri,color,colorBbox,colorVoronoi)
-   listPoints = buildList(chaine, mode,styleD,styleV)
-   triangulation = BowyerWatson(listPoints,bbox)
-   listVoronoi = buildVoronoi(listPoints, triangulation)
+   local listPoints = buildList(chaine, mode,styleD,styleV)
+   local triangulation = BowyerWatson(listPoints,bbox)
+   local listVoronoi = buildVoronoi(listPoints, triangulation)
    output = traceVoronoiTikZ(listPoints,triangulation,listVoronoi,points,tri,color,colorBbox,colorVoronoi,styleD,styleV)
    output = "\\noindent\\begin{tikzpicture}[x=" .. scale .. ",y=" .. scale .."]" ..beginning.. output..ending .."\\end{tikzpicture}"
    tex.sprint(output)
@@ -258,8 +258,8 @@ end
 
 -- buildMesh with MP
 function buildMeshMPBW(chaine,mode,points,bbox,scale)
-   listPoints = buildList(chaine, mode)
-   triangulation = BowyerWatson(listPoints,bbox)
+   local listPoints = buildList(chaine, mode)
+   local triangulation = BowyerWatson(listPoints,bbox)
    output = traceMeshMP(listPoints, triangulation,points)
    output = "\\leavevmode\\begin{mplibcode}beginfig(0);u:="..scale.. ";" .. output .."endfig;\\end{mplibcode}"
    tex.sprint(output)
@@ -267,8 +267,8 @@ end
 
 -- buildMesh with MP include code
 function buildMeshMPBWinc(chaine,beginning, ending,mode,points,bbox,scale)
-   listPoints = buildList(chaine, mode)
-   triangulation = BowyerWatson(listPoints,bbox)
+   local listPoints = buildList(chaine, mode)
+   local triangulation = BowyerWatson(listPoints,bbox)
    output = traceMeshMP(listPoints, triangulation,points)
    output = "\\leavevmode\\begin{mplibcode}u:="..scale..";"..beginning .. output .. ending .. "\\end{mplibcode}"
    tex.sprint(output)
@@ -276,8 +276,8 @@ end
 
 -- buildMesh with TikZ
 function buildMeshTikZBW(chaine,mode,points,bbox,scale,color,colorBbox)
-   listPoints = buildList(chaine, mode)
-   triangulation = BowyerWatson(listPoints,bbox)
+   local listPoints = buildList(chaine, mode)
+   local triangulation = BowyerWatson(listPoints,bbox)
    output = traceMeshTikZ(listPoints, triangulation,points,color,colorBbox)
    output = "\\noindent\\begin{tikzpicture}[x=" .. scale .. ",y=" .. scale .."]" .. output .."\\end{tikzpicture}"
    tex.sprint(output)
@@ -285,8 +285,8 @@ end
 
 -- buildMesh with TikZ
 function buildMeshTikZBWinc(chaine,beginning, ending,mode,points,bbox,scale,color,colorBbox)
-   listPoints = buildList(chaine, mode)
-   triangulation = BowyerWatson(listPoints,bbox)
+   local listPoints = buildList(chaine, mode)
+   local triangulation = BowyerWatson(listPoints,bbox)
    output = traceMeshTikZ(listPoints, triangulation,points,color,colorBbox)
    output = "\\noindent\\begin{tikzpicture}[x=" .. scale .. ",y=" .. scale .."]" ..beginning.. output..ending .."\\end{tikzpicture}"
    tex.sprint(output)
@@ -352,7 +352,7 @@ end
 
 -- print points to mesh
 function printPointsMP(chaine,mode,points,bbox,scale)
-   listPoints = buildList(chaine, mode)
+   local listPoints = buildList(chaine, mode)
    if(bbox == "bbox" ) then
       listPoints = buildBoundingBox(listPoints)
    end
@@ -364,7 +364,7 @@ end
 
 -- print points to mesh
 function printPointsMPinc(chaine,beginning, ending, mode,points,bbox,scale)
-   listPoints = buildList(chaine, mode)
+   local listPoints = buildList(chaine, mode)
    if(bbox == "bbox" ) then
       listPoints = buildBoundingBox(listPoints)
    end
@@ -375,7 +375,7 @@ end
 
 -- print points to mesh
 function printPointsTikZ(chaine,mode,points,bbox,scale,color,colorBbox)
-   listPoints = buildList(chaine, mode)
+   local listPoints = buildList(chaine, mode)
    if(bbox == "bbox" ) then
       listPoints = buildBoundingBox(listPoints)
    end
@@ -387,7 +387,7 @@ end
 
 -- print points to mesh
 function printPointsTikZinc(chaine,beginning, ending, mode,points,bbox,scale,color,colorBbox)
-   listPoints = buildList(chaine, mode)
+   local listPoints = buildList(chaine, mode)
    if(bbox == "bbox" ) then
       listPoints = buildBoundingBox(listPoints)
    end
@@ -399,8 +399,8 @@ end
 
 -- buildMesh
 function buildRect(largeur,a,b,nbrA, nbrB)
-   listPoints = rectangleList(a,b,nbrA,nbrB)
-   triangulation = BowyerWatson(listPoints,"none")
+   local listPoints = rectangleList(a,b,nbrA,nbrB)
+   local triangulation = BowyerWatson(listPoints,"none")
    traceTikZ(listPoints, triangulation,largeur,"none")
 end
 
@@ -409,8 +409,8 @@ end
 function TeXaddOnePointTikZ(listPoints,P,step,bbox,color,colorBack, colorNew, colorCircle,colorBbox)
    output = ""
    -- build the triangulation
-   triangulation = BowyerWatson(listPoints,bbox)
-   badTriangles = buildBadTriangles(P,triangulation)
+   local triangulation = BowyerWatson(listPoints,bbox)
+   local badTriangles = buildBadTriangles(P,triangulation,listPoints)
    for i=1,#listPoints do
       output = output .. "\\coordinate (MeshPoints".. i .. ") at  (" .. listPoints[i].x .. "," .. listPoints[i].y .. ");"
    end
@@ -541,8 +541,10 @@ function TeXaddOnePointMPBW(listPoints,P,step,bbox)
    output = "";
    output = output .. "pair MeshPoints[];"
    -- build the triangulation
+   local triangulation = {}
+   local badTriangles = {}
    triangulation = BowyerWatson(listPoints,bbox)
-   badTriangles = buildBadTriangles(P,triangulation)
+   badTriangles = buildBadTriangles(P,triangulation,listPoints)
    for i=1,#listPoints do
       output = output .. "MeshPoints[".. i .. "] = (" .. listPoints[i].x .. "," .. listPoints[i].y .. ")*u;"
    end
@@ -673,6 +675,7 @@ end
 
 
 function TeXOnePointTikZBW(chaine,point,step,scale,mode,bbox,color,colorBack,colorNew,colorCircle,colorBbox)
+   local listPoints = {}
    if(mode=="int") then
       Sx,Sy=string.match(point,"%((.+),(.+)%)")
       P = {x=Sx, y=Sy}
@@ -687,6 +690,7 @@ function TeXOnePointTikZBW(chaine,point,step,scale,mode,bbox,color,colorBack,col
 end
 
 function TeXOnePointTikZBWinc(chaine,point,beginning, ending,step,scale,mode,bbox,color,colorBack,colorNew,colorCircle,colorBbox)
+   local listPoints = {}
    if(mode=="int") then
       Sx,Sy=string.match(point,"%((.+),(.+)%)")
       P = {x=Sx, y=Sy}
@@ -701,6 +705,7 @@ function TeXOnePointTikZBWinc(chaine,point,beginning, ending,step,scale,mode,bbo
 end
 
 function TeXOnePointMPBW(chaine,point,step,scale,mode,bbox)
+   local listPoints = {}
    if(mode=="int") then
       Sx,Sy=string.match(point,"%((.+),(.+)%)")
       P = {x=Sx, y=Sy}
@@ -715,6 +720,7 @@ function TeXOnePointMPBW(chaine,point,step,scale,mode,bbox)
 end
 
 function TeXOnePointMPBWinc(chaine,point,beginning,ending,step,scale,mode,bbox)
+   local listPoints = {}
    if(mode=="int") then
       Sx,Sy=string.match(point,"%((.+),(.+)%)")
       P = {x=Sx, y=Sy}
@@ -730,14 +736,14 @@ end
 
 
 function drawGmshMP(file,points,scale)
-   listPoints,triangulation = readGmsh(file)
+   local listPoints,triangulation = readGmsh(file)
    output = traceMeshMP(listPoints,triangulation,points)
    output = "\\leavevmode\\begin{mplibcode}beginfig(0);u:="..scale.. ";" .. output .."endfig;\\end{mplibcode}"
    tex.sprint(output)
 end
 
 function drawGmshMPinc(file,beginning,ending,points,scale)
-   listPoints,triangulation = readGmsh(file)
+   local listPoints,triangulation = readGmsh(file)
    output = traceMeshMP(listPoints,triangulation,points)
    output = "\\leavevmode\\begin{mplibcode}u:="..scale..";"..beginning .. output .. ending .. "\\end{mplibcode}"
    tex.sprint(output)
@@ -747,7 +753,7 @@ end
 
 --
 function drawGmshTikZ(file,points,scale,color)
-   listPoints,triangulation = readGmsh(file)
+   local listPoints,triangulation = readGmsh(file)
    output = traceMeshTikZ(listPoints, triangulation,points,color,colorBbox)
    output = "\\noindent\\begin{tikzpicture}[x=" .. scale .. ",y=" .. scale .."]" .. output .."\\end{tikzpicture}"
    tex.sprint(output)
@@ -755,7 +761,7 @@ end
 
 --
 function drawGmshTikZinc(file,beginning, ending,points,scale,color)
-   listPoints,triangulation = readGmsh(file)
+   local listPoints,triangulation = readGmsh(file)
    output = traceMeshTikZ(listPoints, triangulation,points,color,colorBbox)
    output = "\\noindent\\begin{tikzpicture}[x=" .. scale .. ",y=" .. scale .."]" ..beginning.. output..ending .."\\end{tikzpicture}"
    tex.sprint(output)
@@ -764,8 +770,8 @@ end
 
 -- buildVoronoi with MP
 function gmshVoronoiMP(file,points,scale,tri,styleD,styleV)
-   listPoints,triangulation = readGmsh(file)
-   listVoronoi = buildVoronoi(listPoints, triangulation)
+   local listPoints,triangulation = readGmsh(file)
+   local listVoronoi = buildVoronoi(listPoints, triangulation)
    output = traceVoronoiMP(listPoints,triangulation,listVoronoi,points,tri,styleD,styleV)
    output = "\\leavevmode\\begin{mplibcode}beginfig(0);u:="..scale.. ";" .. output .."endfig;\\end{mplibcode}"
    tex.sprint(output)
@@ -774,8 +780,8 @@ end
 
 -- buildVoronoi with TikZ
 function gmshVoronoiTikZ(file,points,scale,tri,color,colorVoronoi,styleD,styleV)
-   listPoints,triangulation = readGmsh(file)
-   listVoronoi = buildVoronoi(listPoints, triangulation)
+   local listPoints,triangulation = readGmsh(file)
+   local listVoronoi = buildVoronoi(listPoints, triangulation)
    output = traceVoronoiTikZ(listPoints,triangulation,listVoronoi,points,tri,color,colorBbox,colorVoronoi,styleD,styleV)
    output = "\\noindent\\begin{tikzpicture}[x=" .. scale .. ",y=" .. scale .."]" .. output .."\\end{tikzpicture}"   tex.sprint(output)
 end
@@ -783,8 +789,8 @@ end
 
 -- buildVoronoi with MP
 function gmshVoronoiMPinc(file,beginning, ending,points,scale,tri,styleD,styleV)
-   listPoints,triangulation = readGmsh(file)
-   listVoronoi = buildVoronoi(listPoints, triangulation)
+   local listPoints,triangulation = readGmsh(file)
+   local listVoronoi = buildVoronoi(listPoints, triangulation)
    output = traceVoronoiMP(listPoints,triangulation,listVoronoi,points,tri,styleD,styleV)
    output = "\\leavevmode\\begin{mplibcode}u:="..scale..";"..beginning .. output .. ending .. "\\end{mplibcode}"
    tex.sprint(output)
@@ -793,8 +799,8 @@ end
 
 -- buildVoronoi with TikZ
 function gmshVoronoiTikZinc(file,beginning, ending,points,scale,tri,color,colorVoronoi,styleD,styleV)
-   listPoints,triangulation = readGmsh(file)
-   listVoronoi = buildVoronoi(listPoints, triangulation)
+   local listPoints,triangulation = readGmsh(file)
+   local listVoronoi = buildVoronoi(listPoints, triangulation)
    output = traceVoronoiTikZ(listPoints,triangulation,listVoronoi,points,tri,color,colorBbox,colorVoronoi,styleD,styleV)
    output = "\\noindent\\begin{tikzpicture}[x=" .. scale .. ",y=" .. scale .."]" ..beginning.. output..ending .."\\end{tikzpicture}"
    tex.sprint(output)
@@ -813,7 +819,6 @@ end
 function  tracePolygonMP(polygon,points)
    output = "";
    output = output .. "pair polygon[];"
-   print(#polygon)
    for i=1,#polygon do
       output = output .. "polygon[".. i .. "] = (" .. polygon[i].x .. "," .. polygon[i].y .. ")*u;"
    end
@@ -841,11 +846,8 @@ function drawMeshPolygonMP(chaine,mode,h,step,
                              points,scale)
    local polygon = buildList(chaine, mode)
    polygon = addPointsPolygon(polygon,h)
-   print(#polygon)
    local grid = buildGrid(polygon,h)
-   print(#polygon)
    local listPoints = addGridPoints(polygon,grid,h)
-   print(#polygon)
    if(step=="polygon") then
       -- the polygon
       output = tracePolygonMP(polygon,points)
index 10a2084..833684e 100644 (file)
@@ -13,7 +13,7 @@ end
 -- Delaunay meshing
 function BowyerWatson (listPoints,bbox)
    local triangulation = {}
-   local lgth = #listPoints
+   lgth = #listPoints
    -- add four points to listPoints to have a bounding box
    listPoints = buildBoundingBox(listPoints)
    -- the first triangle
@@ -139,7 +139,6 @@ end
 
 function buildBadTriangles(point, triangulation,listPoints)
    local badTriangles = {}
-   print(#triangulation)
    for j=1,#triangulation do -- for all triangles
       A = listPoints[triangulation[j][1]]
       B = listPoints[triangulation[j][2]]
@@ -365,14 +364,9 @@ function addPointsPolygon(polygon,h)
       -- if the distance between two ponits of the polygon is greater than 1.5*h
       if(dist>=2*h) then
          n = math.floor(dist/h)
-         print(polygon[i].x,polygon[i].y,polygon[ip].x,polygon[ip].y)
          step = dist/(n+1)
-         print("step="..step)
-         print("n="..n)
          for j=1,n do
-            print(j*step)
             a = {x=polygon[i].x+j*step*(polygon[ip].x-polygon[i].x)/dist,y=polygon[i].y+j*step*(polygon[ip].y-polygon[i].y)/dist}
-            print("new = "..a.x.."   "..a.y)
             table.insert(newPolygon,k+j,a)
          end
          k=k+n
@@ -427,8 +421,8 @@ end
 
 -- function give a real polygon without repeting points
 function cleanPoly(polygon)
-   polyNew = {}
-   polyCopy = shallowCopy(polygon)
+   local polyNew = {}
+   local polyCopy = shallowCopy(polygon)
    e1 = polyCopy[1][1]
    e2 = polyCopy[1][2]
    table.insert(polyNew, e1)
@@ -464,7 +458,7 @@ end
 
 -- build the list of points extern and stop at nbr
 function buildListExt(chaine, stop)
-   listPoints = {}
+   local listPoints = {}
    io.input(chaine) -- open the file
    text=io.read("*all")
    lines=string.explode(text,"\n+") -- all the lines
@@ -500,8 +494,8 @@ function readGmsh(file)
    io.input(file) -- open the file
    text=io.read("*all")
    local lines = split(text,"\n+") -- all the lines
-   listPoints={}
-   triangulation ={}
+   local listPoints={}
+   local triangulation ={}
    boolNodes = false
    Jnodes = 0
    boolElements = false
index 1ef9f3f..c7e8051 100644 (file)
Binary files a/test/delaunay.pdf and b/test/delaunay.pdf differ
index 83dcdfb..1837942 100644 (file)
 \begin{document}
 
 
-% \section{MetaPost}
-
-% \buildMeshBW[print=points,  meshpoint = I, color=red]{(0,0);(3.5,3);(7,0);(7.5,5);(1.61,3.14);(3,1);(6,1.5)}
-
-% %\buildMeshBW[tikz, bbox = show]{(0,0);(3.5,3);(7,0);(7.5,5);(1.61,3.14);(3,1);(6,1.5)}
-
-% \buildMeshBW[mode=ext,bbox = show, color=red,colorBbox = blue]{mesh.txt}
-
-% \drawPointsMesh[mode=ext,bbox = show, color=red,print=points]{mesh.txt}
-
-% \drawPointsMesh[mode=ext,bbox = show, color=red]{mesh.txt}
-
-
-% \buildMeshBWinc[mode=ext,bbox = show, color=red,colorBbox = blue]{mesh.txt}{%
-%   beginfig(0);
-% }%
-% {%
-%   draw MeshPoints[3] -- MeshPoints[9];
-%   endfig;
-% }
-
-% \meshAddPointBW[
-% meshpoint = x,
-% colorNew =green!20!red,
-% colorBack=red!10,
-% colorCircle = green!70,
-% scale=0.6cm]
-% {(0,0);(3.5,3);(7,0);(7.5,5);(1.61,3.14);(6,4)}{(3,1)}
-% \meshAddPointBW[
-%  color = green,
-%  meshpoint = x,
-%  colorBack=red!10,
-%  colorNew = green!20!red,
-%  scale=0.6cm,
-%  step=cavity]
-%  {(0,0);(3.5,3);(7,0);(7.5,5);(1.61,3.14);(6,4)}{(3,1)}
-% \meshAddPointBW[
-% meshpoint = x,
-% colorBack=red!10,
-% colorNew = green!20!red,
-% scale=0.6cm,
-% step=badtriangles,
-% newpoint = y,
-% bbox = show,
-% colorBbox = black
-% ]
-% {(0,0);(3.5,3);(7,0);(7.5,5);(1.61,3.14);(6,4)}{(3,1)}
-
-% \mplibcolor\myclr{red}
-
-% \newcommand\test{draw (0,0) -- (2cm,0) withcolor \myclr;}
-
-% \begin{mplibcode}
-%   beginfig(0);
-%   %\meshAddOnePoint[picture=embedded]{(0,0);(3.5,3);(7,0);(7.5,5);(1.61,3.14);(6,4)}{(3,1)}
-%   \test
-%   endfig;
-% \end{mplibcode}
-
-% \meshAddPointBWinc[
-% meshpoint = x,
-% colorBack=red!10,
-% colorNew = green!20!red,
-% scale=0.6cm,
-% step=badtriangles,
-% newpoint = y,
-% bbox = show,
-% colorBbox = blue!20,
-% ]
-% {(0,0);(3.5,3);(7,0);(7.5,5);(1.61,3.14);(6,4)}{(3,1)}{%
-% beginfig(0);
-% }%
-% {%
-%   draw (-1,-1)*u--(8.5,-1)*u--(8.5,6)*u--(-1,6)*u--cycle withcolor \mpcolor{red};
-% endfig;
+\section{MetaPost}
+
+\buildMeshBW[print=points,  meshpoint = I, color=red]{(0,0);(3.5,3);(7,0);(7.5,5);(1.61,3.14);(3,1);(6,1.5)}
+
+%\buildMeshBW[tikz, bbox = show]{(0,0);(3.5,3);(7,0);(7.5,5);(1.61,3.14);(3,1);(6,1.5)}
+
+\buildMeshBW[mode=ext,bbox = show, color=red,colorBbox = blue]{mesh.txt}
+
+\drawPointsMesh[mode=ext,bbox = show, color=red,print=points]{mesh.txt}
+
+\drawPointsMesh[mode=ext,bbox = show, color=red]{mesh.txt}
+
+
+\buildMeshBWinc[mode=ext,bbox = show, color=red,colorBbox = blue]{mesh.txt}{%
+  beginfig(0);
+}%
+{%
+  draw MeshPoints[3] -- MeshPoints[9];
+  endfig;
+}
+
+\meshAddPointBW[
+meshpoint = x,
+colorNew =green!20!red,
+colorBack=red!10,
+colorCircle = green!70,
+scale=0.6cm]
+{(0,0);(3.5,3);(7,0);(7.5,5);(1.61,3.14);(6,4)}{(3,1)}
+\meshAddPointBW[
+ color = green,
+ meshpoint = x,
+ colorBack=red!10,
+ colorNew = green!20!red,
+ scale=0.6cm,
+ step=cavity]
+ {(0,0);(3.5,3);(7,0);(7.5,5);(1.61,3.14);(6,4)}{(3,1)}
+\meshAddPointBW[
+meshpoint = x,
+colorBack=red!10,
+colorNew = green!20!red,
+scale=0.6cm,
+step=badtriangles,
+newpoint = y,
+bbox = show,
+colorBbox = black
+]
+{(0,0);(3.5,3);(7,0);(7.5,5);(1.61,3.14);(6,4)}{(3,1)}
+
+\mplibcolor\myclr{red}
+
+\newcommand\test{draw (0,0) -- (2cm,0) withcolor \myclr;}
+
+\begin{mplibcode}
+  beginfig(0);
+  %\meshAddOnePoint[picture=embedded]{(0,0);(3.5,3);(7,0);(7.5,5);(1.61,3.14);(6,4)}{(3,1)}
+  \test
+  endfig;
+\end{mplibcode}
+
+\meshAddPointBWinc[
+meshpoint = x,
+colorBack=red!10,
+colorNew = green!20!red,
+scale=0.6cm,
+step=badtriangles,
+newpoint = y,
+bbox = show,
+colorBbox = blue!20,
+]
+{(0,0);(3.5,3);(7,0);(7.5,5);(1.61,3.14);(6,4)}{(3,1)}{%
+beginfig(0);
+}%
+{%
+  draw (-1,-1)*u--(8.5,-1)*u--(8.5,6)*u--(-1,6)*u--cycle withcolor \mpcolor{red};
+endfig;
+}
+
+
+\section{tikz}
+
+\buildMeshBW[tikz,print=points,  meshpoint = I,
+color=red]{(0,0);(3.5,3);(7,0);(7.5,5);(1.61,3.14);(3,1);(6,1.5)}
+
+\buildMeshBW[tikz,mode=ext, color=red]{mesh.txt}
+
+\drawPointsMesh[tikz,mode=ext,bbox = show,
+color=red,print=points]{mesh.txt}
+\drawPointsMesh[tikz,mode=ext,bbox = show, color=red]{mesh.txt}
+
+\buildMeshBWinc[tikz,mode=ext,bbox = show, colorBbox = blue]{mesh.txt}{%
+}%
+{%
+  \draw[color = red] (0,0) -- (3,3);
+}
+
+\meshAddPointBW[
+tikz,
+color = green,
+meshpoint = x,
+colorBack=red!10,
+colorNew = green!20!red,
+scale=0.6cm,
+step=cavity]
+{(0,0);(3.5,3);(7,0);(7.5,5);(1.61,3.14);(6,4)}{(3,1)}
+
+\meshAddPointBWinc[
+tikz,
+meshpoint = x,
+colorBack=red!10,
+colorNew = green!20!red,
+scale=0.6cm,
+step=badtriangles,
+newpoint = y,
+bbox = show,
+colorBbox = blue!20,
+]{(0,0);(3.5,3);(7,0);(7.5,5);(1.61,3.14);(6,4)}{(3,1)}
+{}{\draw[color=green] (0,0) -- (3,3);}
+
+\meshAddPointBW[
+tikz,
+meshpoint = x,
+colorBack=red!10,
+colorNew = green!20!red,
+scale=0.6cm,
+step=badtriangles,
+newpoint = y,
+bbox = show,
+colorBbox = black
+]
+{(0,0);(3.5,3);(7,0);(7.5,5);(1.61,3.14);(6,4)}{(3,1)}
+
+
+% \def\CircumPoint{y}
+% \luampcolor
+% \directlua{
+%   buildVoronoiMP("mesh.txt","ext","points","","1cm","show")
 % }
+\buildVoronoiBW[mode=ext]{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}
 
 
-% \section{tikz}
+\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}
 
-% \buildMeshBW[tikz,print=points,  meshpoint = I,
-% color=red]{(0,0);(3.5,3);(7,0);(7.5,5);(1.61,3.14);(3,1);(6,1.5)}
+\buildVoronoiBWinc[mode=ext]{mesh.txt}{beginfig(0);}{endfig;}
+\buildVoronoiBWinc[tikz,mode=ext,print=points]{mesh.txt}{}{}
 
-% \buildMeshBW[tikz,mode=ext, color=red]{mesh.txt}
 
-% \drawPointsMesh[tikz,mode=ext,bbox = show,
-% color=red,print=points]{mesh.txt}
-% \drawPointsMesh[tikz,mode=ext,bbox = show, color=red]{mesh.txt}
-
-% \buildMeshBWinc[tikz,mode=ext,bbox = show, colorBbox = blue]{mesh.txt}{%
-% }%
-% {%
-%   \draw[color = red] (0,0) -- (3,3);
-% }
+\buildVoronoiBWinc[tikz,mode=ext,print=points,delaunay=show,meshpoint=x,circumpoint=y]{mesh.txt}{}{\draw[color=blue,thick] (0,0)--(3,3);}
 
-% \meshAddPointBW[
-% tikz,
-% color = green,
-% meshpoint = x,
-% colorBack=red!10,
-% colorNew = green!20!red,
-% scale=0.6cm,
-% step=cavity]
-% {(0,0);(3.5,3);(7,0);(7.5,5);(1.61,3.14);(6,4)}{(3,1)}
-
-% \meshAddPointBWinc[
-% tikz,
-% meshpoint = x,
-% colorBack=red!10,
-% colorNew = green!20!red,
-% scale=0.6cm,
-% step=badtriangles,
-% newpoint = y,
-% bbox = show,
-% colorBbox = blue!20,
-% ]{(0,0);(3.5,3);(7,0);(7.5,5);(1.61,3.14);(6,4)}{(3,1)}
-% {}{\draw[color=green] (0,0) -- (3,3);}
-
-% \meshAddPointBW[
-% tikz,
-% meshpoint = x,
-% colorBack=red!10,
-% colorNew = green!20!red,
-% scale=0.6cm,
-% step=badtriangles,
-% newpoint = y,
-% bbox = show,
-% colorBbox = black
-% ]
-% {(0,0);(3.5,3);(7,0);(7.5,5);(1.61,3.14);(6,4)}{(3,1)}
-
-
-% % \def\CircumPoint{y}
-% % \luampcolor
-% % \directlua{
-% %   buildVoronoiMP("mesh.txt","ext","points","","1cm","show")
-% % }
-% \buildVoronoiBW[mode=ext]{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}
-
-% \buildVoronoiBWinc[mode=ext]{mesh.txt}{beginfig(0);}{endfig;}
-% \buildVoronoiBWinc[tikz,mode=ext,print=points]{mesh.txt}{}{}
-
-
-% \buildVoronoiBWinc[tikz,mode=ext,print=points,delaunay=show,meshpoint=x,circumpoint=y]{mesh.txt}{}{\draw[color=blue,thick] (0,0)--(3,3);}
-
-% \def\MeshPoints{P}
-% \directlua{
-%   drawGmshMP("maillage.msh","points","8cm")
-% }\par
-% \directlua{
-%   gmshVoronoiMP("maillage.msh","none","8cm","none")
-% }
+\def\MeshPoints{P}
+\directlua{
+  drawGmshMP("maillage.msh","points","8cm")
+}\par
+\directlua{
+  gmshVoronoiMP("maillage.msh","none","8cm","none")
+}
 
-\drawGmsh[tikz,scale=8cm]{maillage.msh}
+\drawGmsh[tikz,scale=8cm]{maillage.msh}
 
-\gmshVoronoi[tikz,scale=8cm,print=points,delaunay=show]{maillage.msh}
+\gmshVoronoi[tikz,scale=8cm,print=points,delaunay=show]{maillage.msh}
 
 
 \meshPolygon[step=polygon,scale=3cm]{(0,0);(1,0);(1,0.5);(0.5,1);(-0.3,0.3)}

Licence Creative Commons Les fichiers de Syracuse sont mis à disposition (sauf mention contraire) selon les termes de la
Licence Creative Commons Attribution - Pas d’Utilisation Commerciale - Partage dans les Mêmes Conditions 4.0 International.