From: Maxime Chupin (escudo) Date: Wed, 23 Nov 2016 21:44:11 +0000 (+0100) Subject: Mise à jour de la version utilisant le moteur tikz X-Git-Url: https://melusine.eu.org/syracuse/G/git/?a=commitdiff_plain;h=f86b1ec82bbbba1a96989bb5d6f5b78e261659a1;p=delaunay.git Mise à jour de la version utilisant le moteur tikz --- diff --git a/luamesh.lua b/luamesh.lua index ad6ec6f..c8ffc51 100644 --- a/luamesh.lua +++ b/luamesh.lua @@ -253,17 +253,25 @@ function rectangleList(a,b,nbrA,nbrB) end -- trace a triangulation with TikZ -function traceMeshTikZ(listPoints, triangulation,points,color) +function traceMeshTikZ(listPoints, triangulation,points,color,colorBbox) 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;" + if(triangulation[i].type == "bbox") then + output = output .. "\\draw[color="..colorBbox.."] (".. PointI.x ..",".. PointI.y ..")--("..PointJ.x..",".. PointJ.y ..")--("..PointK.x..",".. PointK.y ..")--cycle;" + else + output = output .. "\\draw[color="..color.."] (".. PointI.x ..",".. PointI.y ..")--("..PointJ.x..",".. PointJ.y ..")--("..PointK.x..",".. PointK.y ..")--cycle;" + end 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 .. "}$};" + 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 .. "}$};" + else + output = output .. "\\draw[color="..color.."] (" .. listPoints[i].x ..",".. listPoints[i].y .. ") node {$\\bullet$} node[anchor=north east] {$\\MeshPoint_{" .. i .. "}$};" + end end end return output @@ -303,6 +311,43 @@ function traceMeshMP(listPoints, triangulation,points) end +-- buildMesh with MP +function buildMeshMPBW(chaine,mode,points,bbox,scale) + listPoints = buildList(chaine, mode) + triangulation = BowyerWatson(listPoints,bbox) + output = traceMeshMP(listPoints, triangulation,points) + output = "\\leavevmode\\begin{mplibcode}beginfig(0);u:="..scale.. ";" .. output .."endfig;\\end{mplibcode}" + tex.sprint(output) +end + +-- buildMesh with MP include code +function buildMeshMPBWinc(chaine,beginning, ending,mode,points,bbox,scale) + listPoints = buildList(chaine, mode) + triangulation = BowyerWatson(listPoints,bbox) + output = traceMeshMP(listPoints, triangulation,points) + output = "\\leavevmode\\begin{mplibcode}u:="..scale..";"..beginning .. output .. ending .. "\\end{mplibcode}" + tex.sprint(output) +end + +-- buildMesh with TikZ +function buildMeshTikZBW(chaine,mode,points,bbox,scale,color,colorBbox) + listPoints = buildList(chaine, mode) + triangulation = BowyerWatson(listPoints,bbox) + output = traceMeshTikZ(listPoints, triangulation,points,color,colorBbox) + output = "\\noindent\\begin{tikzpicture}[x=" .. scale .. ",y=" .. scale .."]" .. output .."\\end{tikzpicture}" + tex.sprint(output) +end + +-- buildMesh with TikZ +function buildMeshTikZBWinc(chaine,beginning, ending,mode,points,bbox,scale,color,colorBbox) + listPoints = buildList(chaine, mode) + triangulation = BowyerWatson(listPoints,bbox) + output = traceMeshTikZ(listPoints, triangulation,points,color,colorBbox) + output = "\\noindent\\begin{tikzpicture}[x=" .. scale .. ",y=" .. scale .."]" ..beginning.. output..ending .."\\end{tikzpicture}" + tex.sprint(output) +end + + -- print points of the mesh function tracePointsMP(listPoints,points) output = ""; @@ -323,36 +368,36 @@ function tracePointsMP(listPoints,points) else for i=1,#listPoints do if(listPoints[i].type == "bbox") then - output = output .. "drawdot (" .. listPoints[i].x ..",".. listPoints[i].y .. ")*u ) withcolor \\luameshmpcolorBbox ;" + output = output .. "drawdot (" .. listPoints[i].x ..",".. listPoints[i].y .. ")*u withcolor \\luameshmpcolorBbox withpen pencircle scaled 3;" else - output = output .. "drawdot (" .. listPoints[i].x ..",".. listPoints[i].y .. ")*u ) withcolor \\luameshmpcolor ;" + output = output .. "drawdot (" .. listPoints[i].x ..",".. listPoints[i].y .. ")*u withcolor \\luameshmpcolor withpen pencircle scaled 3;" end 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}" +-- print points of the mesh +function tracePointsTikZ(listPoints,points,color,colorBbox) + output = ""; + if(points=="points") then + 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 .. "}$};" + else + output = output .. "\\draw[color="..color.."] (" .. listPoints[i].x ..",".. listPoints[i].y .. ") node {$\\bullet$} node[anchor=north east] {$\\MeshPoint_{" .. i .. "}$};" + end + end + else + for i=1,#listPoints do + if(listPoints[i].type == "bbox") then + output = output .. "\\draw[color="..colorBbox.."] (" .. listPoints[i].x ..",".. listPoints[i].y .. ") node {$\\bullet$} ;" + else + output = output .. "\\draw[color="..color.."] (" .. listPoints[i].x ..",".. listPoints[i].y .. ") node {$\\bullet$} ;" + end + end end - tex.sprint(output) -end - - --- buildMesh with MP -function buildMeshMPBW(chaine,mode,points,bbox,scale) - listPoints = buildList(chaine, mode) - triangulation = BowyerWatson(listPoints,bbox) - output = traceMeshMP(listPoints, triangulation,points) - output = "\\leavevmode\\begin{mplibcode}beginfig(0);u:="..scale.. ";" .. output .."endfig;\\end{mplibcode}" - tex.sprint(output) + return output end -- print points to mesh @@ -378,16 +423,30 @@ function printPointsMPinc(chaine,beginning, ending, mode,points,bbox,scale) tex.sprint(output) end +-- print points to mesh +function printPointsTikZ(chaine,mode,points,bbox,scale,color,colorBbox) + listPoints = buildList(chaine, mode) + if(bbox == "bbox" ) then + listPoints = buildBoundingBox(listPoints) + end + output = tracePointsTikZ(listPoints,points,color,colorBbox) + output = "\\noindent\\begin{tikzpicture}[x=" .. scale .. ",y=" .. scale .."]" .. output .."\\end{tikzpicture}" + tex.sprint(output) +end + --- buildMesh with MP include code -function buildMeshMPBWinc(chaine,beginning, ending,mode,points,bbox,scale) +-- print points to mesh +function printPointsTikZinc(chaine,beginning, ending, mode,points,bbox,scale,color,colorBbox) listPoints = buildList(chaine, mode) - triangulation = BowyerWatson(listPoints,bbox) - output = traceMeshMP(listPoints, triangulation,points) - output = "\\begin{mplibcode}u:="..scale..";"..beginning .. output .. ending .. "\\end{mplibcode}" + if(bbox == "bbox" ) then + listPoints = buildBoundingBox(listPoints) + end + output = tracePointsTikZ(listPoints,points,color,colorBbox) + output = "\\noindent\\begin{tikzpicture}[x=" .. scale .. ",y=" .. scale .."]" ..beginning.. output..ending .."\\end{tikzpicture}" tex.sprint(output) end + -- buildMesh function buildRect(largeur,a,b,nbrA, nbrB) listPoints = rectangleList(a,b,nbrA,nbrB) @@ -417,7 +476,6 @@ function cleanPoly(polygon) i=1 find = false while (i<=#polyCopy and find==false) do - i = i+1 bool1 = (polyCopy[i][1] == polyNew[j]) bool2 = (polyCopy[i][2] == polyNew[j]) if(bool1 or bool2) then -- the edge has a common point with polyNew[j] @@ -433,17 +491,15 @@ function cleanPoly(polygon) j = j+1 end end + i=i+1 end end return polyNew end -- -function TeXaddOnePointTikZ(chaine,point,step,color,colorBack, colorNew, colorCircle) - Sx,Sy=string.match(point,"%((.+),(.+)%)") - P = {x=Sx, y=Sy} +function TeXaddOnePointTikZ(chaine,point,step,color,colorBack, colorNew, colorCircle,colorBbox) output = "" - listPoints = buildList(chaine, "int") -- build the triangulation triangulation = BowyerWatson(listPoints,"none") badTriangles = buildBadTriangles(P,triangulation) @@ -453,7 +509,11 @@ function TeXaddOnePointTikZ(chaine,point,step,color,colorBack, colorNew, colorCi 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;" + if(triangulation[i].type == "bbox") then + output = output .. "\\draw[color="..colorBbox.."] (".. PointI.x ..",".. PointI.y ..")--("..PointJ.x..",".. PointJ.y ..")--("..PointK.x..",".. PointK.y ..")--cycle;" + else + output = output .. "\\draw[color="..color.."] (".. PointI.x ..",".. PointI.y ..")--("..PointJ.x..",".. PointJ.y ..")--("..PointK.x..",".. PointK.y ..")--cycle;" + end end -- draw and fill the bad triangle for i=1,#badTriangles do @@ -472,7 +532,11 @@ function TeXaddOnePointTikZ(chaine,point,step,color,colorBack, colorNew, colorCi 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 .. "}$};" + 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 .. "}$};" + else + output = output .. "\\draw[color="..color.."] (" .. listPoints[i].x ..",".. listPoints[i].y .. ") node {$\\bullet$} node[anchor=north east] {$\\MeshPoint_{" .. i .. "}$};" + end end -- mark the point to add output = output .. "\\draw[color="..colorNew.."] (" .. P.x ..",".. P.y .. ") node {$\\bullet$} node[anchor=north east] {$\\NewPoint$};" @@ -488,7 +552,11 @@ function TeXaddOnePointTikZ(chaine,point,step,color,colorBack, colorNew, colorCi 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;" + if(triangulation[i].type == "bbox") then + output = output .. "\\draw[color="..colorBbox.."] (".. PointI.x ..",".. PointI.y ..")--("..PointJ.x..",".. PointJ.y ..")--("..PointK.x..",".. PointK.y ..")--cycle;" + else + output = output .. "\\draw[color="..color.."] (".. PointI.x ..",".. PointI.y ..")--("..PointJ.x..",".. PointJ.y ..")--("..PointK.x..",".. PointK.y ..")--cycle;" + end end -- fill and draw the cavity path = "" @@ -499,7 +567,11 @@ function TeXaddOnePointTikZ(chaine,point,step,color,colorBack, colorNew, colorCi 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 .. "}$};" + 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 .. "}$};" + else + output = output .. "\\draw[color="..color.."] (" .. listPoints[i].x ..",".. listPoints[i].y .. ") node {$\\bullet$} node[anchor=north east] {$\\MeshPoint_{" .. i .. "}$};" + end end -- mark the adding point output = output .. "\\draw[color="..colorNew.."] (" .. P.x ..",".. P.y .. ") node {$\\bullet$} node[anchor=north east] {$\\NewPoint$};" @@ -515,7 +587,11 @@ function TeXaddOnePointTikZ(chaine,point,step,color,colorBack, colorNew, colorCi 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;" + if(triangulation[i].type == "bbox") then + output = output .. "\\draw[color="..colorBbox.."] (".. PointI.x ..",".. PointI.y ..")--("..PointJ.x..",".. PointJ.y ..")--("..PointK.x..",".. PointK.y ..")--cycle;" + else + output = output .. "\\draw[color="..color.."] (".. PointI.x ..",".. PointI.y ..")--("..PointJ.x..",".. PointJ.y ..")--("..PointK.x..",".. PointK.y ..")--cycle;" + end end -- fill and draw the cavity path = "" @@ -532,7 +608,11 @@ function TeXaddOnePointTikZ(chaine,point,step,color,colorBack, colorNew, colorCi 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 .. "}$};" + 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 .. "}$};" + else + output = output .. "\\draw[color="..color.."] (" .. listPoints[i].x ..",".. listPoints[i].y .. ") node {$\\bullet$} node[anchor=north east] {$\\MeshPoint_{" .. i .. "}$};" + end end -- mark the added point output = output .. "\\draw[color="..colorNew.."] (" .. P.x ..",".. P.y .. ") node {$\\bullet$} node[anchor=north east] {$\\NewPoint$};" @@ -691,12 +771,34 @@ function buildListExt(chaine, stop) end -function TeXOnePointTikZ(chaine,point,step,color,colorBack,colorNew,colorCircle,scale) - output = TeXaddOnePointTikZ(chaine,point,step,color,colorBack,colorNew,colorCircle) +function TeXOnePointTikZBW(chaine,point,step,scale,mode,bbox,color,colorBack,colorNew,colorCircle,colorBbox) + 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 = TeXaddOnePointTikZ(chaine,point,step,color,colorBack,colorNew,colorCircle,colorBbox) output = "\\noindent\\begin{tikzpicture}[x="..scale..",y="..scale.."]".. output .. "\\end{tikzpicture}" tex.sprint(output) end +function TeXOnePointTikZBWinc(chaine,point,beginning, ending,step,scale,mode,bbox,color,colorBack,colorNew,colorCircle,colorBbox) + 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 = TeXaddOnePointTikZ(chaine,point,step,color,colorBack,colorNew,colorCircle,colorBbox) + output = "\\noindent\\begin{tikzpicture}[x="..scale..",y="..scale.."]".. beginning..output ..ending.. "\\end{tikzpicture}" + tex.sprint(output) +end + function TeXOnePointMPBW(chaine,point,step,scale,mode,bbox) if(mode=="int") then Sx,Sy=string.match(point,"%((.+),(.+)%)") diff --git a/luamesh.sty b/luamesh.sty index 006b254..7133ddb 100644 --- a/luamesh.sty +++ b/luamesh.sty @@ -80,17 +80,17 @@ % (x1,y1);(x2,y2);... or the name file containing the points % #3 : the code to place before the generated one % #4 : the code to place after the generated one - \setkeys{buildMesh}{#1} % + \setkeys{buildMeshInc}{#1} % \def\MeshPoint{\luameshval@bmi@meshpoint}% - \ifKV@buildMesh@tikz% if we are using tikz + \ifKV@buildMeshInc@tikz% if we are using tikz \directlua{% - buildMeshTikZ("#2","\luameshval@bmi@mode","\luameshval@bmi@print","\luameshval@bmi@bbox","full","\luameshval@bmi@scale","\luameshval@bmi@color")% + buildMeshTikZBWinc("#2","\luaescapestring{\unexpanded{#3}}","\luaescapestring{\unexpanded{#4}}","\luameshval@bmi@mode","\luameshval@bmi@print","\luameshval@bmi@bbox","\luameshval@bmi@scale","\luameshval@bmi@color","\luameshval@bmi@colorbbox")% }% \else % we are using MP \mplibcolor{\luameshmpcolor}{\luameshval@bmi@color} \mplibcolor{\luameshmpcolorBbox}{\luameshval@bmi@colorbbox} \directlua{% - buildMeshMPBWinc("#2","#3","#4","\luameshval@bmi@mode","\luameshval@bmi@print","\luameshval@bmi@bbox","\luameshval@bmi@scale")% + buildMeshMPBWinc("#2","\luaescapestring{\unexpanded{#3}}","\luaescapestring{\unexpanded{#4}}","\luameshval@bmi@mode","\luameshval@bmi@print","\luameshval@bmi@bbox","\luameshval@bmi@scale")% }% % \fi% @@ -142,7 +142,7 @@ \def\MeshPoint{\luameshval@bm@meshpoint}% \ifKV@buildMesh@tikz% if we are using tikz \directlua{% - buildMeshTikZ("#2","\luameshval@bm@mode","\luameshval@bm@print","\luameshval@bm@bbox","full","\luameshval@bm@scale","\luameshval@bm@color")% + buildMeshTikZBW("#2","\luameshval@bm@mode","\luameshval@bm@print","\luameshval@bm@bbox","\luameshval@bm@scale","\luameshval@bm@color","\luameshval@bm@colorbbox")% }% \else % we are using MP \mplibcolor{\luameshmpcolor}{\luameshval@bm@color} @@ -200,9 +200,9 @@ % (x1,y1);(x2,y2);... or the name file containing the points \setkeys{tracePoints}{#1} % \def\MeshPoint{\luameshval@tp@meshpoint}% - \ifKV@buildMesh@tikz% if we are using tikz + \ifKV@tracePoints@tikz% if we are using tikz \directlua{% - % buildMeshTikZ("#2","\luameshval@tp@mode","\luameshval@tp@print","\luameshval@tp@bbox","full","\luameshval@tp@scale","\luameshval@tp@color")% + printPointsTikZ("#2","\luameshval@tp@mode","\luameshval@tp@print","\luameshval@tp@bbox","\luameshval@tp@scale","\luameshval@tp@color","\luameshval@tp@colorbbox")% }% \else % we are using MP \mplibcolor{\luameshmpcolor}{\luameshval@tp@color} @@ -272,7 +272,7 @@ \mplibcolor{\luameshmpcolor}{\luameshval@tpi@color} \mplibcolor{\luameshmpcolorBbox}{\luameshval@tpi@colorbbox} \directlua{% - printPointsMPinc("#2","#3","#4","\luameshval@tpi@mode","\luameshval@tpi@print","\luameshval@tpi@bbox","\luameshval@tpi@scale")% + printPointsMPinc("#2","\luaescapestring{\unexpanded{#3}}","\luaescapestring{\unexpanded{#4}}","\luameshval@tpi@mode","\luameshval@tpi@print","\luameshval@tpi@bbox","\luameshval@tpi@scale")% }% \fi% }% @@ -331,14 +331,12 @@ % #1 : optionnal arguments % #2 : the string containing the list of points % (x1,y1);(x2,y2);... or the name file containing the points - % #3 : the code to place before the generated one - % #4 : the code to place after the generated one \setkeys{MeshAddOneBW}{#1} % \def\MeshPoint{\luameshval@ap@meshpoint}% \def\NewPoint{\luameshval@ap@newpoint}% - \ifKV@MeshAddOne@tikz% if we are using tikz + \ifKV@MeshAddOneBW@tikz% if we are using tikz \directlua{% - buildMeshTikZ("#2","\luameshval@ap@mode","\luameshval@ap@print","\luameshval@ap@bbox","full","\luameshval@ap@scale","\luameshval@ap@color")% + TeXOnePointTikZBW("#2","#3","\luameshval@ap@step","\luameshval@ap@scale","\luameshval@ap@mode","\luameshval@ap@bbox","\luameshval@ap@color","\luameshval@ap@colorback","\luameshval@ap@colornew","\luameshval@ap@colorcircle","\luameshval@ap@colorbbox")% }% \else % we are using MP \mplibcolor{\luameshmpcolor}{\luameshval@ap@color} @@ -412,7 +410,7 @@ \def\NewPoint{\luameshval@api@newpoint}% \ifKV@MeshAddOneBWinc@tikz% if we are using tikz \directlua{% - buildMeshTikZ("#2","\luameshval@api@mode","\luameshval@api@print","\luameshval@api@bbox","\luameshval@api@scale","\luameshval@api@color")% + TeXOnePointTikZBWinc("#2","#3","\luaescapestring{\unexpanded{#4}}","\luaescapestring{\unexpanded{#5}}","\luameshval@ap@step","\luameshval@ap@scale","\luameshval@ap@mode","\luameshval@ap@bbox","\luameshval@ap@color","\luameshval@ap@colorback","\luameshval@ap@colornew","\luameshval@ap@colorcircle","\luameshval@ap@colorbbox")% }% \else % we are using MP \mplibcolor{\luameshmpcolor}{\luameshval@api@color} @@ -421,7 +419,7 @@ \mplibcolor{\luameshmpcolorCircle}{\luameshval@api@colorcircle} \mplibcolor{\luameshmpcolorBbox}{\luameshval@api@colorbbox} \directlua{% - TeXOnePointMPBWinc("#2","#3","#4","#5","\luameshval@api@step","\luameshval@api@scale","\luameshval@api@mode","\luameshval@api@bbox")% + TeXOnePointMPBWinc("#2","#3","\luaescapestring{\unexpanded{#4}}","\luaescapestring{\unexpanded{#5}}","\luameshval@api@step","\luameshval@api@scale","\luameshval@api@mode","\luameshval@api@bbox")% }% % \fi% diff --git a/test/animation.pdf b/test/animation.pdf index a38a444..678c5c0 100644 Binary files a/test/animation.pdf and b/test/animation.pdf differ diff --git a/test/delaunay.pdf b/test/delaunay.pdf index 199be36..33fcbbe 100644 Binary files a/test/delaunay.pdf and b/test/delaunay.pdf differ diff --git a/test/delaunay.tex b/test/delaunay.tex index 5b98391..adb9525 100644 --- a/test/delaunay.tex +++ b/test/delaunay.tex @@ -7,15 +7,21 @@ \pagestyle{empty} \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} +\tracePointsMesh[mode=ext,bbox = show, color=red,print=points]{mesh.txt} + +\tracePointsMesh[mode=ext,bbox = show, color=red]{mesh.txt} + -\buildMeshBWinc[mode=ext,bbox = show, color=red,colorBbox = -blue]{mesh.txt}{% +\buildMeshBWinc[mode=ext,bbox = show, color=red,colorBbox = blue]{mesh.txt}{% beginfig(0); }% {% @@ -31,13 +37,13 @@ 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)} + 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, @@ -75,9 +81,62 @@ colorBbox = blue!20, beginfig(0); }% {% - draw (-1,-1)*u--(8.5,-1)*u--(8.5,6)*u--(-1,6)*u--cycle; + 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} + +\tracePointsMesh[tikz,mode=ext,bbox = show, +color=red,print=points]{mesh.txt} +\tracePointsMesh[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)} + \end{document}