From: Maxime Chupin (escudo) Date: Wed, 8 Feb 2017 23:27:09 +0000 (+0100) Subject: fonction meshPolygon pour MetaPost faite, ajout de dotpoints pour drawMesh (toujours... X-Git-Url: https://melusine.eu.org/syracuse/G/git/?p=delaunay.git;a=commitdiff_plain;h=fe3a5df51411d6ea20f72115641db9bc7d19a466 fonction meshPolygon pour MetaPost faite, ajout de dotpoints pour drawMesh (toujours MetaPost), à faire pour Tikz et faire documentation --- diff --git a/luamesh-polygon.lua b/luamesh-polygon.lua index 2c14268..1894b48 100644 --- a/luamesh-polygon.lua +++ b/luamesh-polygon.lua @@ -55,7 +55,13 @@ function doIntersect(p1,q1,p2,q2) end -- Returns true if the point p lies inside the polygon[] with n vertices -function isInside(listPoints,p) +function isInside(listPoints,p,h) + -- if the point is to close to a point of the polygon + for i=1,#listPoints do + if(math.sqrt(math.pow(p.x-listPoints[i].x,2) + math.pow(p.y-listPoints[i].y,2))<0.5*h) then + return false + end + end -- There must be at least 3 vertices in polygon[] if (#listPoints <= 3) then return false end -- Create a point for line segment from p to infinite diff --git a/luamesh-tex.lua b/luamesh-tex.lua index f3c06ab..1581638 100644 --- a/luamesh-tex.lua +++ b/luamesh-tex.lua @@ -241,6 +241,17 @@ function traceMeshMP(listPoints, triangulation,points) end end end + if(points=="dotpoints") then + j=1 + for i=1,#listPoints do + if(listPoints[i].type == "bbox") then + output = output .. "drawdot (" .. listPoints[i].x ..",".. listPoints[i].y .. ")*u withcolor \\luameshmpcolorBbox withpen pencircle scaled 3;" + j=j+1 + else + output = output .. "drawdot (" .. listPoints[i].x ..",".. listPoints[i].y .. ")*u withcolor \\luameshmpcolor withpen pencircle scaled 3;" + end + end + end return output end @@ -788,3 +799,74 @@ function gmshVoronoiTikZinc(file,beginning, ending,points,scale,tri,color,colorV output = "\\noindent\\begin{tikzpicture}[x=" .. scale .. ",y=" .. scale .."]" ..beginning.. output..ending .."\\end{tikzpicture}" tex.sprint(output) end + + +-------------------------------------------------- +-- Meshing of a polygon -- +-------------------------------------------------- + + +function TeXMeshPolygonMP(polygon,listPoints, grid, step) + +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 + output = output .. "draw " + for i=1,#polygon do + output = output .. "(" .. polygon[i].x .. "," .. polygon[i].y .. ")*u -- " + end + output = output .. "cycle withcolor \\luameshmpcolorPoly withpen pencircle scaled 1pt;" + if(points=="points") then + for i=1,#polygon do + output = output .. "dotlabel.llft (btex $\\MeshPoint_{" .. i .. "}$ etex, (" .. polygon[i].x ..",".. polygon[i].y .. ")*u ) withcolor \\luameshmpcolorPoly ;" + end + end + if(points=="dotpoints") then + for i=1,#polygon do + output = output .. "drawdot (" .. polygon[i].x ..",".. polygon[i].y .. ")*u withcolor \\luameshmpcolorPoly withpen pencircle scaled 3;" + end + end + return output +end + + + +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) + 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 = "\\leavevmode\\begin{mplibcode}beginfig(0);u:="..scale.. ";" .. output .."endfig;\\end{mplibcode}" + tex.sprint(output) +end diff --git a/luamesh.lua b/luamesh.lua index 402e33d..10a2084 100644 --- a/luamesh.lua +++ b/luamesh.lua @@ -1,6 +1,14 @@ require "luamesh-polygon" require "luamesh-tex" +local function shallowCopy(original) + local copy = {} + for key, value in pairs(original) do + copy[key] = value + end + return copy +end + -- Bowyer and Watson algorithm -- Delaunay meshing function BowyerWatson (listPoints,bbox) @@ -15,7 +23,7 @@ function BowyerWatson (listPoints,bbox) -- 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) + badTriangles = buildBadTriangles(listPoints[i],triangulation,listPoints) -- build the polygon of the cavity containing the point to add polygon = buildCavity(badTriangles, triangulation) -- remove the bad triangles @@ -129,8 +137,9 @@ function removeBoundingBox(triangulation,lgth) end -function buildBadTriangles(point, triangulation) +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]] @@ -316,7 +325,6 @@ function buildVoronoi(listPoints, triangulation) return listVoronoi 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) @@ -345,6 +353,34 @@ function buildList(chaine, mode) end +-- function to add points on a polygon to respect +-- the size of unit mesh +function addPointsPolygon(polygon,h) + local newPolygon = shallowCopy(polygon) + k=0 -- to follow in the newPolygon + for i=1,#polygon do + k = k+1 + ip = (i)%(#polygon)+1 + dist = math.sqrt(math.pow(polygon[i].x-polygon[ip].x,2) + math.pow(polygon[i].y-polygon[ip].y,2)) + -- 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 + end + end + return newPolygon +end + -- function to build a gridpoints from the bounding box -- with a prescribed function buildGrid(listPoints,h) @@ -373,13 +409,13 @@ end -- function to add points from a grid to the interior of a polygon -function addGridPoints(polygon, grid) - local listPoints = polygon +function addGridPoints(polygon, grid,h) + local listPoints = shallowCopy(polygon) k = #polygon for i=1, #grid do --print(grid[i].x,grid[i].y) --print(isInside(polygon,grid[i])) - if(isInside(polygon,grid[i])) then + if(isInside(polygon,grid[i],h)) then k=k+1 listPoints[k] = grid[i] end @@ -388,13 +424,6 @@ function addGridPoints(polygon, grid) end -local function shallowCopy(original) - local copy = {} - for key, value in pairs(original) do - copy[key] = value - end - return copy -end -- function give a real polygon without repeting points function cleanPoly(polygon) diff --git a/luamesh.sty b/luamesh.sty index 9d7c06b..363d085 100644 --- a/luamesh.sty +++ b/luamesh.sty @@ -50,11 +50,13 @@ %% the scale \define@key{buildMeshInc}{scale}[1cm]{\def\luameshval@bmi@scale{#1}}% %% print ponits ? -\define@choicekey*{buildMeshInc}{print}[\val\nr]{none, points}{% +\define@choicekey*{buildMeshInc}{print}[\val\nr]{none, points,dotpoints}{% \ifcase\nr\relax% \def\luameshval@bmi@print{none}% \or% \def\luameshval@bmi@print{points}% + \or% + \def\luameshval@bmi@print{dotpoints}% \fi% }% %% the name of the point @@ -110,11 +112,13 @@ %% the scale \define@key{buildMesh}{scale}[1cm]{\def\luameshval@bm@scale{#1}}% %% print points -\define@choicekey*{buildMesh}{print}[\val\nr]{none, points}{% +\define@choicekey*{buildMesh}{print}[\val\nr]{none, points, dotpoints}{% \ifcase\nr\relax% \def\luameshval@bm@print{none}% \or% \def\luameshval@bm@print{points}% + \or% + \def\luameshval@bm@print{dotpoints}% \fi% }% %% the name of the point @@ -821,3 +825,74 @@ % \fi% }% +% +% +% +%%%%%%%%%%%%%%%% the meshPolygon command +%% +\define@boolkey{meshPolygon}{tikz}[true]{}% + +%% the scale +\define@key{meshPolygon}{scale}[1cm]{\def\luameshval@mp@scale{#1}}% +%% print points +\define@choicekey*{meshPolygon}{print}[\val\nr]{none, points,dotpoints}{% + \ifcase\nr\relax% + \def\luameshval@mp@print{none}% + \or% + \def\luameshval@mp@print{points}% + \or% + \def\luameshval@mp@print{dotpoints}% + \fi% +}% +%% the name of the point +\define@key{meshPolygon}{meshpoint}[P]{\def\luameshval@mp@meshpoint{#1}}% +%% the grid parameter +\define@key{meshPolygon}{h}[0.2]{\def\luameshval@mp@h{#1}}% +%% the mode for reading the points +\define@choicekey*{meshPolygon}{mode}[\val\nr]{int, ext}{% + \ifcase\nr\relax% + \def\luameshval@mp@mode{int}% + \or% + \def\luameshval@mp@mode{ext}% + \fi% +}% +%% the different steps of the meshing +\define@choicekey*{meshPolygon}{step}[\val\nr]{polygon, grid, points, mesh}{% + \ifcase\nr\relax% + \def\luameshval@mp@step{polygon}% + \or% + \def\luameshval@mp@step{grid}% + \or% + \def\luameshval@mp@step{points}% + \or% + \def\luameshval@mp@step{mesh}% + \fi% +}% + +%% the name of the color of drawing +\define@key{meshPolygon}{color}[black]{\def\luameshval@mp@color{#1}}% +%% the name of the color of drawing Voronoi +\define@key{meshPolygon}{colorPolygon}[red]{\def\luameshval@mp@colorPolygon{#1}}% +%% the name of the color of drawing the bbox +% +\presetkeys{meshPolygon}{tikz=false,scale,mode=int,step=mesh,print=none,color,colorPolygon,h}{}% +% +\newcommand{\meshPolygon}[2][]{% + % #1 : optionnal arguments + % #2 : the string containing the list of points + % (x1,y1);(x2,y2);... or the name file containing the points + \setkeys{meshPolygon}{#1} % + \def\MeshPoint{\luameshval@mp@meshpoint}% + \ifKV@meshPolygon@tikz% if we are using tikz + \directlua{% + drawMeshPolygonTikZBW("#2","\luameshval@mp@mode","\luameshval@mp@print","\luameshval@mp@bbox","\luameshval@mp@scale","\luameshval@mp@delaunay","\luameshval@mp@color","\luameshval@mp@colorbbox","\luameshval@mp@colorVoronoi","\luameshval@mp@styleDelaunay","\luameshval@mp@styleVoronoi")% + }% + \else % we are using MP + \mplibcolor{\luameshmpcolor}{\luameshval@mp@color}% + \mplibcolor{\luameshmpcolorPoly}{\luameshval@mp@colorPolygon}% + \directlua{% + drawMeshPolygonMP("#2","\luameshval@mp@mode","\luameshval@mp@h","\luameshval@mp@step","\luameshval@mp@print","\luameshval@mp@scale")% + }% + % + \fi% +}% diff --git a/test/delaunay.pdf b/test/delaunay.pdf index 14a41b6..1ef9f3f 100644 Binary files a/test/delaunay.pdf and b/test/delaunay.pdf differ diff --git a/test/delaunay.tex b/test/delaunay.tex index 1c3d0ef..83dcdfb 100644 --- a/test/delaunay.tex +++ b/test/delaunay.tex @@ -8,167 +8,173 @@ \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{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") +% \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; % } -\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} +% \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; +% } -\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}{}{} +% \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} + + +% \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") +% } -\buildVoronoiBWinc[tikz,mode=ext,print=points,delaunay=show,meshpoint=x,circumpoint=y]{mesh.txt}{}{\draw[color=blue,thick] (0,0)--(3,3);} +% \drawGmsh[tikz,scale=8cm]{maillage.msh} -\def\MeshPoints{P} -\directlua{ - drawGmshMP("maillage.msh","points","8cm") -}\par -\directlua{ - gmshVoronoiMP("maillage.msh","none","8cm","none") -} +% \gmshVoronoi[tikz,scale=8cm,print=points,delaunay=show]{maillage.msh} -\drawGmsh[tikz,scale=8cm]{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)} +\meshPolygon[step=grid,scale=3cm]{(0,0);(1,0);(1,0.5);(0.5,1);(-0.3,0.3)} +\meshPolygon[step=points,scale=3cm]{(0,0);(1,0);(1,0.5);(0.5,1);(-0.3,0.3)} +\meshPolygon[step=mesh,scale=3cm,print=dotpoints]{(0,0);(1,0);(1,0.5);(0.5,1);(-0.3,0.3)} \end{document}