Initialisation du projet
authorMaxime Chupin (escudo) <chupin@fougeriens.org>
Sun, 20 Nov 2016 23:01:35 +0000 (00:01 +0100)
committerMaxime Chupin (escudo) <chupin@fougeriens.org>
Sun, 20 Nov 2016 23:01:35 +0000 (00:01 +0100)
luamesh.lua [new file with mode: 0644]
luamesh.sty [new file with mode: 0644]
test/delaunay-crop.pdf [new file with mode: 0644]
test/delaunay.aux [new file with mode: 0644]
test/delaunay.log [new file with mode: 0644]
test/delaunay.pdf [new file with mode: 0644]
test/delaunay.tex [new file with mode: 0644]
test/luamesh.lua [new symlink]
test/luamesh.sty [new symlink]
test/mesh.txt [new file with mode: 0644]

diff --git a/luamesh.lua b/luamesh.lua
new file mode 100644 (file)
index 0000000..f165fe6
--- /dev/null
@@ -0,0 +1,591 @@
+-- Bowyer and Watson algorithm
+-- Delaunay meshing
+function BowyerWatson (listPoints,bbox)
+   local triangulation = {}
+   local lgth = #listPoints
+   -- add four points to listPoints to have a bounding box
+   listPoints = buildBoundingBox(listPoints)
+   -- the first triangle
+   triangulation[1] = {lgth+1, lgth+2, lgth+3}
+   -- the second triangle
+   triangulation[2] = {lgth+1, lgth+3, lgth+4}
+   -- add points one by one
+   for i=1,lgth do
+      -- find the triangles which the circumcircle contained the point to add
+      badTriangles = buildBadTriangles(listPoints[i],triangulation)
+      -- build the polygon of the cavity containing the point to add
+      polygon = buildCavity(badTriangles, triangulation)
+      -- remove the bad triangles
+      for j=1,#badTriangles do
+         table.remove(triangulation,badTriangles[j]-(j-1))
+      end
+      -- build the new triangles and add them to triangulation
+      for j=1,#polygon do
+         table.insert(triangulation,{polygon[j][1],polygon[j][2],i})
+      end
+   end -- end adding points of the listPoints
+   -- remove bounding box
+   if(bbox ~= "bbox") then
+      triangulation = removeBoundingBox(triangulation,lgth)
+      table.remove(listPoints,lgth+1)
+      table.remove(listPoints,lgth+1)
+      table.remove(listPoints,lgth+1)
+      table.remove(listPoints,lgth+1)
+   end
+   return triangulation
+end
+
+
+function buildBoundingBox(listPoints)
+   -- listPoints : list of points
+   -- epsV        : parameter for the distance of the bounding box
+   local xmin, xmax, ymin, ymax, eps
+   xmin = 1000
+   ymin = 1000
+   xmax = -1000
+   ymax = -1000
+   for i=1,#listPoints do
+      if (listPoints[i].x < xmin) then
+         xmin = listPoints[i].x
+      end
+      if (listPoints[i].x > xmax) then
+         xmax = listPoints[i].x
+      end
+      if (listPoints[i].y < ymin) then
+         ymin = listPoints[i].y
+      end
+      if (listPoints[i].y > ymax) then
+         ymax = listPoints[i].y
+      end
+   end
+   eps = math.max(math.abs(xmax-xmin),math.abs(ymax-ymin))*0.15
+   xmin = xmin - eps
+   xmax = xmax + eps
+   ymin = ymin - eps
+   ymax = ymax + eps
+   -- add points of the bounding box in last positions
+   table.insert(listPoints,{x=xmin,y=ymin})
+   table.insert(listPoints,{x=xmin,y=ymax})
+   table.insert(listPoints,{x=xmax,y=ymax})
+   table.insert(listPoints,{x=xmax,y=ymin})
+   return listPoints
+end
+
+function removeBoundingBox(triangulation,lgth)
+   -- build the four bounding box edge
+   point1 = lgth+1
+   point2 = lgth+2
+   point3 = lgth+3
+   point4 = lgth+4
+   -- for all triangle
+   newTriangulation = {}
+   for i=1,#triangulation do
+      boolE1 = pointInTriangle(point1,triangulation[i])
+      boolE2 = pointInTriangle(point2,triangulation[i])
+      boolE3 = pointInTriangle(point3,triangulation[i])
+      boolE4 = pointInTriangle(point4,triangulation[i])
+      if((not boolE1) and (not boolE2) and (not boolE3) and (not boolE4)) then
+         table.insert(newTriangulation,triangulation[i])
+      end
+   end
+   return newTriangulation
+end
+
+
+function buildBadTriangles(point, triangulation)
+   badTriangles = {}
+   for j=1,#triangulation do -- for all triangles
+      A = listPoints[triangulation[j][1]]
+      B = listPoints[triangulation[j][2]]
+      C = listPoints[triangulation[j][3]]
+      center, radius = circoncircle(A,B,C)
+      CP = Vector(center,point)
+      if(VectorNorm(CP)<radius) then -- the point belongs to the circoncirle
+         table.insert(badTriangles,j)
+      end
+   end
+   return badTriangles
+end
+
+-- construction of the cavity composed by the bad triangles around the point to add
+function buildCavity(badTriangles, triangulation)
+   polygon = {}
+   for j=1,#badTriangles do -- for all bad triangles
+      ind = badTriangles[j]
+      for k=1,3 do -- for all edges
+         edge = {triangulation[ind][k],triangulation[ind][k%3+1]}
+         edgeBord = false
+         for l = 1,#badTriangles do -- for all badtriangles
+            badInd = badTriangles[l]
+            if(badInd ~= ind) then -- if not the current one
+               edgeBord = edgeBord or edgeInTriangle(edge,triangulation[badInd])
+            end
+         end --
+         -- if the edge does not belong to another bad triangle
+         if(edgeBord == false) then
+            -- insert the edge to the cavity
+            table.insert(polygon,edge)
+         end
+      end --
+   end --
+   return polygon
+end
+
+function edgeInTriangle(e,t)
+   in1 = false
+   in2 = false
+   for i=1,3 do
+      if e[1] == t[i] then
+         in1 = true
+      end
+      if e[2] == t[i] then
+         in2 = true
+      end
+   end
+   out = (in1 and in2)
+   return out
+end
+
+function pointInTriangle(e,t)
+   in1 = false
+   for i=1,3 do
+      if e == t[i] then
+         in1 = true
+      end
+   end
+   return in1
+end
+
+
+function Vector(A,B)
+   local out = {x = B.x - A.x, y = B.y - A.y}
+   return out
+end
+
+function VectorNorm(NP)
+   return math.sqrt(NP.x*NP.x +NP.y*NP.y)
+end
+
+-- circoncircle
+function circoncircle(M, N, P)
+   -- Compute center and radius of the circoncircle of the triangle M N P
+
+   -- return : (center [Point],radius [float])
+
+   local MN = Vector(M,N)
+   local NP = Vector(N,P)
+   local PM = Vector(P,M)
+   m = VectorNorm(NP)  -- |NP|
+   n = VectorNorm(PM)  -- |PM|
+   p = VectorNorm(MN)  -- |MN|
+
+   d = (m + n + p) * (-m + n + p) * (m - n + p) * (m + n - p)
+   if d > 0 then
+      rad = m * n * p / math.sqrt(d)
+   else
+      rad = 0
+   end
+   d = -2 * (M.x * NP.y + N.x * PM.y + P.x * MN.y)
+   O = {x=0, y=0}
+   OM = Vector(O, M)
+   ON = Vector(O, N)
+   OP = Vector(O, P)
+   om2 = math.pow(VectorNorm(OM),2)  -- |OM|**2
+   on2 = math.pow(VectorNorm(ON),2)  -- |ON|**2
+   op2 = math.pow(VectorNorm(OP),2)  -- |OP|**2
+   x0 = -(om2 * NP.y + on2 * PM.y + op2 * MN.y) / d
+   y0 = (om2 * NP.x + on2 * PM.x + op2 * MN.x) / d
+   if d == 0 then
+      Out = {nil, nil}
+   else
+      Out = {x=x0, y=y0}
+   end
+   return Out, rad  -- (center [Point], R [float])
+end
+
+
+-------------------------- TeX
+-- build the list of points
+function buildList(chaine, mode)
+   -- if mode = int : the list is given in the chaine string (x1,y1);(x2,y2);...;(xn,yn)
+   -- if mode = ext : the list is given in a file line by line with space separation
+   listPoints = {}
+   if mode == "int" then
+      local points = string.explode(chaine, ";")
+      local lgth=#points
+      for i=1,lgth do
+         Sx,Sy=string.match(points[i],"%((.+),(.+)%)")
+         listPoints[i]={x=tonumber(Sx),y=tonumber(Sy)}
+      end
+   elseif mode == "ext" then
+      io.input(chaine) -- open the file
+      text=io.read("*all")
+      lines=string.explode(text,"\n+") -- all the lines
+      tablePoints={}
+      for i=1,#lines do
+        xy=string.explode(lines[i]," +")
+        listPoints[i]={x=tonumber(xy[1]),y=tonumber(xy[2])}
+      end
+   else
+      print("Non existing mode")
+   end
+   return listPoints
+end
+
+
+--
+function rectangleList(a,b,nbrA,nbrB)
+   stepA = a/nbrA
+   stepB = b/nbrB
+   listPoints = {}
+   k=1
+   for i=1,(nbrA+1) do
+      for j=1,(nbrB+1) do
+         listPoints[k] = {x = (i-1)*stepA, y=(j-1)*stepB}
+         k=k+1
+      end
+   end
+   return listPoints
+end
+
+-- trace a triangulation with TikZ
+function traceMeshTikZ(listPoints, triangulation,points,color)
+   output = ""
+   for i=1,#triangulation do
+      PointI = listPoints[triangulation[i][1]]
+      PointJ = listPoints[triangulation[i][2]]
+      PointK = listPoints[triangulation[i][3]]
+      output = output .. "\\draw[color="..color.."] (".. PointI.x ..",".. PointI.y ..")--("..PointJ.x..",".. PointJ.y ..")--("..PointK.x..",".. PointK.y ..")--cycle;"
+   end
+   if(points=="points") then
+      for i=1,#listPoints do
+         output = output .. "\\draw[color=".."] (" .. listPoints[i].x ..",".. listPoints[i].y .. ") node {$\\bullet$} node[anchor=north east] {$\\MeshPoint_{" .. i .. "}$};"
+      end
+   end
+   return output
+end
+
+
+-- trace a triangulation with MP
+function traceMeshMP(listPoints, triangulation,points,color)
+   output = "";
+   output = output .. " pair MeshPoints[];"
+   for i=1,#listPoints do
+      output = output .. "MeshPoints[".. i .. "] = (" .. listPoints[i].x .. "," .. listPoints[i].y .. ");"
+   end
+
+   for i=1,#triangulation do
+      PointI = listPoints[triangulation[i][1]]
+      PointJ = listPoints[triangulation[i][2]]
+      PointK = listPoints[triangulation[i][3]]
+      output = output .. "draw (".. PointI.x ..",".. PointI.y ..")*u--("..PointJ.x..",".. PointJ.y ..")*u--("..PointK.x..",".. PointK.y ..")*u--cycle withcolor \\mpcolor{"..color.. "};"
+   end
+   if(points=="points") then
+      for i=1,#listPoints do
+         output = output .. "dotlabel.llft( btex $\\MeshPoint_{" .. i .. "}$ etex, (" .. listPoints[i].x ..",".. listPoints[i].y .. ")*u) withcolor \\mpcolor{"..color.. "};"
+      end
+   end
+   return output
+end
+
+
+
+-- buildMesh with TikZ
+function buildMeshTikZ(chaine,mode,points,bbox,full,scale,color)
+   listPoints = buildList(chaine, mode)
+   triangulation = BowyerWatson(listPoints,bbox)
+   output = traceMeshTikZ(listPoints, triangulation,points,color)
+   if(full=="full") then
+      output = "\\noindent\\begin{tikzpicture}[x=" .. scale .. ",y=" .. scale .."]" .. output .."\\end{tikzpicture}"
+   end
+   tex.sprint(output)
+end
+
+
+-- buildMesh with MP
+function buildMeshMP(chaine,mode,points,bbox,full,scale,color)
+   listPoints = buildList(chaine, mode)
+   triangulation = BowyerWatson(listPoints,bbox)
+   output = traceMeshMP(listPoints, triangulation,points,color)
+   if(full=="full") then
+      output = "\\leavevmode\\begin{mplibcode}beginfig(0);u:="..scale.. ";" .. output .."endfig;\\end{mplibcode}"
+   else
+      output = "u:="..scale.. ";".. output
+   end
+   tex.sprint(output)
+end
+
+-- buildMesh
+function buildRect(largeur,a,b,nbrA, nbrB)
+   listPoints = rectangleList(a,b,nbrA,nbrB)
+   triangulation = BowyerWatson(listPoints,"none")
+   traceTikZ(listPoints, triangulation,largeur,"none")
+end
+
+
+-- function give a real polygon without repeting points
+function cleanPoly(polygon)
+   polyNew = {}
+   e1 = polygon[1][1]
+   e2 = polygon[1][2]
+   table.insert(polyNew, e1)
+   table.insert(polyNew, e2)
+   j = 2
+   for i=2,#polygon do
+      bool1 = (polygon[i][1] == polyNew[j])
+      bool2 = (polygon[i][2] == polyNew[j])
+      if(bool1 or bool2) then -- the edge has a common point with polyNew[j]
+         if(not bool1) then
+            table.insert(polyNew, polygon[i][1])
+            j = j+1
+         elseif(not bool2) then
+            table.insert(polyNew, polygon[i][2])
+            j = j+1
+         end
+      end
+   end
+   return polyNew
+end
+
+--
+function TeXaddOnePointTikZ(chaine,point,step,color,colorBack, colorNew, colorCircle)
+   Sx,Sy=string.match(point,"%((.+),(.+)%)")
+   P = {x=Sx, y=Sy}
+   output = ""
+   listPoints = buildList(chaine, "int")
+   -- build the triangulation
+   triangulation = BowyerWatson(listPoints,"none")
+   badTriangles = buildBadTriangles(P,triangulation)
+   if(step == "badT") then
+      -- draw all triangle
+      for i=1,#triangulation do
+         PointI = listPoints[triangulation[i][1]]
+         PointJ = listPoints[triangulation[i][2]]
+         PointK = listPoints[triangulation[i][3]]
+         output = output .. "\\draw[color="..color.."] (".. PointI.x ..",".. PointI.y ..")--("..PointJ.x..",".. PointJ.y ..")--("..PointK.x..",".. PointK.y ..")--cycle;"
+      end
+      -- draw and fill the bad triangle
+      for i=1,#badTriangles do
+         PointI = listPoints[triangulation[badTriangles[i]][1]]
+         PointJ = listPoints[triangulation[badTriangles[i]][2]]
+         PointK = listPoints[triangulation[badTriangles[i]][3]]
+         output = output .. "\\draw[fill="..colorBack.."] (".. PointI.x ..",".. PointI.y ..")--("..PointJ.x..",".. PointJ.y ..")--("..PointK.x..",".. PointK.y ..")--cycle;"
+      end
+      -- draw the circoncircle
+      for i=1,#badTriangles do
+         PointI = listPoints[triangulation[badTriangles[i]][1]]
+         PointJ = listPoints[triangulation[badTriangles[i]][2]]
+         PointK = listPoints[triangulation[badTriangles[i]][3]]
+         center, radius = circoncircle(PointI, PointJ, PointK)
+         output = output .. "\\draw[dashed, color="..colorCircle.."] ("..center.x .. "," .. center.y .. ") circle ("..radius ..");"
+      end
+      -- mark the points
+      for i=1,#listPoints do
+         output = output .. "\\draw[color ="..color.."] (" .. listPoints[i].x ..",".. listPoints[i].y .. ") node {$\\bullet$} node[anchor=north east] {$\\MeshPoint_{" .. i .. "}$};"
+      end
+      -- mark the point to add
+      output = output .. "\\draw[color="..colorNew.."] (" .. P.x ..",".. P.y .. ") node {$\\bullet$} node[anchor=north east] {$\\NewPoint$};"
+   elseif(step == "cavity") then
+      polygon = buildCavity(badTriangles, triangulation)
+      polyNew = cleanPoly(polygon)
+      -- remove the bad triangles
+      for j=1,#badTriangles do
+         table.remove(triangulation,badTriangles[j]-(j-1))
+      end
+      -- draw the triangles
+      for i=1,#triangulation do
+         PointI = listPoints[triangulation[i][1]]
+         PointJ = listPoints[triangulation[i][2]]
+         PointK = listPoints[triangulation[i][3]]
+         output = output .. "\\draw[color="..color.."] (".. PointI.x ..",".. PointI.y ..")--("..PointJ.x..",".. PointJ.y ..")--("..PointK.x..",".. PointK.y ..")--cycle;"
+      end
+      -- fill and draw the cavity
+      path = ""
+      for i=1,#polyNew do
+         PointI = listPoints[polyNew[i]]
+         path = path .. "(".. PointI.x ..",".. PointI.y ..")--"
+      end
+      output = output .. "\\draw[color="..colorNew..",fill ="..colorBack..", thick] " .. path .. "cycle;"
+      -- mark the points of the mesh
+      for i=1,#listPoints do
+         output = output .. "\\draw[color="..color.."] (" .. listPoints[i].x ..",".. listPoints[i].y .. ") node {$\\bullet$} node[anchor=north east] {$\\MeshPoint_{" .. i .. "}$};"
+      end
+      -- mark the adding point
+      output = output .. "\\draw[color="..colorNew.."] (" .. P.x ..",".. P.y .. ") node {$\\bullet$} node[anchor=north east] {$\\NewPoint$};"
+   elseif(step == "newT") then
+      polygon = buildCavity(badTriangles, triangulation)
+      polyNew = cleanPoly(polygon)
+      -- remove the bad triangles
+      for j=1,#badTriangles do
+         table.remove(triangulation,badTriangles[j]-(j-1))
+      end
+      -- draw the triangle of the triangulation
+      for i=1,#triangulation do
+         PointI = listPoints[triangulation[i][1]]
+         PointJ = listPoints[triangulation[i][2]]
+         PointK = listPoints[triangulation[i][3]]
+         output = output .. "\\draw[color ="..color.."] (".. PointI.x ..",".. PointI.y ..")--("..PointJ.x..",".. PointJ.y ..")--("..PointK.x..",".. PointK.y ..")--cycle;"
+      end
+      -- fill and draw the cavity
+      path = ""
+      for i=1,#polyNew do
+         PointI = listPoints[polyNew[i]]
+         path = path .. "(".. PointI.x ..",".. PointI.y ..")--"
+      end
+      output = output .. "\\draw[color="..colorNew..",fill ="..colorBack..", thick] " .. path .. "cycle;"
+      -- draw the new triangles composed by the edges of the polygon and the added point
+      for i=1,#polygon do
+         output = output .. "\\draw[color=TeXCluaMeshNewTikZ, thick]".."(".. listPoints[polygon[i][1]].x .. "," .. listPoints[polygon[i][1]].y .. ") -- (" .. listPoints[polygon[i][2]].x .. "," .. listPoints[polygon[i][2]].y ..");"
+         output = output .. "\\draw[color="..colorNew..", thick]".."(".. listPoints[polygon[i][1]].x .. "," .. listPoints[polygon[i][1]].y .. ") -- (" .. P.x .. "," .. P.y ..");"
+         output = output .. "\\draw[color="..colorNew..", thick]".."(".. listPoints[polygon[i][2]].x .. "," .. listPoints[polygon[i][2]].y .. ") -- (" .. P.x .. "," .. P.y ..");"
+      end
+      -- mark points
+      for i=1,#listPoints do
+         output = output .. "\\draw[color="..color.."] (" .. listPoints[i].x ..",".. listPoints[i].y .. ") node {$\\bullet$} node[anchor=north east] {$\\MeshPoint_{" .. i .. "}$};"
+      end
+      -- mark the added point
+      output = output .. "\\draw[color="..colorNew.."] (" .. P.x ..",".. P.y .. ") node {$\\bullet$} node[anchor=north east] {$\\NewPoint$};"
+   end
+   return output
+end
+
+function TeXaddOnePointMP(listPoints,P,step,color,colorBack, colorNew, colorCircle)
+   output = "";
+   output = output .. "pair MeshPoints[];"
+   -- build the triangulation
+   triangulation = BowyerWatson(listPoints,"none")
+   badTriangles = buildBadTriangles(P,triangulation)
+   for i=1,#listPoints do
+      output = output .. "MeshPoints[".. i .. "] = (" .. listPoints[i].x .. "," .. listPoints[i].y .. ");"
+   end
+   if(step == "badT") then
+      -- draw all triangle
+      for i=1,#triangulation do
+         PointI = listPoints[triangulation[i][1]]
+         PointJ = listPoints[triangulation[i][2]]
+         PointK = listPoints[triangulation[i][3]]
+         output = output .. "draw (".. PointI.x ..",".. PointI.y ..")*u--("..PointJ.x..",".. PointJ.y ..")*u--("..PointK.x..",".. PointK.y ..")*u--cycle withcolor \\mpcolor{" .. color .."};"
+      end
+      -- draw and fill the bad triangle
+      for i=1,#badTriangles do
+         PointI = listPoints[triangulation[badTriangles[i]][1]]
+         PointJ = listPoints[triangulation[badTriangles[i]][2]]
+         PointK = listPoints[triangulation[badTriangles[i]][3]]
+         output = output .. "draw (".. PointI.x ..",".. PointI.y ..")*u--("..PointJ.x..",".. PointJ.y ..")*u--("..PointK.x..",".. PointK.y ..")*u--cycle withcolor \\mpcolor{" .. color .."};"
+         output = output .. "fill (".. PointI.x ..",".. PointI.y ..")*u--("..PointJ.x..",".. PointJ.y ..")*u--("..PointK.x..",".. PointK.y ..")*u--cycle withcolor \\mpcolor{" .. colorBack .."};"
+      end
+      -- draw the circoncircle
+      for i=1,#badTriangles do
+         PointI = listPoints[triangulation[badTriangles[i]][1]]
+         PointJ = listPoints[triangulation[badTriangles[i]][2]]
+         PointK = listPoints[triangulation[badTriangles[i]][3]]
+         center, radius = circoncircle(PointI, PointJ, PointK)
+         output = output .. "draw fullcircle scaled ("..radius .."*2u) shifted ("..center.x .. "*u," .. center.y .. "*u) dashed evenly withcolor \\mpcolor{" .. colorCircle .."};"
+      end
+      -- mark the points
+      for i=1,#listPoints do
+         output = output .. "dotlabel.llft (btex $\\MeshPoint_{" .. i .. "}$ etex, (" .. listPoints[i].x ..",".. listPoints[i].y .. ")*u ) withcolor \\mpcolor{" .. color .."};"
+      end
+      -- mark the point to add
+      output = output .. "dotlabel.llft (btex $\\NewPoint$ etex,(" .. P.x ..",".. P.y .. ")*u) withcolor \\mpcolor{" .. colorNew .."};"
+   elseif(step == "cavity") then
+      polygon = buildCavity(badTriangles, triangulation)
+      polyNew = cleanPoly(polygon)
+      -- remove the bad triangles
+      for j=1,#badTriangles do
+         table.remove(triangulation,badTriangles[j]-(j-1))
+      end
+      -- draw the triangles
+      for i=1,#triangulation do
+         PointI = listPoints[triangulation[i][1]]
+         PointJ = listPoints[triangulation[i][2]]
+         PointK = listPoints[triangulation[i][3]]
+         output = output .. "draw (".. PointI.x ..",".. PointI.y ..")*u--("..PointJ.x..",".. PointJ.y ..")*u--("..PointK.x..",".. PointK.y ..")*u--cycle withcolor \\mpcolor{" .. color .."};"
+      end
+      -- fill and draw the cavity
+      path = ""
+      for i=1,#polyNew do
+         PointI = listPoints[polyNew[i]]
+         path = path .. "(".. PointI.x ..",".. PointI.y ..")*u--"
+      end
+      output = output .. "fill " .. path .. "cycle withcolor \\mpcolor{" .. colorBack .."};"
+      output = output .. "draw " .. path .. "cycle withcolor \\mpcolor{" .. colorNew .."} withpen pencircle scaled 1pt;"
+      -- mark the points of the mesh
+      for i=1,#listPoints do
+         output = output .. "dotlabel.llft (btex $\\MeshPoint_{" .. i .. "}$ etex, (" .. listPoints[i].x ..",".. listPoints[i].y .. ")*u ) withcolor \\mpcolor{" .. color .."};"
+      end
+      -- mark the adding point
+      output = output .. "dotlabel.llft (btex $\\NewPoint$ etex,(" .. P.x ..",".. P.y .. ")*u) withcolor \\mpcolor{" .. colorNew .."};"
+   elseif(step == "newT") then
+      polygon = buildCavity(badTriangles, triangulation)
+      polyNew = cleanPoly(polygon)
+      -- remove the bad triangles
+      for j=1,#badTriangles do
+         table.remove(triangulation,badTriangles[j]-(j-1))
+      end
+      -- draw the triangle of the triangulation
+      for i=1,#triangulation do
+         PointI = listPoints[triangulation[i][1]]
+         PointJ = listPoints[triangulation[i][2]]
+         PointK = listPoints[triangulation[i][3]]
+         output = output .. "draw (".. PointI.x ..",".. PointI.y ..")*u--("..PointJ.x..",".. PointJ.y ..")*u--("..PointK.x..",".. PointK.y ..")*u--cycle withcolor \\mpcolor{" .. color .."};"
+      end
+      -- fill  the cavity
+      path = ""
+      for i=1,#polyNew do
+         PointI = listPoints[polyNew[i]]
+         path = path .. "(".. PointI.x ..",".. PointI.y ..")*u--"
+      end
+      output = output .. "fill " .. path .. "cycle withcolor \\mpcolor{" .. colorBack .."};"
+      -- draw the new triangles composed by the edges of the polygon and the added point
+      for i=1,#polygon do
+         output = output .. "draw".."(".. listPoints[polygon[i][1]].x .. "," .. listPoints[polygon[i][1]].y .. ")*u -- (" .. listPoints[polygon[i][2]].x .. "," .. listPoints[polygon[i][2]].y ..")*u withcolor \\mpcolor{" .. colorNew .."} withpen pencircle scaled 1pt;"
+         output = output .. "draw".."(".. listPoints[polygon[i][1]].x .. "," .. listPoints[polygon[i][1]].y .. ")*u -- (" .. P.x .. "," .. P.y ..")*u withcolor \\mpcolor{" .. colorNew .."} withpen pencircle scaled 1pt;"
+         output = output .. "draw".."(".. listPoints[polygon[i][2]].x .. "," .. listPoints[polygon[i][2]].y .. ")*u -- (" .. P.x .. "," .. P.y ..")*u withcolor \\mpcolor{" .. colorNew .."} withpen pencircle scaled 1pt;"
+      end
+      -- mark points
+      for i=1,#listPoints do
+         output = output .. "dotlabel.llft (btex $\\MeshPoint_{" .. i .. "}$ etex, (" .. listPoints[i].x ..",".. listPoints[i].y .. ")*u ) withcolor \\mpcolor{" .. color .."};"
+      end
+      -- mark the added point
+      output = output .. "dotlabel.llft (btex $\\NewPoint$ etex,(" .. P.x ..",".. P.y .. ")*u) withcolor \\mpcolor{ " .. colorNew .."};"
+   end
+   return output
+end
+
+
+-- build the list of points extern and stop at nbr
+function buildListExt(chaine, stop)
+   listPoints = {}
+   io.input(chaine) -- open the file
+   text=io.read("*all")
+   lines=string.explode(text,"\n+") -- all the lines
+   for i=1,tonumber(stop) do
+      xy=string.explode(lines[i]," +")
+      table.insert(listPoints,{x=tonumber(xy[1]),y=tonumber(xy[2])})
+   end
+   xy=string.explode(lines[stop+1]," +")
+   point={x=tonumber(xy[1]),y=tonumber(xy[2])}
+   return point, listPoints
+end
+
+
+function TeXFullOnePointTikZ(chaine,point,step,color,colorBack,colorNew,colorCircle,scale)
+   output = TeXaddOnePointTikZ(chaine,point,step,color,colorBack,colorNew,colorCircle)
+   output = "\\noindent\\begin{tikzpicture}[x="..scale..",y="..scale.."]".. output .. "\\end{tikzpicture}"
+   tex.sprint(output)
+end
+
+function TeXFullOnePointMP(chaine,point,step,color,colorBack,colorNew,colorCircle,scale,mode)
+   if(mode=="int") then
+      Sx,Sy=string.match(point,"%((.+),(.+)%)")
+      P = {x=Sx, y=Sy}
+      listPoints = buildList(chaine, mode)
+   else
+      -- point is a number
+      P, listPoints = buildListExt(chaine,tonumber(point))
+   end
+   output = TeXaddOnePointMP(listPoints,P,step,color,colorBack,colorNew,colorCircle)
+   output = "\\leavevmode\\begin{mplibcode}beginfig(0);u:="..scale..";".. output .. "endfig;\\end{mplibcode}"
+   tex.sprint(output)
+end
diff --git a/luamesh.sty b/luamesh.sty
new file mode 100644 (file)
index 0000000..9cc0b68
--- /dev/null
@@ -0,0 +1,187 @@
+\NeedsTeXFormat{LaTeX2e}%
+\def\PackageName{luamesh}%
+\def\fileversion{v0.1}%
+\def\filedate{2016/11/20}%
+\ProvidesPackage{luamesh}[\filedate\space\fileversion]%
+%
+% package to load
+\RequirePackage{xkeyval,xcolor,ifthen}%
+%% one global option: mp or tikz
+%\newif\ifluameshmp%
+%\define@key{luamesh.sty}{mp}[]{\luameshmptrue}%
+%\define@key{luamesh.sty}{tikz}[]{\luameshmpfalse}%
+%
+\RequirePackage{etoolbox} % pour robustifier les commandes
+%
+%
+%\ifluameshmp%
+   \RequirePackage{luamplib}%
+%\else%
+   \RequirePackage{tikz}%
+%\fi%
+%
+% load the lua code
+\directlua{dofile("luamesh.lua")}%
+%
+% global def (default value)
+\newcommand{\MeshPoint}{P}
+\newcommand{\NewPoint}{P}
+% for MetaPost (MP) (default value)
+% default scale u:=1cm;
+\newcommand\luaMeshScaleMP{1cm}
+% default color for the plot of a global mesh
+\newcommand\TeXCluaMeshMP{(0.,0.,0.)}
+% default color for a new element
+\newcommand\TeXCluaMeshNewMP{(0.5,0.1,0.1)}
+% defaut color for the background of new element
+\newcommand\TeXCluaMeshBackMP{(0.99,0.85,0.85)}
+% default color for circoncircle
+\newcommand\TeXCluaMeshCircleMP{(0.1,0.6,0.1)}
+%%
+% for tikz (default value)
+% default color for the plot of a global mesh
+\definecolor{TeXCluaMeshTikZ}{rgb}{0.,0.,0.}
+% default color for a new element
+\definecolor{TeXCluaMeshNewTikZ}{rgb}{0.5,0.1,0.1}
+% defaut color for the background of new element
+\definecolor{TeXCluaMeshBackTikZ}{rgb}{0.99,0.85,0.85}
+% default color for circoncircle
+\definecolor{TeXCluaMeshCircleTikZ}{rgb}{0.1,0.6,0.1}
+
+
+%%%%%%%%%%%%%%%% the buildMesh 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}{%
+  \ifcase\nr\relax%
+  \def\luameshval@bbox{none}%
+  \or%
+  \def\luameshval@bbox{bbox}%
+  \fi%
+}%
+%% the scale
+\define@key{buildMesh}{scale}[1cm]{\def\luameshval@scale{#1}}%
+%% print ponits ?
+\define@choicekey*{buildMesh}{print}[\val\nr]{none, points}{%
+  \ifcase\nr\relax%
+  \def\luameshval@print{none}%
+  \or%
+  \def\luameshval@print{points}%
+  \fi%
+}%
+%% the name of the point
+\define@key{buildMesh}{meshpoint}[P]{\def\luameshval@meshpoint{#1}}%
+%% the mode for reading the points
+\define@choicekey*{buildMesh}{mode}[\val\nr]{int, ext}{%
+  \ifcase\nr\relax%
+  \def\luameshval@mode{int}%
+  \or%
+  \def\luameshval@mode{ext}%
+  \fi%
+}%
+%
+%% a complete picture or some code of the engine
+\define@choicekey*{buildMesh}{picture}[\val\nr]{full, simple}{%
+  \ifcase\nr\relax%
+  \def\luameshval@picture{full}%
+  \or%
+  \def\luameshval@picture{simple}%
+  \fi%
+}%
+%color
+%% the name of the color of drawing
+\define@key{buildMesh}{color}[black]{\def\luameshval@color{#1}}%
+
+\presetkeys{buildMesh}{tikz=false,bbox=none,scale, meshpoint,mode=int,print=none,picture=full,color}{}%
+%
+% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% the difinition
+\newcommand{\buildMesh}[2][]{%
+  % #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@meshpoint}%
+  \ifKV@buildMesh@tikz% if we are using tikz
+  \directlua{%
+    buildMeshTikZ("#2","\luameshval@mode","\luameshval@print","\luameshval@bbox","full","\luameshval@scale","\luameshval@color")%
+  }%
+  \else % we are using MP
+  \directlua{%
+    buildMeshMP("#2","\luameshval@mode","\luameshval@print","\luameshval@bbox","full","\luameshval@scale","\luameshval@color")%
+  }%
+  %
+  \fi%
+}%
+%
+%%
+%
+%%the meshAddOnePoint commande
+%%engine of drawing
+\newif\ifluameshengineMP%
+\define@boolkey{MeshAddOne}{tikz}[true]{}%
+%% the scale
+\define@key{MeshAddOne}{scale}[1cm]{\def\luameshval@scale{#1}}%
+%% the name of the points
+\define@key{MeshAddOne}{meshpoint}[P]{\def\luameshval@meshpoint{#1}}%
+%% the name of the new point
+\define@key{MeshAddOne}{newpoint}[P]{\def\luameshval@newpoint{#1}}%
+%% a complete picture or some code of the engine
+\define@choicekey*{MeshAddOne}{picture}[\val\nr]{full, simple}{%
+  \ifcase\nr\relax%
+  \def\luameshval@picture{full}%
+  \or%
+  \def\luameshval@picture{simple}%
+  \fi%
+}%
+%% a complete picture or some code of the engine
+\define@choicekey*{MeshAddOne}{step}[\val\nr]{badtriangles, cavity, newtriangles}{%
+  \ifcase\nr\relax%
+  \def\luameshval@step{badT}%
+  \or%
+  \def\luameshval@step{cavity}%
+  \or%
+  \def\luameshval@step{newT}%
+  \fi%
+}%
+% color
+%% the color of drawing
+\define@key{MeshAddOne}{color}[black]{\def\luameshval@color{#1}}%
+%% the color of background of new element
+\define@key{MeshAddOne}{colorBack}[black!20]{\def\luameshval@colorback{#1}}%
+%% the color of new element
+\define@key{MeshAddOne}{colorNew}[red]{\def\luameshval@colornew{#1}}%
+%% the color of circoncircle
+\define@key{MeshAddOne}{colorCircle}[green]{\def\luameshval@colorcircle{#1}}%
+%
+%% a complete picture or some code of the engine
+\define@choicekey*{MeshAddOne}{mode}[\val\nr]{int, ext}{%
+  \ifcase\nr\relax%
+  \def\luameshval@mode{int}%
+  \or%
+  \def\luameshval@mode{ext}%
+  \fi%
+}%
+\presetkeys{MeshAddOne}{tikz=false,scale, meshpoint,newpoint,color,colorBack,colorNew,colorCircle,step=badtriangles,mode=int}{}%
+%
+% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% the difinition
+\newcommand{\meshAddOnePoint}[3][]{%
+  % #1 : the string containing the list of points
+  % (x1,y1);(x2,y2);... or the name file containing the points
+  \setkeys{MeshAddOne}{#1} %
+  \def\MeshPoint{\luameshval@meshpoint}%
+  \def\NewPoint{\luameshval@newpoint}%
+  \ifKV@MeshAddOne@tikz% if we are using tikz
+  \directlua{%
+    buildMeshTikZ("#2","\luameshval@mode","\luameshval@print","\luameshval@bbox","full","\luameshval@scale","\luameshval@color")%
+  }%
+  \else % we are using MP
+  \directlua{%
+    TeXFullOnePointMP("#2","#3","\luameshval@step","\luameshval@color","\luameshval@colorback","\luameshval@colornew","\luameshval@colorcircle","\luameshval@scale","\luameshval@mode")%
+  }%
+  %
+  \fi%
+}%
+%
\ No newline at end of file
diff --git a/test/delaunay-crop.pdf b/test/delaunay-crop.pdf
new file mode 100644 (file)
index 0000000..d85ab98
Binary files /dev/null and b/test/delaunay-crop.pdf differ
diff --git a/test/delaunay.aux b/test/delaunay.aux
new file mode 100644 (file)
index 0000000..f23e546
--- /dev/null
@@ -0,0 +1 @@
+\relax 
diff --git a/test/delaunay.log b/test/delaunay.log
new file mode 100644 (file)
index 0000000..c2f7f3b
--- /dev/null
@@ -0,0 +1,988 @@
+This is LuaTeX, Version 0.95.0 (TeX Live 2016)  (format=lualatex 2016.9.2)  20 NOV 2016 23:59
+ restricted system commands enabled.
+**delaunay.tex
+(./delaunay.tex
+LaTeX2e <2016/03/31> patch level 3
+Babel <3.9r> and hyphenation patterns for 1 language(s) loaded.
+(/usr/local/texlive/2016/texmf-dist/tex/latex/base/article.cls
+Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
+(/usr/local/texlive/2016/texmf-dist/tex/latex/base/size10.clo
+File: size10.clo 2014/09/29 v1.4h Standard LaTeX file (size option)
+)
+\c@part=\count79
+\c@section=\count80
+\c@subsection=\count81
+\c@subsubsection=\count82
+\c@paragraph=\count83
+\c@subparagraph=\count84
+\c@figure=\count85
+\c@table=\count86
+\abovecaptionskip=\skip41
+\belowcaptionskip=\skip42
+\bibindent=\dimen102
+)
+(/usr/local/texlive/2016/texmf-dist/tex/latex/geometry/geometry.sty
+Package: geometry 2010/09/12 v5.6 Page Geometry
+
+(/usr/local/texlive/2016/texmf-dist/tex/latex/graphics/keyval.sty
+Package: keyval 2014/10/28 v1.15 key=value parser (DPC)
+\KV@toks@=\toks14
+)
+(/usr/local/texlive/2016/texmf-dist/tex/generic/oberdiek/ifpdf.sty
+Package: ifpdf 2016/05/14 v3.1 Provides the ifpdf switch
+)
+(/usr/local/texlive/2016/texmf-dist/tex/generic/oberdiek/ifvtex.sty
+Package: ifvtex 2016/05/16 v1.6 Detect VTeX and its facilities (HO)
+Package ifvtex Info: VTeX not detected.
+)
+(/usr/local/texlive/2016/texmf-dist/tex/generic/ifxetex/ifxetex.sty
+Package: ifxetex 2010/09/12 v0.6 Provides ifxetex conditional
+)
+\Gm@cnth=\count87
+\Gm@cntv=\count88
+\c@Gm@tempcnt=\count89
+\Gm@bindingoffset=\dimen103
+\Gm@wd@mp=\dimen104
+\Gm@odd@mp=\dimen105
+\Gm@even@mp=\dimen106
+\Gm@layoutwidth=\dimen107
+\Gm@layoutheight=\dimen108
+\Gm@layouthoffset=\dimen109
+\Gm@layoutvoffset=\dimen110
+\Gm@dimlist=\toks15
+)
+(./luamesh.sty
+Package: luamesh 2016/11/20 v0.1
+
+(/usr/local/texlive/2016/texmf-dist/tex/latex/xkeyval/xkeyval.sty
+Package: xkeyval 2014/12/03 v2.7a package option processing (HA)
+
+(/usr/local/texlive/2016/texmf-dist/tex/generic/xkeyval/xkeyval.tex
+(/usr/local/texlive/2016/texmf-dist/tex/generic/xkeyval/xkvutils.tex
+\XKV@toks=\toks16
+\XKV@tempa@toks=\toks17
+)
+\XKV@depth=\count90
+File: xkeyval.tex 2014/12/03 v2.7a key=value parser (HA)
+))
+(/usr/local/texlive/2016/texmf-dist/tex/latex/xcolor/xcolor.sty
+Package: xcolor 2016/05/11 v2.12 LaTeX color extensions (UK)
+
+(/usr/local/texlive/2016/texmf-dist/tex/latex/graphics-cfg/color.cfg
+File: color.cfg 2016/01/02 v1.6 sample color configuration
+)
+Package xcolor Info: Driver file: luatex.def on input line 225.
+
+(/usr/local/texlive/2016/texmf-dist/tex/latex/graphics-def/luatex.def
+File: luatex.def 2016/08/17 v0.01g Graphics/Color for luaTeX
+
+(/usr/local/texlive/2016/texmf-dist/tex/generic/oberdiek/infwarerr.sty
+Package: infwarerr 2016/05/16 v1.4 Providing info/warning/error messages (HO)
+)
+(/usr/local/texlive/2016/texmf-dist/tex/generic/oberdiek/ltxcmds.sty
+Package: ltxcmds 2016/05/16 v1.23 LaTeX kernel commands for general use (HO)
+)
+\Gread@gobject=\count91
+)
+Package xcolor Info: Model `cmy' substituted by `cmy0' on input line 1348.
+Package xcolor Info: Model `hsb' substituted by `rgb' on input line 1352.
+Package xcolor Info: Model `RGB' extended on input line 1364.
+Package xcolor Info: Model `HTML' substituted by `rgb' on input line 1366.
+Package xcolor Info: Model `Hsb' substituted by `hsb' on input line 1367.
+Package xcolor Info: Model `tHsb' substituted by `hsb' on input line 1368.
+Package xcolor Info: Model `HSB' substituted by `hsb' on input line 1369.
+Package xcolor Info: Model `Gray' substituted by `gray' on input line 1370.
+Package xcolor Info: Model `wave' substituted by `hsb' on input line 1371.
+)
+(/usr/local/texlive/2016/texmf-dist/tex/latex/base/ifthen.sty
+Package: ifthen 2014/09/29 v1.1c Standard LaTeX ifthen package (DPC)
+)
+(/usr/local/texlive/2016/texmf-dist/tex/latex/etoolbox/etoolbox.sty
+Package: etoolbox 2015/08/02 v2.2a e-TeX tools for LaTeX (JAW)
+\etb@tempcnta=\count92
+)
+(/usr/local/texlive/2016/texmf-dist/tex/luatex/luamplib/luamplib.sty
+Package: luamplib 2016/03/31 v2.11.3 mplib package for LuaTeX
+Lua module: luamplib 2016/03/31 2.11.3 Lua package to typeset Metapost with LuaT
+eX's MPLib.
+\mplibstartlineno=\count93
+\everymplibtoks=\toks18
+\everyendmplibtoks=\toks19
+\mplibscratchbox=\box26
+)
+(/usr/local/texlive/2016/texmf-dist/tex/latex/pgf/frontendlayer/tikz.sty
+(/usr/local/texlive/2016/texmf-dist/tex/latex/pgf/basiclayer/pgf.sty
+(/usr/local/texlive/2016/texmf-dist/tex/latex/pgf/utilities/pgfrcs.sty
+(/usr/local/texlive/2016/texmf-dist/tex/generic/pgf/utilities/pgfutil-common.te
+x
+\pgfutil@everybye=\toks20
+\pgfutil@tempdima=\dimen111
+\pgfutil@tempdimb=\dimen112
+
+(/usr/local/texlive/2016/texmf-dist/tex/generic/pgf/utilities/pgfutil-common-li
+sts.tex))
+(/usr/local/texlive/2016/texmf-dist/tex/generic/pgf/utilities/pgfutil-latex.def
+\pgfutil@abb=\box27
+(/usr/local/texlive/2016/texmf-dist/tex/latex/ms/everyshi.sty
+Package: everyshi 2001/05/15 v3.00 EveryShipout Package (MS)
+))
+(/usr/local/texlive/2016/texmf-dist/tex/generic/pgf/utilities/pgfrcs.code.tex
+Package: pgfrcs 2015/08/07 v3.0.1a (rcs-revision 1.31)
+))
+Package: pgf 2015/08/07 v3.0.1a (rcs-revision 1.15)
+(/usr/local/texlive/2016/texmf-dist/tex/latex/pgf/basiclayer/pgfcore.sty
+(/usr/local/texlive/2016/texmf-dist/tex/latex/graphics/graphicx.sty
+Package: graphicx 2014/10/28 v1.0g Enhanced LaTeX Graphics (DPC,SPQR)
+
+(/usr/local/texlive/2016/texmf-dist/tex/latex/graphics/graphics.sty
+Package: graphics 2016/07/10 v1.0t Standard LaTeX Graphics (DPC,SPQR)
+
+(/usr/local/texlive/2016/texmf-dist/tex/latex/graphics/trig.sty
+Package: trig 2016/01/03 v1.10 sin cos tan (DPC)
+)
+(/usr/local/texlive/2016/texmf-dist/tex/latex/graphics-cfg/graphics.cfg
+File: graphics.cfg 2016/06/04 v1.11 sample graphics configuration
+)
+Package graphics Info: Driver file: luatex.def on input line 99.
+)
+\Gin@req@height=\dimen113
+\Gin@req@width=\dimen114
+)
+(/usr/local/texlive/2016/texmf-dist/tex/latex/pgf/systemlayer/pgfsys.sty
+(/usr/local/texlive/2016/texmf-dist/tex/generic/pgf/systemlayer/pgfsys.code.tex
+Package: pgfsys 2014/07/09 v3.0.1a (rcs-revision 1.48)
+(/usr/local/texlive/2016/texmf-dist/tex/generic/pgf/utilities/pgfkeys.code.tex
+\pgfkeys@pathtoks=\toks21
+\pgfkeys@temptoks=\toks22
+
+(/usr/local/texlive/2016/texmf-dist/tex/generic/pgf/utilities/pgfkeysfiltered.c
+ode.tex
+\pgfkeys@tmptoks=\toks23
+))
+\pgf@x=\dimen115
+\pgf@y=\dimen116
+\pgf@xa=\dimen117
+\pgf@ya=\dimen118
+\pgf@xb=\dimen119
+\pgf@yb=\dimen120
+\pgf@xc=\dimen121
+\pgf@yc=\dimen122
+\w@pgf@writea=\write3
+\r@pgf@reada=\read1
+\c@pgf@counta=\count94
+\c@pgf@countb=\count95
+\c@pgf@countc=\count96
+\c@pgf@countd=\count97
+\t@pgf@toka=\toks24
+\t@pgf@tokb=\toks25
+\t@pgf@tokc=\toks26
+
+(/usr/local/texlive/2016/texmf-dist/tex/generic/pgf/systemlayer/pgf.cfg
+File: pgf.cfg 2008/05/14  (rcs-revision 1.7)
+)
+Driver file for pgf: pgfsys-luatex.def
+
+(/usr/local/texlive/2016/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-luatex.d
+ef
+File: pgfsys-luatex.def 2014/10/11  (rcs-revision 1.35)
+
+(/usr/local/texlive/2016/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-common-p
+df.def
+File: pgfsys-common-pdf.def 2013/10/10  (rcs-revision 1.13)
+)))
+(/usr/local/texlive/2016/texmf-dist/tex/generic/pgf/systemlayer/pgfsyssoftpath.
+code.tex
+File: pgfsyssoftpath.code.tex 2013/09/09  (rcs-revision 1.9)
+\pgfsyssoftpath@smallbuffer@items=\count98
+\pgfsyssoftpath@bigbuffer@items=\count99
+)
+(/usr/local/texlive/2016/texmf-dist/tex/generic/pgf/systemlayer/pgfsysprotocol.
+code.tex
+File: pgfsysprotocol.code.tex 2006/10/16  (rcs-revision 1.4)
+))
+(/usr/local/texlive/2016/texmf-dist/tex/generic/pgf/basiclayer/pgfcore.code.tex
+Package: pgfcore 2010/04/11 v3.0.1a (rcs-revision 1.7)
+(/usr/local/texlive/2016/texmf-dist/tex/generic/pgf/math/pgfmath.code.tex
+(/usr/local/texlive/2016/texmf-dist/tex/generic/pgf/math/pgfmathcalc.code.tex
+(/usr/local/texlive/2016/texmf-dist/tex/generic/pgf/math/pgfmathutil.code.tex)
+(/usr/local/texlive/2016/texmf-dist/tex/generic/pgf/math/pgfmathparser.code.tex
+\pgfmath@dimen=\dimen123
+\pgfmath@count=\count100
+\pgfmath@box=\box28
+\pgfmath@toks=\toks27
+\pgfmath@stack@operand=\toks28
+\pgfmath@stack@operation=\toks29
+)
+(/usr/local/texlive/2016/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.code.
+tex
+(/usr/local/texlive/2016/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.basic
+.code.tex)
+(/usr/local/texlive/2016/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.trigo
+nometric.code.tex)
+(/usr/local/texlive/2016/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.rando
+m.code.tex)
+(/usr/local/texlive/2016/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.compa
+rison.code.tex)
+(/usr/local/texlive/2016/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.base.
+code.tex)
+(/usr/local/texlive/2016/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.round
+.code.tex)
+(/usr/local/texlive/2016/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.misc.
+code.tex)
+(/usr/local/texlive/2016/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.integ
+erarithmetics.code.tex)))
+(/usr/local/texlive/2016/texmf-dist/tex/generic/pgf/math/pgfmathfloat.code.tex
+\c@pgfmathroundto@lastzeros=\count101
+))
+(/usr/local/texlive/2016/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepoints.co
+de.tex
+File: pgfcorepoints.code.tex 2013/10/07  (rcs-revision 1.27)
+\pgf@picminx=\dimen124
+\pgf@picmaxx=\dimen125
+\pgf@picminy=\dimen126
+\pgf@picmaxy=\dimen127
+\pgf@pathminx=\dimen128
+\pgf@pathmaxx=\dimen129
+\pgf@pathminy=\dimen130
+\pgf@pathmaxy=\dimen131
+\pgf@xx=\dimen132
+\pgf@xy=\dimen133
+\pgf@yx=\dimen134
+\pgf@yy=\dimen135
+\pgf@zx=\dimen136
+\pgf@zy=\dimen137
+)
+(/usr/local/texlive/2016/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepathconst
+ruct.code.tex
+File: pgfcorepathconstruct.code.tex 2013/10/07  (rcs-revision 1.29)
+\pgf@path@lastx=\dimen138
+\pgf@path@lasty=\dimen139
+)
+(/usr/local/texlive/2016/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepathusage
+.code.tex
+File: pgfcorepathusage.code.tex 2014/11/02  (rcs-revision 1.24)
+\pgf@shorten@end@additional=\dimen140
+\pgf@shorten@start@additional=\dimen141
+)
+(/usr/local/texlive/2016/texmf-dist/tex/generic/pgf/basiclayer/pgfcorescopes.co
+de.tex
+File: pgfcorescopes.code.tex 2015/05/08  (rcs-revision 1.46)
+\pgfpic=\box29
+\pgf@hbox=\box30
+\pgf@layerbox@main=\box31
+\pgf@picture@serial@count=\count102
+)
+(/usr/local/texlive/2016/texmf-dist/tex/generic/pgf/basiclayer/pgfcoregraphicst
+ate.code.tex
+File: pgfcoregraphicstate.code.tex 2014/11/02  (rcs-revision 1.12)
+\pgflinewidth=\dimen142
+)
+(/usr/local/texlive/2016/texmf-dist/tex/generic/pgf/basiclayer/pgfcoretransform
+ations.code.tex
+File: pgfcoretransformations.code.tex 2015/08/07  (rcs-revision 1.20)
+\pgf@pt@x=\dimen143
+\pgf@pt@y=\dimen144
+\pgf@pt@temp=\dimen145
+)
+(/usr/local/texlive/2016/texmf-dist/tex/generic/pgf/basiclayer/pgfcorequick.cod
+e.tex
+File: pgfcorequick.code.tex 2008/10/09  (rcs-revision 1.3)
+)
+(/usr/local/texlive/2016/texmf-dist/tex/generic/pgf/basiclayer/pgfcoreobjects.c
+ode.tex
+File: pgfcoreobjects.code.tex 2006/10/11  (rcs-revision 1.2)
+)
+(/usr/local/texlive/2016/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepathproce
+ssing.code.tex
+File: pgfcorepathprocessing.code.tex 2013/09/09  (rcs-revision 1.9)
+)
+(/usr/local/texlive/2016/texmf-dist/tex/generic/pgf/basiclayer/pgfcorearrows.co
+de.tex
+File: pgfcorearrows.code.tex 2015/05/14  (rcs-revision 1.43)
+\pgfarrowsep=\dimen146
+)
+(/usr/local/texlive/2016/texmf-dist/tex/generic/pgf/basiclayer/pgfcoreshade.cod
+e.tex
+File: pgfcoreshade.code.tex 2013/07/15  (rcs-revision 1.15)
+\pgf@max=\dimen147
+\pgf@sys@shading@range@num=\count103
+)
+(/usr/local/texlive/2016/texmf-dist/tex/generic/pgf/basiclayer/pgfcoreimage.cod
+e.tex
+File: pgfcoreimage.code.tex 2013/07/15  (rcs-revision 1.18)
+
+(/usr/local/texlive/2016/texmf-dist/tex/generic/pgf/basiclayer/pgfcoreexternal.
+code.tex
+File: pgfcoreexternal.code.tex 2014/07/09  (rcs-revision 1.21)
+\pgfexternal@startupbox=\box32
+))
+(/usr/local/texlive/2016/texmf-dist/tex/generic/pgf/basiclayer/pgfcorelayers.co
+de.tex
+File: pgfcorelayers.code.tex 2013/07/18  (rcs-revision 1.7)
+)
+(/usr/local/texlive/2016/texmf-dist/tex/generic/pgf/basiclayer/pgfcoretranspare
+ncy.code.tex
+File: pgfcoretransparency.code.tex 2013/09/30  (rcs-revision 1.5)
+)
+(/usr/local/texlive/2016/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepatterns.
+code.tex
+File: pgfcorepatterns.code.tex 2013/11/07  (rcs-revision 1.5)
+)))
+(/usr/local/texlive/2016/texmf-dist/tex/generic/pgf/modules/pgfmoduleshapes.cod
+e.tex
+File: pgfmoduleshapes.code.tex 2014/03/21  (rcs-revision 1.35)
+\pgfnodeparttextbox=\box33
+)
+(/usr/local/texlive/2016/texmf-dist/tex/generic/pgf/modules/pgfmoduleplot.code.
+tex
+File: pgfmoduleplot.code.tex 2015/08/03  (rcs-revision 1.13)
+)
+(/usr/local/texlive/2016/texmf-dist/tex/latex/pgf/compatibility/pgfcomp-version
+-0-65.sty
+Package: pgfcomp-version-0-65 2007/07/03 v3.0.1a (rcs-revision 1.7)
+\pgf@nodesepstart=\dimen148
+\pgf@nodesepend=\dimen149
+)
+(/usr/local/texlive/2016/texmf-dist/tex/latex/pgf/compatibility/pgfcomp-version
+-1-18.sty
+Package: pgfcomp-version-1-18 2007/07/23 v3.0.1a (rcs-revision 1.1)
+))
+(/usr/local/texlive/2016/texmf-dist/tex/latex/pgf/utilities/pgffor.sty
+(/usr/local/texlive/2016/texmf-dist/tex/latex/pgf/utilities/pgfkeys.sty
+(/usr/local/texlive/2016/texmf-dist/tex/generic/pgf/utilities/pgfkeys.code.tex))
+ (/usr/local/texlive/2016/texmf-dist/tex/latex/pgf/math/pgfmath.sty
+(/usr/local/texlive/2016/texmf-dist/tex/generic/pgf/math/pgfmath.code.tex))
+(/usr/local/texlive/2016/texmf-dist/tex/generic/pgf/utilities/pgffor.code.tex
+Package: pgffor 2013/12/13 v3.0.1a (rcs-revision 1.25)
+
+(/usr/local/texlive/2016/texmf-dist/tex/generic/pgf/math/pgfmath.code.tex)
+\pgffor@iter=\dimen150
+\pgffor@skip=\dimen151
+\pgffor@stack=\toks30
+\pgffor@toks=\toks31
+))
+(/usr/local/texlive/2016/texmf-dist/tex/generic/pgf/frontendlayer/tikz/tikz.cod
+e.tex
+Package: tikz 2015/08/07 v3.0.1a (rcs-revision 1.151)
+
+(/usr/local/texlive/2016/texmf-dist/tex/generic/pgf/libraries/pgflibraryplothan
+dlers.code.tex
+File: pgflibraryplothandlers.code.tex 2013/08/31 v3.0.1a (rcs-revision 1.20)
+\pgf@plot@mark@count=\count104
+\pgfplotmarksize=\dimen152
+)
+\tikz@lastx=\dimen153
+\tikz@lasty=\dimen154
+\tikz@lastxsaved=\dimen155
+\tikz@lastysaved=\dimen156
+\tikzleveldistance=\dimen157
+\tikzsiblingdistance=\dimen158
+\tikz@figbox=\box34
+\tikz@figbox@bg=\box35
+\tikz@tempbox=\box36
+\tikz@tempbox@bg=\box37
+\tikztreelevel=\count105
+\tikznumberofchildren=\count106
+\tikznumberofcurrentchild=\count107
+\tikz@fig@count=\count108
+
+(/usr/local/texlive/2016/texmf-dist/tex/generic/pgf/modules/pgfmodulematrix.cod
+e.tex
+File: pgfmodulematrix.code.tex 2013/09/17  (rcs-revision 1.8)
+\pgfmatrixcurrentrow=\count109
+\pgfmatrixcurrentcolumn=\count110
+\pgf@matrix@numberofcolumns=\count111
+)
+\tikz@expandcount=\count112
+
+(/usr/local/texlive/2016/texmf-dist/tex/generic/pgf/frontendlayer/tikz/librarie
+s/tikzlibrarytopaths.code.tex
+File: tikzlibrarytopaths.code.tex 2008/06/17 v3.0.1a (rcs-revision 1.2)
+))))
+(/usr/local/texlive/2016/texmf-dist/tex/latex/fontspec/fontspec.sty
+(/usr/local/texlive/2016/texmf-dist/tex/latex/l3kernel/expl3.sty
+Package: expl3 2016/05/18 v6512 L3 programming layer (loader) 
+
+(/usr/local/texlive/2016/texmf-dist/tex/latex/l3kernel/expl3-code.tex
+Package: expl3 2016/05/18 v6512 L3 programming layer (code)
+L3 Module: l3bootstrap 2016/02/12 v6412 L3 Bootstrap code
+\ucharcat@table=\catcodetable5
+L3 Module: l3names 2016/03/11 v6433 L3 Namespace for primitives
+L3 Module: l3basics 2015/11/22 v6315 L3 Basic definitions
+L3 Module: l3expan 2015/09/10 v5983 L3 Argument expansion
+L3 Module: l3tl 2016/03/26 v6465 L3 Token lists
+L3 Module: l3str 2016/03/24 v6441 L3 Strings
+L3 Module: l3seq 2015/08/05 v5777 L3 Sequences and stacks
+L3 Module: l3int 2016/03/24 v6441 L3 Integers
+\c_max_int=\count113
+\l_tmpa_int=\count114
+\l_tmpb_int=\count115
+\g_tmpa_int=\count116
+\g_tmpb_int=\count117
+L3 Module: l3quark 2015/08/17 v5855 L3 Quarks
+L3 Module: l3prg 2015/11/01 v6216 L3 Control structures
+\g__prg_map_int=\count118
+L3 Module: l3clist 2015/09/02 v5901 L3 Comma separated lists
+L3 Module: l3token 2016/04/03 v6470 L3 Experimental token manipulation
+L3 Module: l3prop 2016/01/05 v6366 L3 Property lists
+L3 Module: l3msg 2016/03/26 v6464 L3 Messages
+L3 Module: l3file 2016/03/25 v6458 L3 File and I/O operations
+\l_iow_line_count_int=\count119
+\l__iow_target_count_int=\count120
+\l__iow_current_line_int=\count121
+\l__iow_current_word_int=\count122
+\l__iow_current_indentation_int=\count123
+L3 Module: l3skip 2016/01/05 v6366 L3 Dimensions and skips
+\c_zero_dim=\dimen159
+\c_max_dim=\dimen160
+\l_tmpa_dim=\dimen161
+\l_tmpb_dim=\dimen162
+\g_tmpa_dim=\dimen163
+\g_tmpb_dim=\dimen164
+\c_zero_skip=\skip43
+\c_max_skip=\skip44
+\l_tmpa_skip=\skip45
+\l_tmpb_skip=\skip46
+\g_tmpa_skip=\skip47
+\g_tmpb_skip=\skip48
+\c_zero_muskip=\muskip10
+\c_max_muskip=\muskip11
+\l_tmpa_muskip=\muskip12
+\l_tmpb_muskip=\muskip13
+\g_tmpa_muskip=\muskip14
+\g_tmpb_muskip=\muskip15
+L3 Module: l3keys 2015/11/17 v6284 L3 Key-value interfaces
+\g__keyval_level_int=\count124
+\l_keys_choice_int=\count125
+L3 Module: l3fp 2016/03/26 v6465 L3 Floating points
+\c__fp_leading_shift_int=\count126
+\c__fp_middle_shift_int=\count127
+\c__fp_trailing_shift_int=\count128
+\c__fp_big_leading_shift_int=\count129
+\c__fp_big_middle_shift_int=\count130
+\c__fp_big_trailing_shift_int=\count131
+\c__fp_Bigg_leading_shift_int=\count132
+\c__fp_Bigg_middle_shift_int=\count133
+\c__fp_Bigg_trailing_shift_int=\count134
+L3 Module: l3box 2015/08/09 v5822 L3 Experimental boxes
+\c_empty_box=\box38
+\l_tmpa_box=\box39
+\l_tmpb_box=\box40
+\g_tmpa_box=\box41
+\g_tmpb_box=\box42
+L3 Module: l3coffins 2016/05/17 v6508 L3 Coffin code layer
+\l__coffin_internal_box=\box43
+\l__coffin_internal_dim=\dimen165
+\l__coffin_offset_x_dim=\dimen166
+\l__coffin_offset_y_dim=\dimen167
+\l__coffin_x_dim=\dimen168
+\l__coffin_y_dim=\dimen169
+\l__coffin_x_prime_dim=\dimen170
+\l__coffin_y_prime_dim=\dimen171
+\c_empty_coffin=\box44
+\l__coffin_aligned_coffin=\box45
+\l__coffin_aligned_internal_coffin=\box46
+\l_tmpa_coffin=\box47
+\l_tmpb_coffin=\box48
+\l__coffin_display_coffin=\box49
+\l__coffin_display_coord_coffin=\box50
+\l__coffin_display_pole_coffin=\box51
+\l__coffin_display_offset_dim=\dimen172
+\l__coffin_display_x_dim=\dimen173
+\l__coffin_display_y_dim=\dimen174
+L3 Module: l3color 2014/08/23 v5354 L3 Experimental color support
+L3 Module: l3sys 2015/09/25 v6087 L3 Experimental system/runtime functions
+L3 Module: l3candidates 2016/05/13 v6484 L3 Experimental additions to l3kernel
+\l__box_top_dim=\dimen175
+\l__box_bottom_dim=\dimen176
+\l__box_left_dim=\dimen177
+\l__box_right_dim=\dimen178
+\l__box_top_new_dim=\dimen179
+\l__box_bottom_new_dim=\dimen180
+\l__box_left_new_dim=\dimen181
+\l__box_right_new_dim=\dimen182
+\l__box_internal_box=\box52
+\l__coffin_bounding_shift_dim=\dimen183
+\l__coffin_left_corner_dim=\dimen184
+\l__coffin_right_corner_dim=\dimen185
+\l__coffin_bottom_corner_dim=\dimen186
+\l__coffin_top_corner_dim=\dimen187
+\l__coffin_scaled_total_height_dim=\dimen188
+\l__coffin_scaled_width_dim=\dimen189
+L3 Module: l3luatex 2016/03/26 v6465 L3 Experimental LuaTeX-specific functions
+)
+(/usr/local/texlive/2016/texmf-dist/tex/latex/l3kernel/l3pdfmode.def
+File: l3pdfmode.def 2016/03/26 v6465 L3 Experimental driver: PDF mode
+\l__driver_color_stack_int=\count135
+\l__driver_tmp_box=\box53
+))
+(/usr/local/texlive/2016/texmf-dist/tex/latex/l3packages/xparse/xparse.sty
+Package: xparse 2016/05/18 v6512 L3 Experimental document command parser
+\l__xparse_current_arg_int=\count136
+\l__xparse_m_args_int=\count137
+\l__xparse_mandatory_args_int=\count138
+\l__xparse_processor_int=\count139
+\l__xparse_v_nesting_int=\count140
+)
+Package: fontspec 2016/02/01 v2.5a Font selection for XeLaTeX and LuaLaTeX
+
+(/usr/local/texlive/2016/texmf-dist/tex/luatex/luaotfload/luaotfload.sty
+Package: luaotfload 2016/06/16 v2.7 OpenType layout system
+Lua module: luaotfload-main 2016/06/16 2.70003 OpenType layout system.
+Lua module: lualibs 2016-04-06 2.4 ConTeXt Lua standard libraries.
+Lua module: lualibs-extended 2016-04-06 2.4 ConTeXt Lua libraries -- extended co
+llection.(using write cache: /home/chupin/.texlive2016/texmf-var/luatex-cache/ge
+neric)(using read cache: /usr/local/texlive/2016/texmf-var/luatex-cache/generic 
+/home/chupin/.texlive2016/texmf-var/luatex-cache/generic)
+luaotfload | conf : Root cache directory is /home/chupin/.texlive2016/texmf-var/
+luatex-cache/generic/names.
+luaotfload | init : Loading fontloader “fontloader-2016-06-16.lua” from kpse
+-resolved path “/usr/local/texlive/2016/texmf-dist/tex/luatex/luaotfload/fontl
+oader-2016-06-16.lua”.
+Lua-only attribute luaotfload@state = 1
+Lua-only attribute luaotfload@noligature = 2
+Lua-only attribute luaotfload@syllabe = 3
+luaotfload | init : Context OpenType loader version “3.023”
+Inserting `luaotfload.node_processor' at position 1 in `pre_linebreak_filter'.
+Inserting `luaotfload.node_processor' at position 1 in `hpack_filter'.
+Inserting `luaotfload.define_font' at position 1 in `define_font'.
+Lua-only attribute luaotfload_color_attribute = 4
+luaotfload | conf : Root cache directory is /home/chupin/.texlive2016/texmf-var/
+luatex-cache/generic/names.
+Inserting `luaotfload.aux.set_sscale_dimens' at position 1 in `luaotfload.patch_
+font'.
+Inserting `luaotfload.aux.patch_cambria_domh' at position 2 in `luaotfload.patch
+_font'.
+Inserting `luaotfload.aux.fixup_fontdata' at position 1 in `luaotfload.patch_fon
+t_unsafe'.
+Inserting `luaotfload.aux.set_capheight' at position 3 in `luaotfload.patch_font
+'.
+Inserting `luaotfload.rewrite_fontname' at position 4 in `luaotfload.patch_font'
+.
+luaotfload | main : initialization completed in 0.087 seconds)
+Lua module: fontspec 2016/02/01 2.5a Advanced font selection for LuaLaTeX.
+(/usr/local/texlive/2016/texmf-dist/tex/latex/fontspec/fontspec-luatex.sty
+Package: fontspec-luatex 2016/02/01 v2.5a Font selection for XeLaTeX and LuaLaTe
+X
+\l_fontspec_script_int=\count141
+\l_fontspec_language_int=\count142
+\l_fontspec_strnum_int=\count143
+\l__fontspec_tmpa_dim=\dimen190
+\l__fontspec_tmpb_dim=\dimen191
+\l__fontspec_tmpc_dim=\dimen192
+\g__file_internal_ior=\read2
+
+(/usr/local/texlive/2016/texmf-dist/tex/latex/base/fontenc.sty
+Package: fontenc 2016/06/19 v1.99m Standard LaTeX package
+
+(/usr/local/texlive/2016/texmf-dist/tex/latex/euenc/eu2enc.def
+File: eu2enc.def 2010/05/27 v0.1h Experimental Unicode font encodings
+)
+LaTeX Font Info:    Try loading font information for EU2+lmr on input line 105.
+
+(/usr/local/texlive/2016/texmf-dist/tex/latex/euenc/eu2lmr.fd
+File: eu2lmr.fd 2009/10/30 v1.6 Font defs for Latin Modern
+)
+luaotfload | db : Font names database loaded from /home/chupin/.texlive2016/texm
+f-var/luatex-cache/generic/names/luaotfload-names.luc(compiling luc: /usr/local/
+texlive/2016/texmf-var/luatex-cache/generic/fonts/otl/lmroman10-regular.luc)(loa
+d luc: /home/chupin/.texlive2016/texmf-var/luatex-cache/generic/fonts/otl/lmroma
+n10-regular.luc))
+(/usr/local/texlive/2016/texmf-dist/tex/xelatex/xunicode/xunicode.sty
+File: xunicode.sty 2011/09/09 v0.981 provides access to latin accents and many o
+ther characters in Unicode lower plane
+
+(/usr/local/texlive/2016/texmf-dist/tex/latex/tipa/t3enc.def
+File: t3enc.def 2001/12/31 T3 encoding
+(compiling luc: /usr/local/texlive/2016/texmf-var/luatex-cache/generic/fonts/otl
+/lmromanslant10-regular.luc)(load luc: /home/chupin/.texlive2016/texmf-var/luate
+x-cache/generic/fonts/otl/lmromanslant10-regular.luc)(compiling luc: /usr/local/
+texlive/2016/texmf-var/luatex-cache/generic/fonts/otl/lmroman10-italic.luc)(load
+ luc: /home/chupin/.texlive2016/texmf-var/luatex-cache/generic/fonts/otl/lmroman
+10-italic.luc)(compiling luc: /usr/local/texlive/2016/texmf-var/luatex-cache/gen
+eric/fonts/otl/lmroman10-bold.luc)(load luc: /home/chupin/.texlive2016/texmf-var
+/luatex-cache/generic/fonts/otl/lmroman10-bold.luc)
+LaTeX Font Info:    Try loading font information for EU2+lmss on input line 357.
+
+
+(/usr/local/texlive/2016/texmf-dist/tex/latex/euenc/eu2lmss.fd
+File: eu2lmss.fd 2009/10/30 v1.6 Font defs for Latin Modern
+)(compiling luc: /usr/local/texlive/2016/texmf-var/luatex-cache/generic/fonts/ot
+l/lmsans10-regular.luc)(load luc: /home/chupin/.texlive2016/texmf-var/luatex-cac
+he/generic/fonts/otl/lmsans10-regular.luc))
+\tipaTiiicode=\count144
+\tipasavetokens=\toks32
+\tipachecktokens=\toks33
+)
+.................................................
+. LaTeX info: "xparse/define-command"
+. 
+. Defining command \__fontspec_post_arg:w with sig. 'mmO{}' on line 356.
+.................................................
+.................................................
+. LaTeX info: "xparse/define-command"
+. 
+. Defining command \fontspec with sig. 'om' on line 358.
+.................................................
+.................................................
+. LaTeX info: "xparse/define-command"
+. 
+. Defining command \setmainfont with sig. 'om' on line 368.
+.................................................
+.................................................
+. LaTeX info: "xparse/define-command"
+. 
+. Defining command \setsansfont with sig. 'om' on line 378.
+.................................................
+.................................................
+. LaTeX info: "xparse/define-command"
+. 
+. Defining command \setmonofont with sig. 'om' on line 388.
+.................................................
+.................................................
+. LaTeX info: "xparse/define-command"
+. 
+. Defining command \setmathrm with sig. 'om' on line 402.
+.................................................
+.................................................
+. LaTeX info: "xparse/define-command"
+. 
+. Defining command \setboldmathrm with sig. 'om' on line 410.
+.................................................
+.................................................
+. LaTeX info: "xparse/define-command"
+. 
+. Defining command \setmathsf with sig. 'om' on line 418.
+.................................................
+.................................................
+. LaTeX info: "xparse/define-command"
+. 
+. Defining command \setmathtt with sig. 'om' on line 426.
+.................................................
+.................................................
+. LaTeX info: "xparse/define-command"
+. 
+. Defining command \newfontfamily with sig. 'mom' on line 440.
+.................................................
+.................................................
+. LaTeX info: "xparse/define-command"
+. 
+. Defining command \newfontface with sig. 'mom' on line 456.
+.................................................
+.................................................
+. LaTeX info: "xparse/define-command"
+. 
+. Defining command \defaultfontfeatures with sig. 't+om' on line 470.
+.................................................
+.................................................
+. LaTeX info: "xparse/define-command"
+. 
+. Defining command \addfontfeatures with sig. 'm' on line 533.
+.................................................
+.................................................
+. LaTeX info: "xparse/define-command"
+. 
+. Defining command \newfontfeature with sig. 'mm' on line 544.
+.................................................
+.................................................
+. LaTeX info: "xparse/define-command"
+. 
+. Defining command \newAATfeature with sig. 'mmmm' on line 552.
+.................................................
+.................................................
+. LaTeX info: "xparse/define-command"
+. 
+. Defining command \newopentypefeature with sig. 'mmm' on line 560.
+.................................................
+.................................................
+. LaTeX info: "xparse/define-command"
+. 
+. Defining command \aliasfontfeature with sig. 'mm' on line 581.
+.................................................
+.................................................
+. LaTeX info: "xparse/define-command"
+. 
+. Defining command \aliasfontfeatureoption with sig. 'mmm' on line 590.
+.................................................
+.................................................
+. LaTeX info: "xparse/define-command"
+. 
+. Defining command \newfontscript with sig. 'mm' on line 594.
+.................................................
+.................................................
+. LaTeX info: "xparse/define-command"
+. 
+. Defining command \newfontlanguage with sig. 'mm' on line 598.
+.................................................
+.................................................
+. LaTeX info: "xparse/define-command"
+. 
+. Defining command \DeclareFontsExtensions with sig. 'm' on line 603.
+.................................................
+\l__fontspec_tmp_int=\count145
+
+(/usr/local/texlive/2016/texmf-dist/tex/latex/fontspec/fontspec.cfg)
+LaTeX Info: Redefining \itshape on input line 2629.
+LaTeX Info: Redefining \slshape on input line 2634.
+LaTeX Info: Redefining \scshape on input line 2639.
+LaTeX Info: Redefining \upshape on input line 2644.
+\l__fontspec_em_int=\count146
+\l__fontspec_emdef_int=\count147
+LaTeX Info: Redefining \em on input line 2660.
+LaTeX Info: Redefining \emph on input line 2666.
+LaTeX Info: Redefining \- on input line 2670.
+.................................................
+. LaTeX info: "xparse/redefine-command"
+. 
+. Redefining command \oldstylenums with sig. 'm' on line 2765.
+.................................................
+.................................................
+. LaTeX info: "xparse/define-command"
+. 
+. Defining command \liningnums with sig. 'm' on line 2769.
+.................................................
+))
+(/usr/local/texlive/2016/texmf-dist/tex/latex/multido/multido.sty
+Package: multido 2004/05/17 package wrapper for PSTricks `multido.tex', (HV/RN)
+
+(/usr/local/texlive/2016/texmf-dist/tex/generic/multido/multido.tex
+ v1.42, 2010/05/14 <tvz>
+\multido@count=\count148
+\multidocount=\count149
+\multido@stuff=\toks34
+)
+File: multido.tex 2010/05/14 v1.42 `multido' (tvz,hv)
+) (./delaunay.aux)
+\openout1 = delaunay.aux
+
+LaTeX Font Info:    Checking defaults for OML/cmm/m/it on input line 8.
+LaTeX Font Info:    ... okay on input line 8.
+LaTeX Font Info:    Checking defaults for T1/cmr/m/n on input line 8.
+LaTeX Font Info:    ... okay on input line 8.
+LaTeX Font Info:    Checking defaults for OT1/cmr/m/n on input line 8.
+LaTeX Font Info:    ... okay on input line 8.
+LaTeX Font Info:    Checking defaults for OMS/cmsy/m/n on input line 8.
+LaTeX Font Info:    ... okay on input line 8.
+LaTeX Font Info:    Checking defaults for OMX/cmex/m/n on input line 8.
+LaTeX Font Info:    ... okay on input line 8.
+LaTeX Font Info:    Checking defaults for U/cmr/m/n on input line 8.
+LaTeX Font Info:    ... okay on input line 8.
+LaTeX Font Info:    Checking defaults for EU2/lmr/m/n on input line 8.
+LaTeX Font Info:    ... okay on input line 8.
+LaTeX Font Info:    Checking defaults for T3/cmr/m/n on input line 8.
+LaTeX Font Info:    Try loading font information for T3+cmr on input line 8.
+
+(/usr/local/texlive/2016/texmf-dist/tex/latex/tipa/t3cmr.fd
+File: t3cmr.fd 2001/12/31 TIPA font definitions
+)
+LaTeX Font Info:    ... okay on input line 8.
+
+*geometry* driver: auto-detecting
+*geometry* detected driver: pdftex
+*geometry* verbose mode - [ preamble ] result:
+* driver: pdftex
+* paper: <default>
+* layout: <same size as paper>
+* layoutoffset:(h,v)=(0.0pt,0.0pt)
+* modes: 
+* h-part:(L,W,R)=(71.13188pt, 472.03123pt, 71.13188pt)
+* v-part:(T,H,B)=(71.13188pt, 652.70622pt, 71.13188pt)
+* \paperwidth=614.295pt
+* \paperheight=794.96999pt
+* \textwidth=472.03123pt
+* \textheight=652.70622pt
+* \oddsidemargin=-1.1381pt
+* \evensidemargin=-1.1381pt
+* \topmargin=-38.1381pt
+* \headheight=12.0pt
+* \headsep=25.0pt
+* \topskip=10.0pt
+* \footskip=30.0pt
+* \marginparwidth=65.0pt
+* \marginparsep=11.0pt
+* \columnsep=10.0pt
+* \skip\footins=9.0pt plus 4.0pt minus 2.0pt
+* \hoffset=0.0pt
+* \voffset=0.0pt
+* \mag=1000
+* \@twocolumnfalse
+* \@twosidefalse
+* \@mparswitchfalse
+* \@reversemarginfalse
+* (1in=72.27pt=25.4mm, 1cm=28.453pt)
+
+(/usr/local/texlive/2016/texmf-dist/tex/context/base/mkii/supp-pdf.mkii
+[Loading MPS to PDF converter (version 2006.09.02).]
+\scratchcounter=\count150
+\scratchdimen=\dimen193
+\scratchbox=\box54
+\nofMPsegments=\count151
+\nofMParguments=\count152
+\everyMPshowfont=\toks35
+\MPscratchCnt=\count153
+\MPscratchDim=\dimen194
+\MPnumerator=\count154
+\makeMPintoPDFobject=\count155
+\everyMPtoPDFconversion=\toks36
+) (/usr/local/texlive/2016/texmf-dist/tex/latex/oberdiek/epstopdf-base.sty
+Package: epstopdf-base 2016/05/15 v2.6 Base part for package epstopdf
+
+(/usr/local/texlive/2016/texmf-dist/tex/latex/oberdiek/grfext.sty
+Package: grfext 2016/05/16 v1.2 Manage graphics extensions (HO)
+
+(/usr/local/texlive/2016/texmf-dist/tex/generic/oberdiek/kvdefinekeys.sty
+Package: kvdefinekeys 2016/05/16 v1.4 Define keys (HO)
+))
+(/usr/local/texlive/2016/texmf-dist/tex/latex/oberdiek/kvoptions.sty
+Package: kvoptions 2016/05/16 v3.12 Key value format for package options (HO)
+
+(/usr/local/texlive/2016/texmf-dist/tex/generic/oberdiek/kvsetkeys.sty
+Package: kvsetkeys 2016/05/16 v1.17 Key value parser (HO)
+
+(/usr/local/texlive/2016/texmf-dist/tex/generic/oberdiek/etexcmds.sty
+Package: etexcmds 2016/05/16 v1.6 Avoid name clashes with e-TeX commands (HO)
+
+(/usr/local/texlive/2016/texmf-dist/tex/generic/oberdiek/ifluatex.sty
+Package: ifluatex 2016/05/16 v1.4 Provides the ifluatex switch (HO)
+Package ifluatex Info: LuaTeX detected.
+))))
+(/usr/local/texlive/2016/texmf-dist/tex/generic/oberdiek/pdftexcmds.sty
+Package: pdftexcmds 2016/05/21 v0.22 Utility functions of pdfTeX for LuaTeX (HO)
+
+Package pdftexcmds Info: \pdf@primitive is available.
+Package pdftexcmds Info: \pdf@ifprimitive is available.
+Package pdftexcmds Info: \pdfdraftmode found.
+
+(/usr/local/texlive/2016/texmf-dist/tex/generic/oberdiek/luatex-loader.sty
+Package: luatex-loader 2016/05/16 v0.6 Lua module loader (HO)
+
+(/usr/local/texlive/2016/texmf-dist/scripts/oberdiek/oberdiek.luatex.lua))
+\pdftexcmds@toks=\toks37
+)
+Package epstopdf-base Info: Redefining graphics rule for `.eps' on input line 43
+8.
+Package grfext Info: Graphics extension search list:
+(grfext)             [.png,.pdf,.jpg,.mps,.jpeg,.jbig2,.jb2,.PNG,.PDF,.JPG,.JPEG
+,.JBIG2,.JB2,.eps]
+(grfext)             \AppendGraphicsExtensions on input line 456.
+
+(/usr/local/texlive/2016/texmf-dist/tex/latex/latexconfig/epstopdf-sys.cfg
+File: epstopdf-sys.cfg 2010/07/13 v1.3 Configuration of (r)epstopdf for TeX Live
+
+))
+ABD: EveryShipout initializing macros
+.................................................
+. fontspec info: "setup-math"
+. 
+. Adjusting the maths setup (use [no-math] to avoid this).
+.................................................
+\symlegacymaths=\mathgroup4
+LaTeX Font Info:    Overwriting symbol font `legacymaths' in version `bold'
+(Font)                  OT1/cmr/m/n --> OT1/cmr/bx/n on input line 8.
+LaTeX Font Info:    Redeclaring math accent \acute on input line 8.
+LaTeX Font Info:    Redeclaring math accent \grave on input line 8.
+LaTeX Font Info:    Redeclaring math accent \ddot on input line 8.
+LaTeX Font Info:    Redeclaring math accent \tilde on input line 8.
+LaTeX Font Info:    Redeclaring math accent \bar on input line 8.
+LaTeX Font Info:    Redeclaring math accent \breve on input line 8.
+LaTeX Font Info:    Redeclaring math accent \check on input line 8.
+LaTeX Font Info:    Redeclaring math accent \hat on input line 8.
+LaTeX Font Info:    Redeclaring math accent \dot on input line 8.
+LaTeX Font Info:    Redeclaring math accent \mathring on input line 8.
+LaTeX Font Info:    Redeclaring math symbol \colon on input line 8.
+LaTeX Font Info:    Redeclaring math symbol \Gamma on input line 8.
+LaTeX Font Info:    Redeclaring math symbol \Delta on input line 8.
+LaTeX Font Info:    Redeclaring math symbol \Theta on input line 8.
+LaTeX Font Info:    Redeclaring math symbol \Lambda on input line 8.
+LaTeX Font Info:    Redeclaring math symbol \Xi on input line 8.
+LaTeX Font Info:    Redeclaring math symbol \Pi on input line 8.
+LaTeX Font Info:    Redeclaring math symbol \Sigma on input line 8.
+LaTeX Font Info:    Redeclaring math symbol \Upsilon on input line 8.
+LaTeX Font Info:    Redeclaring math symbol \Phi on input line 8.
+LaTeX Font Info:    Redeclaring math symbol \Psi on input line 8.
+LaTeX Font Info:    Redeclaring math symbol \Omega on input line 8.
+LaTeX Font Info:    Redeclaring math symbol \mathdollar on input line 8.
+LaTeX Font Info:    Redeclaring symbol font `operators' on input line 8.
+LaTeX Font Info:    Encoding `OT1' has changed to `EU2' for symbol font
+(Font)              `operators' in the math version `normal' on input line 8.
+LaTeX Font Info:    Overwriting symbol font `operators' in version `normal'
+(Font)                  OT1/cmr/m/n --> EU2/lmr/m/n on input line 8.
+LaTeX Font Info:    Encoding `OT1' has changed to `EU2' for symbol font
+(Font)              `operators' in the math version `bold' on input line 8.
+LaTeX Font Info:    Overwriting symbol font `operators' in version `bold'
+(Font)                  OT1/cmr/bx/n --> EU2/lmr/m/n on input line 8.
+LaTeX Font Info:    Overwriting symbol font `operators' in version `normal'
+(Font)                  EU2/lmr/m/n --> EU2/lmr/m/n on input line 8.
+LaTeX Font Info:    Overwriting math alphabet `\mathit' in version `normal'
+(Font)                  OT1/cmr/m/it --> EU2/lmr/m/it on input line 8.
+LaTeX Font Info:    Overwriting math alphabet `\mathbf' in version `normal'
+(Font)                  OT1/cmr/bx/n --> EU2/lmr/bx/n on input line 8.
+LaTeX Font Info:    Overwriting math alphabet `\mathsf' in version `normal'
+(Font)                  OT1/cmss/m/n --> EU2/lmss/m/n on input line 8.
+LaTeX Font Info:    Overwriting math alphabet `\mathtt' in version `normal'
+(Font)                  OT1/cmtt/m/n --> EU2/lmtt/m/n on input line 8.
+LaTeX Font Info:    Overwriting symbol font `operators' in version `bold'
+(Font)                  EU2/lmr/m/n --> EU2/lmr/bx/n on input line 8.
+LaTeX Font Info:    Overwriting math alphabet `\mathit' in version `bold'
+(Font)                  OT1/cmr/bx/it --> EU2/lmr/bx/it on input line 8.
+LaTeX Font Info:    Overwriting math alphabet `\mathsf' in version `bold'
+(Font)                  OT1/cmss/bx/n --> EU2/lmss/bx/n on input line 8.
+LaTeX Font Info:    Overwriting math alphabet `\mathtt' in version `bold'
+(Font)                  OT1/cmtt/m/n --> EU2/lmtt/bx/n on input line 8.
+(compiling luc: /usr/local/texlive/2016/texmf-var/luatex-cache/generic/fonts/otl
+/lmroman7-regular.luc)(load luc: /home/chupin/.texlive2016/texmf-var/luatex-cach
+e/generic/fonts/otl/lmroman7-regular.luc)(compiling luc: /usr/local/texlive/2016
+/texmf-var/luatex-cache/generic/fonts/otl/lmroman5-regular.luc)(load luc: /home/
+chupin/.texlive2016/texmf-var/luatex-cache/generic/fonts/otl/lmroman5-regular.lu
+c)
+LaTeX Font Info:    External font `cmex10' loaded for size
+(Font)              <7> on input line 1.
+LaTeX Font Info:    External font `cmex10' loaded for size
+(Font)              <5> on input line 1.
+Module luamplib Info: flushing figure 1 on input line 1
+Module luamplib Info: flushing figure 1 on input line 1
+Module luamplib Info: flushing figure 1 on input line 1
+Module luamplib Info: flushing figure 1 on input line 1
+Module luamplib Info: flushing figure 1 on input line 1
+ [1
+
+{/usr/local/texlive/2016/texmf-var/fonts/map/pdftex/updmap/pdftex.map}]
+Module luamplib Info: flushing figure 1 on input line 1
+ [2]
+Module luamplib Info: flushing figure 1 on input line 1
+ [3]
+Module luamplib Info: flushing figure 1 on input line 1
+ [4]
+Module luamplib Info: flushing figure 1 on input line 1
+ [5]
+Module luamplib Info: flushing figure 1 on input line 1
+ [6]
+Module luamplib Info: flushing figure 1 on input line 1
+ [7]
+Module luamplib Info: flushing figure 1 on input line 1
+ [8]
+Module luamplib Info: flushing figure 1 on input line 1
+ [9]
+Module luamplib Info: flushing figure 1 on input line 1
+
+[10] (./delaunay.aux))
+
+Here is how much of LuaTeX's memory you used:
+ 25566 strings out of 495118
+ 125171,552014 words of node,token memory allocated
+ 396 words of node memory still in use:
+   3 hlist, 1 vlist, 1 rule, 7 glue, 4 attribute, 44 glue_spec, 4 attribute_list
+, 1 write nodes
+   avail lists: 1:3,2:642,3:723,4:5,5:14,6:75,7:232,8:2,9:154
+ 28465 multiletter control sequences out of 65536+600000
+ 31 fonts using 2114151 bytes
+ 62i,5n,56p,2237b,365s stack positions out of 5000i,500n,10000p,200000b,100000s
+</usr/local/texlive/2016/texmf-dist/fonts/type1/public/amsfonts/cm/cmmi10.pfb></
+usr/local/texlive/2016/texmf-dist/fonts/type1/public/amsfonts/cm/cmr7.pfb>
+Output written on delaunay.pdf (10 pages, 25488 bytes).
+
+PDF statistics: 46 PDF objects out of 1000 (max. 8388607)
+ 31 compressed objects within 1 object stream
+ 0 named destinations out of 1000 (max. 131072)
+ 16 words of extra memory for PDF output out of 10000 (max. 10000000)
+
diff --git a/test/delaunay.pdf b/test/delaunay.pdf
new file mode 100644 (file)
index 0000000..b1232ee
Binary files /dev/null and b/test/delaunay.pdf differ
diff --git a/test/delaunay.tex b/test/delaunay.tex
new file mode 100644 (file)
index 0000000..42abe52
--- /dev/null
@@ -0,0 +1,51 @@
+\documentclass{article}
+%% compiler avec lualatex
+\usepackage[margin=2.5cm]{geometry}
+\usepackage{luamesh}
+\usepackage{fontspec}
+\usepackage{multido}
+\pagestyle{empty}
+\begin{document}
+
+\buildMesh[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)}
+
+\buildMesh[tikz, bbox = show]{(0,0);(3.5,3);(7,0);(7.5,5);(1.61,3.14);(3,1);(6,1.5)}
+
+\buildMesh[mode=ext]{mesh.txt}
+
+\meshAddOnePoint[
+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)}
+\meshAddOnePoint[
+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)}
+\meshAddOnePoint[
+meshpoint = x,
+colorBack=red!10,
+colorNew = green!20!red,
+scale=0.6cm,
+step=newtriangles,
+newpoint = y
+]
+{(0,0);(3.5,3);(7,0);(7.5,5);(1.61,3.14);(6,4)}{(3,1)}
+
+\multido{\ii=5+1}{3}{%
+  \newpage
+  \meshAddOnePoint[mode=ext,step=badtriangles]{mesh.txt}{\ii}
+  \newpage
+  \meshAddOnePoint[mode=ext,step=cavity]{mesh.txt}{\ii}
+  \newpage
+  \meshAddOnePoint[mode=ext,step=newtriangles]{mesh.txt}{\ii}
+}
+
+
+
+\end{document}
diff --git a/test/luamesh.lua b/test/luamesh.lua
new file mode 120000 (symlink)
index 0000000..df7213e
--- /dev/null
@@ -0,0 +1 @@
+../luamesh.lua
\ No newline at end of file
diff --git a/test/luamesh.sty b/test/luamesh.sty
new file mode 120000 (symlink)
index 0000000..95e32c2
--- /dev/null
@@ -0,0 +1 @@
+../luamesh.sty
\ No newline at end of file
diff --git a/test/mesh.txt b/test/mesh.txt
new file mode 100644 (file)
index 0000000..fffba49
--- /dev/null
@@ -0,0 +1,8 @@
+0  0
+6  0
+2  4
+1.5  2
+2.  0.5
+3  3.
+3.5  1
+3.7 1.5

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.