From: Maxime Chupin (Ceremade) Date: Mon, 21 Nov 2016 15:49:37 +0000 (+0100) Subject: Début de la fonctionnalité picture=embedded, NON FONCTIONNELLE X-Git-Url: https://melusine.eu.org/syracuse/G/git/?a=commitdiff_plain;h=cc95d9b8f7a859cf2f69b419e15bd1a8a2777289;p=delaunay.git Début de la fonctionnalité picture=embedded, NON FONCTIONNELLE --- diff --git a/index.md b/index.md index 3bcaf2e..c496986 100644 --- a/index.md +++ b/index.md @@ -7,7 +7,7 @@ * Reader for gmesh `msh` file to plot meshes produced by this software. * Implement the picture mode `embedded` to allow the generated code - (`mplibcode` or `tikz` code) to be include in a `mplibcode` or + (`mplibcode` or `tikz`) to be included in a `mplibcode` or `tikzpicture` environment (for now, the produced code contains the environment declarations). * Macro to generate a meshed rectangle. diff --git a/luamesh.lua b/luamesh.lua index f165fe6..9b761e2 100644 --- a/luamesh.lua +++ b/luamesh.lua @@ -570,13 +570,13 @@ function buildListExt(chaine, stop) end -function TeXFullOnePointTikZ(chaine,point,step,color,colorBack,colorNew,colorCircle,scale) +function TeXOnePointTikZ(chaine,point,step,color,colorBack,colorNew,colorCircle,scale) output = TeXaddOnePointTikZ(chaine,point,step,color,colorBack,colorNew,colorCircle) output = "\\noindent\\begin{tikzpicture}[x="..scale..",y="..scale.."]".. output .. "\\end{tikzpicture}" tex.sprint(output) end -function TeXFullOnePointMP(chaine,point,step,color,colorBack,colorNew,colorCircle,scale,mode) +function TeXOnePointMP(chaine,point,step,color,colorBack,colorNew,colorCircle,scale,mode,picture) if(mode=="int") then Sx,Sy=string.match(point,"%((.+),(.+)%)") P = {x=Sx, y=Sy} @@ -586,6 +586,10 @@ function TeXFullOnePointMP(chaine,point,step,color,colorBack,colorNew,colorCircl P, listPoints = buildListExt(chaine,tonumber(point)) end output = TeXaddOnePointMP(listPoints,P,step,color,colorBack,colorNew,colorCircle) - output = "\\leavevmode\\begin{mplibcode}beginfig(0);u:="..scale..";".. output .. "endfig;\\end{mplibcode}" + if(picture=="full") then + output = "\\leavevmode\\begin{mplibcode}beginfig(0);u:="..scale..";".. output .. "endfig;\\end{mplibcode}" + else + output = "u:="..scale..";".. output + end tex.sprint(output) end diff --git a/luamesh.sty b/luamesh.sty index 9cc0b68..9b326e5 100644 --- a/luamesh.sty +++ b/luamesh.sty @@ -83,11 +83,11 @@ }% % %% a complete picture or some code of the engine -\define@choicekey*{buildMesh}{picture}[\val\nr]{full, simple}{% +\define@choicekey*{buildMesh}{picture}[\val\nr]{full, embedded}{% \ifcase\nr\relax% \def\luameshval@picture{full}% \or% - \def\luameshval@picture{simple}% + \def\luameshval@picture{embedded}% \fi% }% %color @@ -163,7 +163,15 @@ \def\luameshval@mode{ext}% \fi% }% -\presetkeys{MeshAddOne}{tikz=false,scale, meshpoint,newpoint,color,colorBack,colorNew,colorCircle,step=badtriangles,mode=int}{}% +%% a complete picture or some code of the engine +\define@choicekey*{MeshAddOne}{picture}[\val\nr]{full, embedded}{% + \ifcase\nr\relax% + \def\luameshval@picture{full}% + \or% + \def\luameshval@picture{embedded}% + \fi% +}% +\presetkeys{MeshAddOne}{tikz=false,scale, meshpoint,newpoint,color,colorBack,colorNew,colorCircle,step=badtriangles,mode=int,picture=full}{}% % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % the difinition @@ -179,7 +187,7 @@ }% \else % we are using MP \directlua{% - TeXFullOnePointMP("#2","#3","\luameshval@step","\luameshval@color","\luameshval@colorback","\luameshval@colornew","\luameshval@colorcircle","\luameshval@scale","\luameshval@mode")% + TeXOnePointMP("#2","#3","\luameshval@step","\luameshval@color","\luameshval@colorback","\luameshval@colornew","\luameshval@colorcircle","\luameshval@scale","\luameshval@mode","\luameshval@picture")% }% % \fi% diff --git a/test/animation.pdf b/test/animation.pdf index 25621ed..ef311ee 100644 Binary files a/test/animation.pdf and b/test/animation.pdf differ diff --git a/test/delaunay.pdf b/test/delaunay.pdf index b1232ee..3c5278d 100644 Binary files a/test/delaunay.pdf and b/test/delaunay.pdf differ diff --git a/test/delaunay.tex b/test/delaunay.tex index a969a44..dae9c63 100644 --- a/test/delaunay.tex +++ b/test/delaunay.tex @@ -38,7 +38,15 @@ newpoint = y {(0,0);(3.5,3);(7,0);(7.5,5);(1.61,3.14);(6,4)}{(3,1)} - +% \newcommand\mpred{\mpcolor{red}} +% \newcommand\test{dotlabel(btex $x$ etex, (0,0));draw (0,0)--(2cm,0) withcolor red;} + +% \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} \end{document}