\mplibcolor, nom de couleurs dans les fonctions, renommage de fonction (côté MP)...
authorMaxime Chupin (Ceremade) <chupin@ceremade.dauphine.fr>
Tue, 22 Nov 2016 13:09:16 +0000 (14:09 +0100)
committerMaxime Chupin (Ceremade) <chupin@ceremade.dauphine.fr>
Tue, 22 Nov 2016 13:09:16 +0000 (14:09 +0100)
luamesh.lua
luamesh.sty
test/animation-crop.pdf
test/animation.pdf
test/animation.tex
test/delaunay.pdf
test/delaunay.tex

index 0b3a385..28e61db 100644 (file)
@@ -303,7 +303,7 @@ end
 
 
 -- buildMesh with MP
-function buildMeshMP(chaine,mode,points,bbox,full,scale,color)
+function buildMeshMPBW(chaine,mode,points,bbox,full,scale,color)
    listPoints = buildList(chaine, mode)
    triangulation = BowyerWatson(listPoints,bbox)
    output = traceMeshMP(listPoints, triangulation,points,color)
@@ -449,7 +449,7 @@ function TeXaddOnePointTikZ(chaine,point,step,color,colorBack, colorNew, colorCi
    return output
 end
 
-function TeXaddOnePointMP(listPoints,P,step,color,colorBack, colorNew, colorCircle,bbox)
+function TeXaddOnePointMPBW(listPoints,P,step,bbox)
    output = "";
    output = output .. "pair MeshPoints[];"
    -- build the triangulation
@@ -464,15 +464,15 @@ function TeXaddOnePointMP(listPoints,P,step,color,colorBack, colorNew, colorCirc
          PointI = listPoints[triangulation[i][1]]
          PointJ = listPoints[triangulation[i][2]]
          PointK = listPoints[triangulation[i][3]]
-         output = output .. "draw (".. PointI.x ..",".. PointI.y ..")*u--("..PointJ.x..",".. PointJ.y ..")*u--("..PointK.x..",".. PointK.y ..")*u--cycle withcolor \\mpcolorcolor;"
+         output = output .. "draw (".. PointI.x ..",".. PointI.y ..")*u--("..PointJ.x..",".. PointJ.y ..")*u--("..PointK.x..",".. PointK.y ..")*u--cycle withcolor \\luameshmpcolor;"
       end
       -- draw and fill the bad triangle
       for i=1,#badTriangles do
          PointI = listPoints[triangulation[badTriangles[i]][1]]
          PointJ = listPoints[triangulation[badTriangles[i]][2]]
          PointK = listPoints[triangulation[badTriangles[i]][3]]
-         output = output .. "draw (".. PointI.x ..",".. PointI.y ..")*u--("..PointJ.x..",".. PointJ.y ..")*u--("..PointK.x..",".. PointK.y ..")*u--cycle withcolor \\mpcolorcolor;"
-         output = output .. "fill (".. PointI.x ..",".. PointI.y ..")*u--("..PointJ.x..",".. PointJ.y ..")*u--("..PointK.x..",".. PointK.y ..")*u--cycle withcolor \\mpcolorcolorBack;"
+         output = output .. "draw (".. PointI.x ..",".. PointI.y ..")*u--("..PointJ.x..",".. PointJ.y ..")*u--("..PointK.x..",".. PointK.y ..")*u--cycle withcolor \\luameshmpcolor;"
+         output = output .. "fill (".. PointI.x ..",".. PointI.y ..")*u--("..PointJ.x..",".. PointJ.y ..")*u--("..PointK.x..",".. PointK.y ..")*u--cycle withcolor \\luameshmpcolorBack;"
       end
       -- draw the circoncircle
       for i=1,#badTriangles do
@@ -480,14 +480,14 @@ function TeXaddOnePointMP(listPoints,P,step,color,colorBack, colorNew, colorCirc
          PointJ = listPoints[triangulation[badTriangles[i]][2]]
          PointK = listPoints[triangulation[badTriangles[i]][3]]
          center, radius = circoncircle(PointI, PointJ, PointK)
-         output = output .. "draw fullcircle scaled ("..radius .."*2u) shifted ("..center.x .. "*u," .. center.y .. "*u) dashed evenly withcolor \\mpcolorcolorCircle;"
+         output = output .. "draw fullcircle scaled ("..radius .."*2u) shifted ("..center.x .. "*u," .. center.y .. "*u) dashed evenly withcolor \\luameshmpcolorCircle;"
       end
       -- mark the points
       for i=1,#listPoints do
-         output = output .. "dotlabel.llft (btex $\\MeshPoint_{" .. i .. "}$ etex, (" .. listPoints[i].x ..",".. listPoints[i].y .. ")*u ) withcolor \\mpcolorcolor;"
+         output = output .. "dotlabel.llft (btex $\\MeshPoint_{" .. i .. "}$ etex, (" .. listPoints[i].x ..",".. listPoints[i].y .. ")*u ) withcolor \\luameshmpcolor;"
       end
       -- mark the point to add
-      output = output .. "dotlabel.llft (btex $\\NewPoint$ etex,(" .. P.x ..",".. P.y .. ")*u) withcolor \\mpcolorcolorNew;"
+      output = output .. "dotlabel.llft (btex $\\NewPoint$ etex,(" .. P.x ..",".. P.y .. ")*u) withcolor \\luameshmpcolorNew;"
    elseif(step == "cavity") then
       polygon = buildCavity(badTriangles, triangulation)
       polyNew = cleanPoly(polygon)
@@ -500,7 +500,7 @@ function TeXaddOnePointMP(listPoints,P,step,color,colorBack, colorNew, colorCirc
          PointI = listPoints[triangulation[i][1]]
          PointJ = listPoints[triangulation[i][2]]
          PointK = listPoints[triangulation[i][3]]
-         output = output .. "draw (".. PointI.x ..",".. PointI.y ..")*u--("..PointJ.x..",".. PointJ.y ..")*u--("..PointK.x..",".. PointK.y ..")*u--cycle withcolor \\mpcolorcolor;"
+         output = output .. "draw (".. PointI.x ..",".. PointI.y ..")*u--("..PointJ.x..",".. PointJ.y ..")*u--("..PointK.x..",".. PointK.y ..")*u--cycle withcolor \\luameshmpcolor;"
       end
       -- fill and draw the cavity
       path = ""
@@ -508,14 +508,14 @@ function TeXaddOnePointMP(listPoints,P,step,color,colorBack, colorNew, colorCirc
          PointI = listPoints[polyNew[i]]
          path = path .. "(".. PointI.x ..",".. PointI.y ..")*u--"
       end
-      output = output .. "fill " .. path .. "cycle withcolor \\mpcolorcolorBack;"
-      output = output .. "draw " .. path .. "cycle withcolor \\mpcolorcolorNew  withpen pencircle scaled 1pt;"
+      output = output .. "fill " .. path .. "cycle withcolor \\luameshmpcolorBack;"
+      output = output .. "draw " .. path .. "cycle withcolor \\luameshmpcolorNew  withpen pencircle scaled 1pt;"
       -- mark the points of the mesh
       for i=1,#listPoints do
-         output = output .. "dotlabel.llft (btex $\\MeshPoint_{" .. i .. "}$ etex, (" .. listPoints[i].x ..",".. listPoints[i].y .. ")*u ) withcolor \\mpcolorcolor ;"
+         output = output .. "dotlabel.llft (btex $\\MeshPoint_{" .. i .. "}$ etex, (" .. listPoints[i].x ..",".. listPoints[i].y .. ")*u ) withcolor \\luameshmpcolor ;"
       end
       -- mark the adding point
-      output = output .. "dotlabel.llft (btex $\\NewPoint$ etex,(" .. P.x ..",".. P.y .. ")*u) withcolor \\mpcolorcolorNew ;"
+      output = output .. "dotlabel.llft (btex $\\NewPoint$ etex,(" .. P.x ..",".. P.y .. ")*u) withcolor \\luameshmpcolorNew ;"
    elseif(step == "newT") then
       polygon = buildCavity(badTriangles, triangulation)
       polyNew = cleanPoly(polygon)
@@ -528,7 +528,7 @@ function TeXaddOnePointMP(listPoints,P,step,color,colorBack, colorNew, colorCirc
          PointI = listPoints[triangulation[i][1]]
          PointJ = listPoints[triangulation[i][2]]
          PointK = listPoints[triangulation[i][3]]
-         output = output .. "draw (".. PointI.x ..",".. PointI.y ..")*u--("..PointJ.x..",".. PointJ.y ..")*u--("..PointK.x..",".. PointK.y ..")*u--cycle withcolor \\mpcolorcolor ;"
+         output = output .. "draw (".. PointI.x ..",".. PointI.y ..")*u--("..PointJ.x..",".. PointJ.y ..")*u--("..PointK.x..",".. PointK.y ..")*u--cycle withcolor \\luameshmpcolor ;"
       end
       -- fill  the cavity
       path = ""
@@ -536,19 +536,19 @@ function TeXaddOnePointMP(listPoints,P,step,color,colorBack, colorNew, colorCirc
          PointI = listPoints[polyNew[i]]
          path = path .. "(".. PointI.x ..",".. PointI.y ..")*u--"
       end
-      output = output .. "fill " .. path .. "cycle withcolor \\mpcolorcolorBack;"
+      output = output .. "fill " .. path .. "cycle withcolor \\luameshmpcolorBack;"
       -- draw the new triangles composed by the edges of the polygon and the added point
       for i=1,#polygon do
-         output = output .. "draw".."(".. listPoints[polygon[i][1]].x .. "," .. listPoints[polygon[i][1]].y .. ")*u -- (" .. listPoints[polygon[i][2]].x .. "," .. listPoints[polygon[i][2]].y ..")*u withcolor \\mpcolorcolorNew  withpen pencircle scaled 1pt;"
-         output = output .. "draw".."(".. listPoints[polygon[i][1]].x .. "," .. listPoints[polygon[i][1]].y .. ")*u -- (" .. P.x .. "," .. P.y ..")*u withcolor \\mpcolorcolorNew withpen pencircle scaled 1pt;"
-         output = output .. "draw".."(".. listPoints[polygon[i][2]].x .. "," .. listPoints[polygon[i][2]].y .. ")*u -- (" .. P.x .. "," .. P.y ..")*u withcolor \\mpcolorcolorNew withpen pencircle scaled 1pt;"
+         output = output .. "draw".."(".. listPoints[polygon[i][1]].x .. "," .. listPoints[polygon[i][1]].y .. ")*u -- (" .. listPoints[polygon[i][2]].x .. "," .. listPoints[polygon[i][2]].y ..")*u withcolor \\luameshmpcolorNew  withpen pencircle scaled 1pt;"
+         output = output .. "draw".."(".. listPoints[polygon[i][1]].x .. "," .. listPoints[polygon[i][1]].y .. ")*u -- (" .. P.x .. "," .. P.y ..")*u withcolor \\luameshmpcolorNew withpen pencircle scaled 1pt;"
+         output = output .. "draw".."(".. listPoints[polygon[i][2]].x .. "," .. listPoints[polygon[i][2]].y .. ")*u -- (" .. P.x .. "," .. P.y ..")*u withcolor \\luameshmpcolorNew withpen pencircle scaled 1pt;"
       end
       -- mark points
       for i=1,#listPoints do
-         output = output .. "dotlabel.llft (btex $\\MeshPoint_{" .. i .. "}$ etex, (" .. listPoints[i].x ..",".. listPoints[i].y .. ")*u ) withcolor \\mpcolorcolor ;"
+         output = output .. "dotlabel.llft (btex $\\MeshPoint_{" .. i .. "}$ etex, (" .. listPoints[i].x ..",".. listPoints[i].y .. ")*u ) withcolor \\luameshmpcolor ;"
       end
       -- mark the added point
-      output = output .. "dotlabel.llft (btex $\\NewPoint$ etex,(" .. P.x ..",".. P.y .. ")*u) withcolor \\mpcolorcolorNew ;"
+      output = output .. "dotlabel.llft (btex $\\NewPoint$ etex,(" .. P.x ..",".. P.y .. ")*u) withcolor \\luameshmpcolorNew ;"
    end
    return output
 end
@@ -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,bbox)
+function TeXOnePointMPBW(chaine,point,step,scale,mode,picture,bbox)
    if(mode=="int") then
       Sx,Sy=string.match(point,"%((.+),(.+)%)")
       P = {x=Sx, y=Sy}
@@ -585,11 +585,21 @@ 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,bbox)
-   if(picture=="full") then
-      output = "\\leavevmode\\begin{mplibcode}beginfig(0);u:="..scale..";".. output .. "endfig;\\end{mplibcode}"
+   output = TeXaddOnePointMPBW(listPoints,P,step,bbox)
+   output = "\\leavevmode\\begin{mplibcode}beginfig(0);u:="..scale..";".. output .. "endfig;\\end{mplibcode}"
+   tex.sprint(output)
+end
+
+function TeXOnePointMPBWinc(chaine,point,beginning,ending,step,scale,mode,picture,bbox)
+   if(mode=="int") then
+      Sx,Sy=string.match(point,"%((.+),(.+)%)")
+      P = {x=Sx, y=Sy}
+      listPoints = buildList(chaine, mode)
    else
-      output = "u:="..scale..";".. output
+      -- point is a number
+      P, listPoints = buildListExt(chaine,tonumber(point))
    end
+   output = TeXaddOnePointMPBW(listPoints,P,step,bbox)
+   output = "\\begin{mplibcode}u:="..scale..";"..beginning .. output .. ending .. "\\end{mplibcode}"
    tex.sprint(output)
 end
index 2860881..9d394d9 100644 (file)
 % load the lua code
 \directlua{dofile("luamesh.lua")}%
 %
-% global def (default value)
-\newcommand{\MeshPoint}{P}
-\newcommand{\NewPoint}{P}
-% for MetaPost (MP) (default value)
-% default scale u:=1cm;
-\newcommand\luaMeshScaleMP{1cm}
-% default color for the plot of a global mesh
-\newcommand\TeXCluaMeshMP{(0.,0.,0.)}
-% default color for a new element
-\newcommand\TeXCluaMeshNewMP{(0.5,0.1,0.1)}
-% defaut color for the background of new element
-\newcommand\TeXCluaMeshBackMP{(0.99,0.85,0.85)}
-% default color for circoncircle
-\newcommand\TeXCluaMeshCircleMP{(0.1,0.6,0.1)}
 %%
 % for tikz (default value)
 % default color for the plot of a global mesh
@@ -97,8 +83,8 @@
 \presetkeys{buildMesh}{tikz=false,bbox=none,scale, meshpoint,mode=int,print=none,picture=full,color}{}%
 %
 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-% the difinition
-\newcommand{\buildMesh}[2][]{%
+% the difinition BW Bowyer and Watson algo
+\newcommand{\buildMeshBW}[2][]{%
   % #1 : the string containing the list of points
   % (x1,y1);(x2,y2);... or the name file containing the points
   \setkeys{buildMesh}{#1} %
   }%
   \else % we are using MP
   \directlua{%
-    buildMeshMP("#2","\luameshval@mode","\luameshval@print","\luameshval@bbox","full","\luameshval@scale","\luameshval@color")%
+    buildMeshMPBW("#2","\luameshval@mode","\luameshval@print","\luameshval@bbox","full","\luameshval@scale","\luameshval@color")%
   }%
   %
   \fi%
 %
 %%
 %
-%%the meshAddOnePoint commande
+%%the meshAddOnePointBW commande
 %%engine of drawing
 \newif\ifluameshengineMP%
 \define@boolkey{MeshAddOne}{tikz}[true]{}%
 %% the name of the new point
 \define@key{MeshAddOne}{newpoint}[P]{\def\luameshval@newpoint{#1}}%
 %% a complete picture or some code of the engine
-\define@choicekey*{MeshAddOne}{picture}[\val\nr]{full, simple}{%
-  \ifcase\nr\relax%
-  \def\luameshval@picture{full}%
-  \or%
-  \def\luameshval@picture{simple}%
-  \fi%
-}%
-%% a complete picture or some code of the engine
 \define@choicekey*{MeshAddOne}{step}[\val\nr]{badtriangles, cavity, newtriangles}{%
   \ifcase\nr\relax%
   \def\luameshval@step{badT}%
   \def\luameshval@mode{ext}%
   \fi%
 }%
+\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,bbox=none}{}%
+%
+% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% the difinition BW Bowyer and Watson algo
+\newcommand*{\meshAddPointBW}[3][]{%
+  % #1 : the string containing the list of points
+  % (x1,y1);(x2,y2);... or the name file containing the points
+  \setkeys{MeshAddOne}{#1} %
+  \def\MeshPoint{\luameshval@meshpoint}%
+  \def\NewPoint{\luameshval@newpoint}%
+  \ifKV@MeshAddOne@tikz% if we are using tikz
+  \directlua{%
+    buildMeshTikZ("#2","\luameshval@mode","\luameshval@print","\luameshval@bbox","full","\luameshval@scale","\luameshval@color")%
+  }%
+  \else % we are using MP
+  \mplibcolor{\luameshmpcolor}{\luameshval@color}
+  \mplibcolor{\luameshmpcolorBack}{\luameshval@colorback}
+  \mplibcolor{\luameshmpcolorNew}{\luameshval@colornew}
+  \mplibcolor{\luameshmpcolorCircle}{\luameshval@colorcircle}
+  \directlua{%
+    TeXOnePointMPBW("#2","#3","\luameshval@step","\luameshval@scale","\luameshval@mode","\luameshval@bbox")%
+  }%
+  %
+  \fi%
+}%
+%%% the meshAddPointBWinc commande
+%% engine of drawing
+\newif\ifluameshengineMP%
+\define@boolkey{MeshAddOneBWinc}{tikz}[true]{}%
+%% the scale
+\define@key{MeshAddOneBWinc}{scale}[1cm]{\def\luameshval@scale{#1}}%
+%% the name of the points
+\define@key{MeshAddOneBWinc}{meshpoint}[P]{\def\luameshval@meshpoint{#1}}%
+%% the name of the new point
+\define@key{MeshAddOneBWinc}{newpoint}[P]{\def\luameshval@newpoint{#1}}%
 %% a complete picture or some code of the engine
-\define@choicekey*{MeshAddOne}{picture}[\val\nr]{full, embedded}{%
+\define@choicekey*{MeshAddOneBWinc}{step}[\val\nr]{badtriangles, cavity, newtriangles}{%
   \ifcase\nr\relax%
-  \def\luameshval@picture{full}%
+  \def\luameshval@step{badT}%
   \or%
-  \def\luameshval@picture{embedded}%
+  \def\luameshval@step{cavity}%
+  \or%
+  \def\luameshval@step{newT}%
   \fi%
 }%
-\define@choicekey*{MeshAddOne}{bbox}[\val\nr]{none, show}{%
+% color
+%% the color of drawing
+\define@key{MeshAddOneBWinc}{color}[black]{\def\luameshval@color{#1}}%
+%% the color of background of new element
+\define@key{MeshAddOneBWinc}{colorBack}[black!20]{\def\luameshval@colorback{#1}}%
+%% the color of new element
+\define@key{MeshAddOneBWinc}{colorNew}[red]{\def\luameshval@colornew{#1}}%
+%% the color of circoncircle
+\define@key{MeshAddOneBWinc}{colorCircle}[green]{\def\luameshval@colorcircle{#1}}%
+%
+%% a complete picture or some code of the engine
+\define@choicekey*{MeshAddOneBWinc}{mode}[\val\nr]{int, ext}{%
+  \ifcase\nr\relax%
+  \def\luameshval@mode{int}%
+  \or%
+  \def\luameshval@mode{ext}%
+  \fi%
+}%
+\define@choicekey*{MeshAddOneBWinc}{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}{}%
+\presetkeys{MeshAddOneBWinc}{tikz=false,scale, meshpoint,newpoint,color,colorBack,colorNew,colorCircle,step=badtriangles,mode=int,bbox=none}{}%
 %
 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-% the difinition
-\newcommand{\meshAddOnePoint}[3][]{%
+% the difinition BW embedded code between the 2 last arguments
+\newcommand*{\meshAddPointBWinc}[5][]{%
   % #1 : the string containing the list of points
   % (x1,y1);(x2,y2);... or the name file containing the points
-  \setkeys{MeshAddOne}{#1} %
+  \setkeys{MeshAddOneBWinc}{#1} %
   \def\MeshPoint{\luameshval@meshpoint}%
   \def\NewPoint{\luameshval@newpoint}%
   \ifKV@MeshAddOne@tikz% if we are using tikz
     buildMeshTikZ("#2","\luameshval@mode","\luameshval@print","\luameshval@bbox","full","\luameshval@scale","\luameshval@color")%
   }%
   \else % we are using MP
-  \mplibcolor{\mpcolorcolor}{\luameshval@color}
-  \mplibcolor{\mpcolorcolorBack}{\luameshval@colorback}
-  \mplibcolor{\mpcolorcolorNew}{\luameshval@colornew}
-  \mplibcolor{\mpcolorcolorCircle}{\luameshval@colorcircle}
+  \mplibcolor{\luameshmpcolor}{\luameshval@color}
+  \mplibcolor{\luameshmpcolorBack}{\luameshval@colorback}
+  \mplibcolor{\luameshmpcolorNew}{\luameshval@colornew}
+  \mplibcolor{\luameshmpcolorCircle}{\luameshval@colorcircle}
   \directlua{%
-    TeXOnePointMP("#2","#3","\luameshval@step","\luameshval@color","\luameshval@colorback","\luameshval@colornew","\luameshval@colorcircle","\luameshval@scale","\luameshval@mode","\luameshval@picture","\luameshval@bbox")%
+    TeXOnePointMPBWinc("#2","#3","#4","#5","\luameshval@step","\luameshval@scale","\luameshval@mode","\luameshval@bbox")%
   }%
   %
   \fi%
index 49419f3..2a23b30 100644 (file)
Binary files a/test/animation-crop.pdf and b/test/animation-crop.pdf differ
index ef311ee..0af8e2d 100644 (file)
Binary files a/test/animation.pdf and b/test/animation.pdf differ
index bad690b..b3d33a7 100644 (file)
 
 \multido{\ii=5+1}{3}{%
   \newpage
-  \meshAddOnePoint[mode=ext,step=badtriangles,
+  \meshAddPointBWinc[
+  mode=ext,step=badtriangles,
   colorNew =green!20!red,
   colorBack=red!10,
   colorCircle = blue,
-  ]{mesh.txt}{\ii}
-  \newpage
-  \meshAddOnePoint[mode=ext,step=cavity,
+  ]
+  {mesh.txt}{\ii}%
+  {%
+    beginfig(0);
+  }%
+  {%
+    draw (-1,-1)*u--(7.5,-1)*u--(7.5,5)*u--(-1,5)*u--cycle withcolor 0.99white;
+    clip currentpicture to (-1,-1)*u--(7.5,-1)*u--(7.5,5)*u--(-1,5)*u--cycle;
+    endfig;
+  }  \newpage
+  \meshAddPointBWinc[
+  mode=ext,step=cavity,
   colorNew =green!20!red,
   colorBack=red!10,
   colorCircle = blue,
-  ]{mesh.txt}{\ii}
-  \newpage
-  \meshAddOnePoint[mode=ext,step=newtriangles,
+  ]
+  {mesh.txt}{\ii}%
+  {%
+    beginfig(0);
+  }%
+  {%
+    draw (-1,-1)*u--(7.5,-1)*u--(7.5,5)*u--(-1,5)*u--cycle withcolor 0.99white;
+    clip currentpicture to (-1,-1)*u--(7.5,-1)*u--(7.5,5)*u--(-1,5)*u--cycle;
+    endfig;
+  }  \newpage
+  \meshAddPointBWinc[
+  mode=ext,step=newtriangles,
   colorNew =green!20!red,
   colorBack=red!10,
   colorCircle = blue,
-  ]{mesh.txt}{\ii}
+  ]
+  {mesh.txt}{\ii}%
+  {%
+    beginfig(0);
+  }%
+  {%
+    draw (-1,-1)*u--(7.5,-1)*u--(7.5,5)*u--(-1,5)*u--cycle withcolor 0.99white;
+    clip currentpicture to (-1,-1)*u--(7.5,-1)*u--(7.5,5)*u--(-1,5)*u--cycle;
+    endfig;
+  }
 }
 
-\newpage
-
-\buildMesh[mode=ext,print=points]{mesh.txt}
 
 
 \end{document}
index d4ff7ab..acecd55 100644 (file)
Binary files a/test/delaunay.pdf and b/test/delaunay.pdf differ
index b7a5011..ac45fa4 100644 (file)
@@ -7,27 +7,27 @@
 \pagestyle{empty}
 \begin{document}
 
-% \buildMesh[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)}
-
-% \buildMesh[tikz, bbox = show]{(0,0);(3.5,3);(7,0);(7.5,5);(1.61,3.14);(3,1);(6,1.5)}
-
-% \buildMesh[mode=ext]{mesh.txt}
-
-% \meshAddOnePoint[
-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)}
-% \meshAddOnePoint[
-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)}
-\meshAddOnePoint[
+\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]{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[
+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,
@@ -49,5 +49,22 @@ bbox = show
   endfig;
 \end{mplibcode}
 
+\meshAddPointBWinc[
+meshpoint = x,
+colorBack=red!10,
+colorNew = green!20!red,
+scale=0.6cm,
+step=badtriangles,
+newpoint = y,
+bbox = show
+]
+{(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;
+endfig;
+}
+
 
 \end{document}

Licence Creative Commons Les fichiers de Syracuse sont mis à disposition (sauf mention contraire) selon les termes de la
Licence Creative Commons Attribution - Pas d’Utilisation Commerciale - Partage dans les Mêmes Conditions 4.0 International.