fonction meshPolygon pour MetaPost faite, ajout de dotpoints pour drawMesh (toujours...
[delaunay.git] / luamesh.sty
index 9d7c06b..363d085 100644 (file)
 %% 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
 %% 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
   %
   \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 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}{}%
+%
+\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{%
+    drawMeshPolygonTikZBW("#2","\luameshval@mp@mode","\luameshval@mp@print","\luameshval@mp@bbox","\luameshval@mp@scale","\luameshval@mp@delaunay","\luameshval@mp@color","\luameshval@mp@colorbbox","\luameshval@mp@colorVoronoi","\luameshval@mp@styleDelaunay","\luameshval@mp@styleVoronoi")%
+  }%
+  \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")%
+  }%
+  %
+  \fi%
+}%

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.