X-Git-Url: https://melusine.eu.org/syracuse/G/git/?a=blobdiff_plain;f=luamesh-tex.lua;h=11e31a4c77cbbe8575e05cdd046720b157759072;hb=fc5d330713640fd0b5ad351db12b7c4e3143fca6;hp=528b6a4838f51a746f04f661d02c522f0471ce46;hpb=69d738f58952eaf2e69da5817f9c7ab8c81a68c1;p=delaunay.git diff --git a/luamesh-tex.lua b/luamesh-tex.lua index 528b6a4..11e31a4 100644 --- a/luamesh-tex.lua +++ b/luamesh-tex.lua @@ -873,10 +873,10 @@ end function drawMeshPolygonMP(chaine,mode,h,step, - points,scale) + points,scale,random) local polygon = buildList(chaine, mode) polygon = addPointsPolygon(polygon,h) - local grid = buildGrid(polygon,h) + local grid = buildGrid(polygon,h,random) local listPoints = addGridPoints(polygon,grid,h) if(step=="polygon") then -- the polygon @@ -906,10 +906,10 @@ end function drawMeshPolygonTikZ(chaine,mode,h,step, - points,scale,color,colorPoly) + points,scale,color,colorPoly,random) local polygon = buildList(chaine, mode) polygon = addPointsPolygon(polygon,h) - local grid = buildGrid(polygon,h) + local grid = buildGrid(polygon,h,random) local listPoints = addGridPoints(polygon,grid,h) if(step=="polygon") then -- the polygon @@ -934,3 +934,65 @@ function drawMeshPolygonTikZ(chaine,mode,h,step, output = "\\noindent\\begin{tikzpicture}[x=" .. scale .. ",y=" .. scale .."]" .. output .."\\end{tikzpicture}" tex.sprint(output) end + +function drawMeshPolygonMPinc(chaine,beginning,ending,mode,h,step, + points,scale,random) + local polygon = buildList(chaine, mode) + polygon = addPointsPolygon(polygon,h) + local grid = buildGrid(polygon,h,random) + local listPoints = addGridPoints(polygon,grid,h) + if(step=="polygon") then + -- the polygon + output = tracePolygonMP(polygon,points) + end + if(step=="grid") then + -- polygon + grid + output = tracePointsMP(grid,points) + output = output .. tracePolygonMP(polygon,points) + end + if(step=="points") then + -- polygon + only grid points inside the polygon + output = tracePointsMP(listPoints,points) + output = output .. tracePolygonMP(polygon,points) + end + if(step=="mesh") then + -- polygon + mesh + triangulation = BowyerWatson(listPoints,"none") -- no bbox + output = traceMeshMP(listPoints,triangulation,points) + output = output .. tracePolygonMP(polygon,points) + end + output = "\\begin{mplibcode}u:="..scale..";"..beginning .. output .. ending .. "\\end{mplibcode}" + tex.sprint(output) +end + + + +function drawMeshPolygonTikZinc(chaine,beginning,ending,mode,h,step, + points,scale,color,colorPoly,random) + local polygon = buildList(chaine, mode) + polygon = addPointsPolygon(polygon,h) + local grid = buildGrid(polygon,h,random) + local listPoints = addGridPoints(polygon,grid,h) + if(step=="polygon") then + -- the polygon + output = tracePolygonTikZ(polygon,points,colorPoly) + end + if(step=="grid") then + -- polygon + grid + output = tracePointsTikZ(grid,points,color,"none") -- none for colorBbox + output = output .. tracePolygonTikZ(polygon,points,colorPoly) + end + if(step=="points") then + -- polygon + only grid points inside the polygon + output = tracePointsTikZ(listPoints,points,color,"none") + output = output .. tracePolygonTikZ(polygon,points,colorPoly) + end + if(step=="mesh") then + -- polygon + mesh + triangulation = BowyerWatson(listPoints,"none") -- no bbox + output = traceMeshTikZ(listPoints,triangulation,points,color,"none") + output = output .. tracePolygonTikZ(polygon,points,colorPoly) + end + output = "\\noindent\\begin{tikzpicture}[x="..scale..",y="..scale.."]".. beginning..output ..ending.. "\\end{tikzpicture}" + tex.sprint(output) +end