X-Git-Url: https://melusine.eu.org/syracuse/G/git/?p=delaunay.git;a=blobdiff_plain;f=luamesh.sty;h=c0a1789a0adaeb51ca2bcb3c614805f5e24e1b72;hp=80c0c0f7b4b0874fb1f9a3a2df8804bb08de4516;hb=bc8f9054348ecf3c840ad5f32b56f5855cb4015d;hpb=69d738f58952eaf2e69da5817f9c7ab8c81a68c1 diff --git a/luamesh.sty b/luamesh.sty index 80c0c0f..c0a1789 100644 --- a/luamesh.sty +++ b/luamesh.sty @@ -1,7 +1,7 @@ \NeedsTeXFormat{LaTeX2e}% \def\PackageName{luamesh}% -\def\fileversion{v0.2}% -\def\filedate{2016/11/29}% +\def\fileversion{v0.5}% +\def\filedate{2017/02/09}% \ProvidesPackage{luamesh}[\filedate\space\fileversion]% % % package to load @@ -896,3 +896,73 @@ % \fi% }% +%%%%%%%%%%%%%%%% the meshPolygonInc command +%% +\define@boolkey{meshPolygonInc}{tikz}[true]{}% + +%% the scale +\define@key{meshPolygonInc}{scale}[1cm]{\def\luameshval@mpi@scale{#1}}% +%% print points +\define@choicekey*{meshPolygonInc}{print}[\val\nr]{none, points,dotpoints}{% + \ifcase\nr\relax% + \def\luameshval@mpi@print{none}% + \or% + \def\luameshval@mpi@print{points}% + \or% + \def\luameshval@mpi@print{dotpoints}% + \fi% +}% +%% the name of the point +\define@key{meshPolygonInc}{meshpoint}[P]{\def\luameshval@mpi@meshpoint{#1}}% +%% the grid parameter +\define@key{meshPolygonInc}{h}[0.2]{\def\luameshval@mpi@h{#1}}% +%% the mode for reading the points +\define@choicekey*{meshPolygonInc}{mode}[\val\nr]{int, ext}{% + \ifcase\nr\relax% + \def\luameshval@mpi@mode{int}% + \or% + \def\luameshval@mpi@mode{ext}% + \fi% +}% +%% the different steps of the meshing +\define@choicekey*{meshPolygonInc}{step}[\val\nr]{polygon, grid, points, mesh}{% + \ifcase\nr\relax% + \def\luameshval@mpi@step{polygon}% + \or% + \def\luameshval@mpi@step{grid}% + \or% + \def\luameshval@mpi@step{points}% + \or% + \def\luameshval@mpi@step{mesh}% + \fi% +}% + +%% the name of the color of drawing +\define@key{meshPolygonInc}{color}[black]{\def\luameshval@mpi@color{#1}}% +%% the name of the color of drawing Voronoi +\define@key{meshPolygonInc}{colorPolygon}[red]{\def\luameshval@mpi@colorPolygon{#1}}% +%% the name of the color of drawing the bbox +% +\presetkeys{meshPolygonInc}{tikz=false,scale,mode=int,step=mesh,print=none,color,colorPolygon,h,meshpoint}{}% +% +\newcommand{\meshPolygonInc}[4][]{% + % #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{meshPolygonInc}{#1} % + \def\MeshPoint{\luameshval@mpi@meshpoint}% + \ifKV@meshPolygonInc@tikz% if we are using tikz + \directlua{% + drawMeshPolygonTikZinc("#2","\luaescapestring{\unexpanded{#3}}","\luaescapestring{\unexpanded{#4}}","\luameshval@mpi@mode","\luameshval@mpi@h","\luameshval@mpi@step","\luameshval@mpi@print","\luameshval@mpi@scale","\luameshval@mpi@color","\luameshval@mpi@colorPolygon")% + }% + \else % we are using MP + \mplibcolor{\luameshmpcolor}{\luameshval@mpi@color}% + \mplibcolor{\luameshmpcolorPoly}{\luameshval@mpi@colorPolygon}% + \directlua{% + drawMeshPolygonMPinc("#2","\luaescapestring{\unexpanded{#3}}","\luaescapestring{\unexpanded{#4}}","\luameshval@mpi@mode","\luameshval@mpi@h","\luameshval@mpi@step","\luameshval@mpi@print","\luameshval@mpi@scale")% + }% + % + \fi% +}%