X-Git-Url: https://melusine.eu.org/syracuse/G/git/?p=delaunay.git;a=blobdiff_plain;f=luamesh.lua;h=5227f86d362e74ac8bf10edfe457a8da24921a7a;hp=060d3893789e5d5c0c1f1021306a794a5d6f1c68;hb=ce88841e4c39f70da4603909378967a0fd5c48ae;hpb=791c961e11f1d1114a9c8ba169d1422a8bcb4a94 diff --git a/luamesh.lua b/luamesh.lua index 060d389..5227f86 100644 --- a/luamesh.lua +++ b/luamesh.lua @@ -301,6 +301,34 @@ function traceMeshMP(listPoints, triangulation,points) end +-- print points of the mesh +function tracePointsMP(listPoints,points) + output = ""; + output = output .. " pair MeshPoints[];" + for i=1,#listPoints do + output = output .. "MeshPoints[".. i .. "] = (" .. listPoints[i].x .. "," .. listPoints[i].y .. ");" + end + if(points=="points") then + for i=1,#listPoints do + if(listPoints[i].type == "bbox") then + output = output .. "dotlabel.llft (btex $\\MeshPoint_{" .. i .. "}$ etex, (" .. listPoints[i].x ..",".. listPoints[i].y .. ")*u ) withcolor \\luameshmpcolorBbox ;" + else + output = output .. "dotlabel.llft (btex $\\MeshPoint_{" .. i .. "}$ etex, (" .. listPoints[i].x ..",".. listPoints[i].y .. ")*u ) withcolor \\luameshmpcolor ;" + end + end + else + for i=1,#listPoints do + if(listPoints[i].type == "bbox") then + output = output .. "drawdot (" .. listPoints[i].x ..",".. listPoints[i].y .. ")*u ) withcolor \\luameshmpcolorBbox ;" + else + output = output .. "drawdot (" .. listPoints[i].x ..",".. listPoints[i].y .. ")*u ) withcolor \\luameshmpcolor ;" + end + end + end + return output +end + + -- buildMesh with TikZ function buildMeshTikZ(chaine,mode,points,bbox,full,scale,color) @@ -323,6 +351,29 @@ function buildMeshMPBW(chaine,mode,points,bbox,scale) tex.sprint(output) end +-- print points to mesh +function printPointsMP(chaine,mode,points,bbox,scale) + listPoints = buildList(chaine, mode) + if(bbox == "bbox" ) then + listPoints = buildBoundingBox(listPoints) + end + output = tracePointsMP(listPoints,points) + output = "\\leavevmode\\begin{mplibcode}beginfig(0);u:="..scale.. ";" .. output .."endfig;\\end{mplibcode}" + tex.sprint(output) +end + + +-- print points to mesh +function printPointsMPinc(chaine,beginning, ending, mode,points,bbox,scale) + listPoints = buildList(chaine, mode) + if(bbox == "bbox" ) then + listPoints = buildBoundingBox(listPoints) + end + output = tracePointsMP(listPoints,points) + output = "\\begin{mplibcode}u:="..scale..";"..beginning .. output .. ending .. "\\end{mplibcode}" + tex.sprint(output) +end + -- buildMesh with MP include code function buildMeshMPBWinc(chaine,beginning, ending,mode,points,bbox,scale)