From: Maxime Chupin (escudo) Date: Mon, 21 Nov 2016 18:14:25 +0000 (+0100) Subject: Ajout de l'option bbox pour la macro \meshAddOnePoint X-Git-Url: https://melusine.eu.org/syracuse/G/git/?a=commitdiff_plain;h=8dac495f9a49c66620e9e105e9cc16b5243dd8f7;p=delaunay.git Ajout de l'option bbox pour la macro \meshAddOnePoint --- diff --git a/luamesh.lua b/luamesh.lua index 9b761e2..945d9cc 100644 --- a/luamesh.lua +++ b/luamesh.lua @@ -449,11 +449,11 @@ function TeXaddOnePointTikZ(chaine,point,step,color,colorBack, colorNew, colorCi return output end -function TeXaddOnePointMP(listPoints,P,step,color,colorBack, colorNew, colorCircle) +function TeXaddOnePointMP(listPoints,P,step,color,colorBack, colorNew, colorCircle,bbox) output = ""; output = output .. "pair MeshPoints[];" -- build the triangulation - triangulation = BowyerWatson(listPoints,"none") + triangulation = BowyerWatson(listPoints,bbox) badTriangles = buildBadTriangles(P,triangulation) for i=1,#listPoints do output = output .. "MeshPoints[".. i .. "] = (" .. listPoints[i].x .. "," .. listPoints[i].y .. ");" @@ -576,7 +576,7 @@ function TeXOnePointTikZ(chaine,point,step,color,colorBack,colorNew,colorCircle, tex.sprint(output) end -function TeXOnePointMP(chaine,point,step,color,colorBack,colorNew,colorCircle,scale,mode,picture) +function TeXOnePointMP(chaine,point,step,color,colorBack,colorNew,colorCircle,scale,mode,picture,bbox) if(mode=="int") then Sx,Sy=string.match(point,"%((.+),(.+)%)") P = {x=Sx, y=Sy} @@ -585,7 +585,7 @@ function TeXOnePointMP(chaine,point,step,color,colorBack,colorNew,colorCircle,sc -- point is a number P, listPoints = buildListExt(chaine,tonumber(point)) end - output = TeXaddOnePointMP(listPoints,P,step,color,colorBack,colorNew,colorCircle) + output = TeXaddOnePointMP(listPoints,P,step,color,colorBack,colorNew,colorCircle,bbox) if(picture=="full") then output = "\\leavevmode\\begin{mplibcode}beginfig(0);u:="..scale..";".. output .. "endfig;\\end{mplibcode}" else diff --git a/luamesh.sty b/luamesh.sty index 9b326e5..af422c3 100644 --- a/luamesh.sty +++ b/luamesh.sty @@ -171,7 +171,14 @@ \def\luameshval@picture{embedded}% \fi% }% -\presetkeys{MeshAddOne}{tikz=false,scale, meshpoint,newpoint,color,colorBack,colorNew,colorCircle,step=badtriangles,mode=int,picture=full}{}% +\define@choicekey*{MeshAddOne}{bbox}[\val\nr]{none, show}{% + \ifcase\nr\relax% + \def\luameshval@bbox{none}% + \or% + \def\luameshval@bbox{bbox}% + \fi% +}% +\presetkeys{MeshAddOne}{tikz=false,scale, meshpoint,newpoint,color,colorBack,colorNew,colorCircle,step=badtriangles,mode=int,picture=full,bbox=none}{}% % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % the difinition @@ -187,7 +194,7 @@ }% \else % we are using MP \directlua{% - TeXOnePointMP("#2","#3","\luameshval@step","\luameshval@color","\luameshval@colorback","\luameshval@colornew","\luameshval@colorcircle","\luameshval@scale","\luameshval@mode","\luameshval@picture")% + TeXOnePointMP("#2","#3","\luameshval@step","\luameshval@color","\luameshval@colorback","\luameshval@colornew","\luameshval@colorcircle","\luameshval@scale","\luameshval@mode","\luameshval@picture","\luameshval@bbox")% }% % \fi% diff --git a/test/delaunay.pdf b/test/delaunay.pdf index 3c5278d..24df700 100644 Binary files a/test/delaunay.pdf and b/test/delaunay.pdf differ diff --git a/test/delaunay.tex b/test/delaunay.tex index dae9c63..2f03f2c 100644 --- a/test/delaunay.tex +++ b/test/delaunay.tex @@ -33,7 +33,8 @@ colorBack=red!10, colorNew = green!20!red, scale=0.6cm, step=newtriangles, -newpoint = y +newpoint = y, +bbox = show ] {(0,0);(3.5,3);(7,0);(7.5,5);(1.61,3.14);(6,4)}{(3,1)}