X-Git-Url: https://melusine.eu.org/syracuse/G/git/?a=blobdiff_plain;f=luamesh.lua;h=83c2c257a34ea2ae9be4511885f314ddf3355ebc;hb=75a1db321845d3b698a0fde04022f5e115b59d42;hp=c8ffc51bcd1191173754c0d8e06784d9c75e83a6;hpb=f86b1ec82bbbba1a96989bb5d6f5b78e261659a1;p=delaunay.git diff --git a/luamesh.lua b/luamesh.lua index c8ffc51..83c2c25 100644 --- a/luamesh.lua +++ b/luamesh.lua @@ -266,9 +266,11 @@ function traceMeshTikZ(listPoints, triangulation,points,color,colorBbox) end end if(points=="points") then + j=1 for i=1,#listPoints do if(listPoints[i].type == "bbox") then - output = output .. "\\draw[color="..colorBbox.."] (" .. listPoints[i].x ..",".. listPoints[i].y .. ") node {$\\bullet$} node[anchor=north east] {$\\MeshPoint_{" .. i .. "}$};" + output = output .. "\\draw[color="..colorBbox.."] (" .. listPoints[i].x ..",".. listPoints[i].y .. ") node {$\\bullet$} node[anchor=north east] {$\\MeshPoint^*_{" .. j .. "}$};" + j=j+1 else output = output .. "\\draw[color="..color.."] (" .. listPoints[i].x ..",".. listPoints[i].y .. ") node {$\\bullet$} node[anchor=north east] {$\\MeshPoint_{" .. i .. "}$};" end @@ -381,9 +383,11 @@ end function tracePointsTikZ(listPoints,points,color,colorBbox) output = ""; if(points=="points") then + j=1 for i=1,#listPoints do if(listPoints[i].type == "bbox") then - output = output .. "\\draw[color="..colorBbox.."] (" .. listPoints[i].x ..",".. listPoints[i].y .. ") node {$\\bullet$} node[anchor=north east] {$\\MeshPoint_{" .. i .. "}$};" + output = output .. "\\draw[color="..colorBbox.."] (" .. listPoints[i].x ..",".. listPoints[i].y .. ") node {$\\bullet$} node[anchor=north east] {$\\MeshPoint^*_{" .. j .. "}$};" + j = j+1 else output = output .. "\\draw[color="..color.."] (" .. listPoints[i].x ..",".. listPoints[i].y .. ") node {$\\bullet$} node[anchor=north east] {$\\MeshPoint_{" .. i .. "}$};" end @@ -498,10 +502,10 @@ function cleanPoly(polygon) end -- -function TeXaddOnePointTikZ(chaine,point,step,color,colorBack, colorNew, colorCircle,colorBbox) +function TeXaddOnePointTikZ(listPoints,P,step,bbox,color,colorBack, colorNew, colorCircle,colorBbox) output = "" -- build the triangulation - triangulation = BowyerWatson(listPoints,"none") + triangulation = BowyerWatson(listPoints,bbox) badTriangles = buildBadTriangles(P,triangulation) if(step == "badT") then -- draw all triangle @@ -531,9 +535,11 @@ function TeXaddOnePointTikZ(chaine,point,step,color,colorBack, colorNew, colorCi output = output .. "\\draw[dashed, color="..colorCircle.."] ("..center.x .. "," .. center.y .. ") circle ("..radius ..");" end -- mark the points + j=1 for i=1,#listPoints do if(listPoints[i].type == "bbox") then - output = output .. "\\draw[color="..colorBbox.."] (" .. listPoints[i].x ..",".. listPoints[i].y .. ") node {$\\bullet$} node[anchor=north east] {$\\MeshPoint_{" .. i .. "}$};" + output = output .. "\\draw[color="..colorBbox.."] (" .. listPoints[i].x ..",".. listPoints[i].y .. ") node {$\\bullet$} node[anchor=north east] {$\\MeshPoint^*_{" .. j .. "}$};" + j = j+1 else output = output .. "\\draw[color="..color.."] (" .. listPoints[i].x ..",".. listPoints[i].y .. ") node {$\\bullet$} node[anchor=north east] {$\\MeshPoint_{" .. i .. "}$};" end @@ -566,9 +572,11 @@ function TeXaddOnePointTikZ(chaine,point,step,color,colorBack, colorNew, colorCi end output = output .. "\\draw[color="..colorNew..",fill ="..colorBack..", thick] " .. path .. "cycle;" -- mark the points of the mesh + j=1 for i=1,#listPoints do if(listPoints[i].type == "bbox") then - output = output .. "\\draw[color="..colorBbox.."] (" .. listPoints[i].x ..",".. listPoints[i].y .. ") node {$\\bullet$} node[anchor=north east] {$\\MeshPoint_{" .. i .. "}$};" + output = output .. "\\draw[color="..colorBbox.."] (" .. listPoints[i].x ..",".. listPoints[i].y .. ") node {$\\bullet$} node[anchor=north east] {$\\MeshPoint^*_{" .. j .. "}$};" + j=j+1 else output = output .. "\\draw[color="..color.."] (" .. listPoints[i].x ..",".. listPoints[i].y .. ") node {$\\bullet$} node[anchor=north east] {$\\MeshPoint_{" .. i .. "}$};" end @@ -607,9 +615,11 @@ function TeXaddOnePointTikZ(chaine,point,step,color,colorBack, colorNew, colorCi output = output .. "\\draw[color="..colorNew..", thick]".."(".. listPoints[polygon[i][2]].x .. "," .. listPoints[polygon[i][2]].y .. ") -- (" .. P.x .. "," .. P.y ..");" end -- mark points + j=1 for i=1,#listPoints do if(listPoints[i].type == "bbox") then - output = output .. "\\draw[color="..colorBbox.."] (" .. listPoints[i].x ..",".. listPoints[i].y .. ") node {$\\bullet$} node[anchor=north east] {$\\MeshPoint_{" .. i .. "}$};" + output = output .. "\\draw[color="..colorBbox.."] (" .. listPoints[i].x ..",".. listPoints[i].y .. ") node {$\\bullet$} node[anchor=north east] {$\\MeshPoint^*_{" .. j .. "}$};" + j=j+1 else output = output .. "\\draw[color="..color.."] (" .. listPoints[i].x ..",".. listPoints[i].y .. ") node {$\\bullet$} node[anchor=north east] {$\\MeshPoint_{" .. i .. "}$};" end @@ -780,7 +790,7 @@ function TeXOnePointTikZBW(chaine,point,step,scale,mode,bbox,color,colorBack,col -- point is a number P, listPoints = buildListExt(chaine,tonumber(point)) end - output = TeXaddOnePointTikZ(chaine,point,step,color,colorBack,colorNew,colorCircle,colorBbox) + output = TeXaddOnePointTikZ(listPoints,P,step,bbox,color,colorBack,colorNew,colorCircle,colorBbox) output = "\\noindent\\begin{tikzpicture}[x="..scale..",y="..scale.."]".. output .. "\\end{tikzpicture}" tex.sprint(output) end @@ -794,7 +804,7 @@ function TeXOnePointTikZBWinc(chaine,point,beginning, ending,step,scale,mode,bbo -- point is a number P, listPoints = buildListExt(chaine,tonumber(point)) end - output = TeXaddOnePointTikZ(chaine,point,step,color,colorBack,colorNew,colorCircle,colorBbox) + output = TeXaddOnePointTikZ(listPoints,P,step,bbox,color,colorBack,colorNew,colorCircle,colorBbox) output = "\\noindent\\begin{tikzpicture}[x="..scale..",y="..scale.."]".. beginning..output ..ending.. "\\end{tikzpicture}" tex.sprint(output) end