X-Git-Url: https://melusine.eu.org/syracuse/G/git/?p=delaunay.git;a=blobdiff_plain;f=luamesh.sty;h=86f66edf1fca4e3f1b369502482c7e953b7e1127;hp=9d7c06bcc7c7985372b9150eccb251a06584cddf;hb=HEAD;hpb=e6cdb2e004ddba7c63705df4835de516ce0f297c diff --git a/luamesh.sty b/luamesh.sty index 9d7c06b..86f66ed 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.51}% +\def\filedate{2017/04/15}% \ProvidesPackage{luamesh}[\filedate\space\fileversion]% % % package to load @@ -50,11 +50,13 @@ %% the scale \define@key{buildMeshInc}{scale}[1cm]{\def\luameshval@bmi@scale{#1}}% %% print ponits ? -\define@choicekey*{buildMeshInc}{print}[\val\nr]{none, points}{% +\define@choicekey*{buildMeshInc}{print}[\val\nr]{none, points,dotpoints}{% \ifcase\nr\relax% \def\luameshval@bmi@print{none}% \or% \def\luameshval@bmi@print{points}% + \or% + \def\luameshval@bmi@print{dotpoints}% \fi% }% %% the name of the point @@ -110,11 +112,13 @@ %% the scale \define@key{buildMesh}{scale}[1cm]{\def\luameshval@bm@scale{#1}}% %% print points -\define@choicekey*{buildMesh}{print}[\val\nr]{none, points}{% +\define@choicekey*{buildMesh}{print}[\val\nr]{none, points, dotpoints}{% \ifcase\nr\relax% \def\luameshval@bm@print{none}% \or% \def\luameshval@bm@print{points}% + \or% + \def\luameshval@bm@print{dotpoints}% \fi% }% %% the name of the point @@ -821,3 +825,160 @@ % \fi% }% +% +% +% +%%%%%%%%%%%%%%%% the meshPolygon command +%% +\define@boolkey{meshPolygon}{tikz}[true]{}% + +%% the scale +\define@key{meshPolygon}{scale}[1cm]{\def\luameshval@mp@scale{#1}}% +%% print points +\define@choicekey*{meshPolygon}{print}[\val\nr]{none, points,dotpoints}{% + \ifcase\nr\relax% + \def\luameshval@mp@print{none}% + \or% + \def\luameshval@mp@print{points}% + \or% + \def\luameshval@mp@print{dotpoints}% + \fi% +}% +%% the name of the point +\define@key{meshPolygon}{meshpoint}[P]{\def\luameshval@mp@meshpoint{#1}}% +%% the grid parameter +\define@key{meshPolygon}{h}[0.2]{\def\luameshval@mp@h{#1}}% +%% the mode for reading the points +\define@choicekey*{meshPolygon}{mode}[\val\nr]{int, ext}{% + \ifcase\nr\relax% + \def\luameshval@mp@mode{int}% + \or% + \def\luameshval@mp@mode{ext}% + \fi% +}% +%% the mode for the generation of gridpoints +\define@choicekey*{meshPolygon}{gridpoints}[\val\nr]{rect, perturb}{% + \ifcase\nr\relax% + \def\luameshval@mp@gridpoints{rect}% + \or% + \def\luameshval@mp@gridpoints{perturb}% + \fi% +}% +%% the different steps of the meshing +\define@choicekey*{meshPolygon}{step}[\val\nr]{polygon, grid, points, mesh}{% + \ifcase\nr\relax% + \def\luameshval@mp@step{polygon}% + \or% + \def\luameshval@mp@step{grid}% + \or% + \def\luameshval@mp@step{points}% + \or% + \def\luameshval@mp@step{mesh}% + \fi% +}% + +%% the name of the color of drawing +\define@key{meshPolygon}{color}[black]{\def\luameshval@mp@color{#1}}% +%% the name of the color of drawing Voronoi +\define@key{meshPolygon}{colorPolygon}[red]{\def\luameshval@mp@colorPolygon{#1}}% +%% the name of the color of drawing the bbox +% +\presetkeys{meshPolygon}{tikz=false,scale,mode=int,step=mesh,print=none,color,colorPolygon,h,meshpoint,gridpoints=rect}{}% +% +\newcommand{\meshPolygon}[2][]{% + % #1 : optionnal arguments + % #2 : the string containing the list of points + % (x1,y1);(x2,y2);... or the name file containing the points + \setkeys{meshPolygon}{#1} % + \def\MeshPoint{\luameshval@mp@meshpoint}% + \ifKV@meshPolygon@tikz% if we are using tikz + \directlua{% + drawMeshPolygonTikZ("#2","\luameshval@mp@mode","\luameshval@mp@h","\luameshval@mp@step","\luameshval@mp@print","\luameshval@mp@scale","\luameshval@mp@color","\luameshval@mp@colorPolygon","\luameshval@mp@gridpoints")% + }% + \else % we are using MP + \mplibcolor{\luameshmpcolor}{\luameshval@mp@color}% + \mplibcolor{\luameshmpcolorPoly}{\luameshval@mp@colorPolygon}% + \directlua{% + drawMeshPolygonMP("#2","\luameshval@mp@mode","\luameshval@mp@h","\luameshval@mp@step","\luameshval@mp@print","\luameshval@mp@scale","\luameshval@mp@gridpoints")% + }% + % + \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 mode for the generation of gridpoints +\define@choicekey*{meshPolygonInc}{gridpoints}[\val\nr]{rect, perturb}{% + \ifcase\nr\relax% + \def\luameshval@mpi@gridpoints{rect}% + \or% + \def\luameshval@mpi@gridpoints{perturb}% + \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,gridpoints=rect}{}% +% +\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","\luameshval@mpi@gridpoints")% + }% + \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","\luameshval@mpi@gridpoints")% + }% + % + \fi% +}%