| 1 |
\NeedsTeXFormat{LaTeX2e}% |
| 2 |
\def\PackageName{luamesh}% |
| 3 |
\def\fileversion{v0.7}% |
| 4 |
\def\filedate{2022/07/08}% |
| 5 |
\ProvidesPackage{luamesh}[\filedate\space\fileversion]% |
| 6 |
% |
| 7 |
% package to load |
| 8 |
\RequirePackage{xkeyval,xcolor,ifthen}% |
| 9 |
\RequirePackage{luamplib}% |
| 10 |
\RequirePackage{tikz}% |
| 11 |
|
| 12 |
% |
| 13 |
% load the lua code |
| 14 |
\directlua{require("luamesh.lua")}% |
| 15 |
% load metapost lib |
| 16 |
\everymplib[luamesh]{input luamesh;} |
| 17 |
% |
| 18 |
%% |
| 19 |
% for tikz (default value) |
| 20 |
% default color for the plot of a global mesh |
| 21 |
\definecolor{TeXCluaMeshTikZ}{rgb}{0.,0.,0.} |
| 22 |
% default color for a new element |
| 23 |
\definecolor{TeXCluaMeshNewTikZ}{rgb}{0.5,0.1,0.1} |
| 24 |
% defaut color for the background of new element |
| 25 |
\definecolor{TeXCluaMeshBackTikZ}{rgb}{0.99,0.85,0.85} |
| 26 |
% default color for circoncircle |
| 27 |
\definecolor{TeXCluaMeshCircleTikZ}{rgb}{0.1,0.6,0.1} |
| 28 |
%% |
| 29 |
% |
| 30 |
%%%%%%%%%%%%%%%% the buildMesh command inc |
| 31 |
%% the user can write code (tikz or MP) |
| 32 |
%% before and after the generated code |
| 33 |
\define@boolkey{buildMeshInc}{tikz}[true]{}% |
| 34 |
%% show the bounding box for delaunay |
| 35 |
\define@choicekey*{buildMeshInc}{bbox}[\val\nr]{none, show}{% |
| 36 |
\ifcase\nr\relax% |
| 37 |
\def\luameshval@bmi@bbox{none}% |
| 38 |
\or% |
| 39 |
\def\luameshval@bmi@bbox{bbox}% |
| 40 |
\fi% |
| 41 |
}% |
| 42 |
%% the scale |
| 43 |
\define@key{buildMeshInc}{scale}[1cm]{\def\luameshval@bmi@scale{#1}}% |
| 44 |
%% print ponits ? |
| 45 |
\define@choicekey*{buildMeshInc}{print}[\val\nr]{none, points,dotpoints}{% |
| 46 |
\ifcase\nr\relax% |
| 47 |
\def\luameshval@bmi@print{none}% |
| 48 |
\or% |
| 49 |
\def\luameshval@bmi@print{points}% |
| 50 |
\or% |
| 51 |
\def\luameshval@bmi@print{dotpoints}% |
| 52 |
\fi% |
| 53 |
}% |
| 54 |
%% the name of the point |
| 55 |
\define@key{buildMeshInc}{meshpoint}[P]{\def\luameshval@bmi@meshpoint{#1}}% |
| 56 |
%% the mode for reading the points |
| 57 |
\define@choicekey*{buildMeshInc}{mode}[\val\nr]{int, ext}{% |
| 58 |
\ifcase\nr\relax% |
| 59 |
\def\luameshval@bmi@mode{int}% |
| 60 |
\or% |
| 61 |
\def\luameshval@bmi@mode{ext}% |
| 62 |
\fi% |
| 63 |
}% |
| 64 |
%% the name of the color of drawing |
| 65 |
\define@key{buildMeshInc}{color}[black]{\def\luameshval@bmi@color{#1}}% |
| 66 |
%% the name of the color of drawing the bbox |
| 67 |
\define@key{buildMeshInc}{colorBbox}[black]{\def\luameshval@bmi@colorbbox{#1}}% |
| 68 |
%% thickness of the drawing (default value of tikz) |
| 69 |
\define@key{buildMeshInc}{thickness}[0.4pt]{\def\luameshval@bm@thickness{#1}}% |
| 70 |
% |
| 71 |
\presetkeys{buildMeshInc}{tikz=false,bbox=none,scale, meshpoint,mode=int,print=none,color,colorBbox,thickness}{}% |
| 72 |
% |
| 73 |
\newcommand*{\buildMeshBWinc}[4][]{% |
| 74 |
% #1 : optionnal arguments |
| 75 |
% #2 : the string containing the list of points |
| 76 |
% (x1,y1);(x2,y2);... or the name file containing the points |
| 77 |
% #3 : the code to place before the generated one |
| 78 |
% #4 : the code to place after the generated one |
| 79 |
\setkeys{buildMeshInc}{#1} % |
| 80 |
\def\MeshPoint{\luameshval@bmi@meshpoint}% |
| 81 |
\ifKV@buildMeshInc@tikz% if we are using tikz |
| 82 |
\directlua{% |
| 83 |
buildMeshTikZBWinc("#2","\luaescapestring{\unexpanded{#3}}","\luaescapestring{\unexpanded{#4}}","\luameshval@bmi@mode","\luameshval@bmi@print","\luameshval@bmi@bbox","\luameshval@bmi@scale","\luameshval@bmi@color","\luameshval@bmi@colorbbox","\luameshval@bm@thickness")% |
| 84 |
}% |
| 85 |
\else % we are using MP |
| 86 |
\def\luameshmpcolor{\mpcolor{\luameshval@bmi@color}}% |
| 87 |
\def\luameshmpcolorBbox{\mpcolor{\luameshval@bmi@colorbbox}}% |
| 88 |
\directlua{% |
| 89 |
buildMeshMPBWinc("#2","\luaescapestring{\unexpanded{#3}}","\luaescapestring{\unexpanded{#4}}","\luameshval@bmi@mode","\luameshval@bmi@print","\luameshval@bmi@bbox","\luameshval@bmi@scale","\luameshval@bm@thickness")% |
| 90 |
}% |
| 91 |
% |
| 92 |
\fi% |
| 93 |
}% |
| 94 |
% |
| 95 |
%%%%%%%%%%%%%%%% the buildMeshBW command |
| 96 |
%% the code is complete and we don't have any callbacks |
| 97 |
\define@boolkey{buildMesh}{tikz}[true]{}% |
| 98 |
%% show the bounding box for delaunay |
| 99 |
\define@choicekey*{buildMesh}{bbox}[\val\nr]{none, show}{% |
| 100 |
\ifcase\nr\relax% |
| 101 |
\def\luameshval@bm@bbox{none}% |
| 102 |
\or% |
| 103 |
\def\luameshval@bm@bbox{bbox}% |
| 104 |
\fi% |
| 105 |
}% |
| 106 |
%% the scale |
| 107 |
\define@key{buildMesh}{scale}[1cm]{\def\luameshval@bm@scale{#1}}% |
| 108 |
%% print points |
| 109 |
\define@choicekey*{buildMesh}{print}[\val\nr]{none, points, dotpoints}{% |
| 110 |
\ifcase\nr\relax% |
| 111 |
\def\luameshval@bm@print{none}% |
| 112 |
\or% |
| 113 |
\def\luameshval@bm@print{points}% |
| 114 |
\or% |
| 115 |
\def\luameshval@bm@print{dotpoints}% |
| 116 |
\fi% |
| 117 |
}% |
| 118 |
%% the name of the point |
| 119 |
\define@key{buildMesh}{meshpoint}[P]{\def\luameshval@bm@meshpoint{#1}}% |
| 120 |
%% the mode for reading the points |
| 121 |
\define@choicekey*{buildMesh}{mode}[\val\nr]{int, ext}{% |
| 122 |
\ifcase\nr\relax% |
| 123 |
\def\luameshval@bm@mode{int}% |
| 124 |
\or% |
| 125 |
\def\luameshval@bm@mode{ext}% |
| 126 |
\fi% |
| 127 |
}% |
| 128 |
%% the name of the color of drawing |
| 129 |
\define@key{buildMesh}{color}[black]{\def\luameshval@bm@color{#1}}% |
| 130 |
%% the name of the color of drawing the bbox |
| 131 |
\define@key{buildMesh}{colorBbox}[black]{\def\luameshval@bm@colorbbox{#1}}% |
| 132 |
%% thickness of the drawing (default value of tikz) |
| 133 |
\define@key{buildMesh}{thickness}[0.4pt]{\def\luameshval@bm@thickness{#1}}% |
| 134 |
% |
| 135 |
\presetkeys{buildMesh}{tikz=false,bbox=none,scale, meshpoint,mode=int,print=none,color,colorBbox,thickness}{}% |
| 136 |
% |
| 137 |
\newcommand{\buildMeshBW}[2][]{% |
| 138 |
% #1 : optionnal arguments |
| 139 |
% #2 : the string containing the list of points |
| 140 |
% (x1,y1);(x2,y2);... or the name file containing the points |
| 141 |
\setkeys{buildMesh}{#1} % |
| 142 |
\def\MeshPoint{\luameshval@bm@meshpoint}% |
| 143 |
\ifKV@buildMesh@tikz% if we are using tikz |
| 144 |
\directlua{% |
| 145 |
buildMeshTikZBW("#2","\luameshval@bm@mode","\luameshval@bm@print","\luameshval@bm@bbox","\luameshval@bm@scale","\luameshval@bm@color","\luameshval@bm@colorbbox","\luameshval@bm@thickness")% |
| 146 |
}% |
| 147 |
\else % we are using MP |
| 148 |
\def\luameshmpcolor{\mpcolor{\luameshval@bm@color}}% |
| 149 |
\def\luameshmpcolorBbox{\mpcolor{\luameshval@bm@colorbbox}}% |
| 150 |
\directlua{% |
| 151 |
buildMeshMPBW("#2","\luameshval@bm@mode","\luameshval@bm@print","\luameshval@bm@bbox","\luameshval@bm@scale","\luameshval@bm@thickness")% |
| 152 |
}% |
| 153 |
% |
| 154 |
\fi% |
| 155 |
}% |
| 156 |
%%%%%%%%%%%%%%%% the buildVoronoi command |
| 157 |
%% the user can write code (tikz or MP) |
| 158 |
%% before and after the generated code |
| 159 |
\define@boolkey{buildVoronoiInc}{tikz}[true]{}% |
| 160 |
%% show the bounding box for delaunay |
| 161 |
\define@choicekey*{buildVoronoiInc}{bbox}[\val\nr]{none, show}{% |
| 162 |
\ifcase\nr\relax% |
| 163 |
\def\luameshval@bvi@bbox{none}% |
| 164 |
\or% |
| 165 |
\def\luameshval@bvi@bbox{bbox}% |
| 166 |
\fi% |
| 167 |
}% |
| 168 |
%% the scale |
| 169 |
\define@key{buildVoronoiInc}{scale}[1cm]{\def\luameshval@bvi@scale{#1}}% |
| 170 |
%% print ponits ? |
| 171 |
\define@choicekey*{buildVoronoiInc}{print}[\val\nr]{none, points}{% |
| 172 |
\ifcase\nr\relax% |
| 173 |
\def\luameshval@bvi@print{none}% |
| 174 |
\or% |
| 175 |
\def\luameshval@bvi@print{points}% |
| 176 |
\fi% |
| 177 |
}% |
| 178 |
%% style dashed Delaunay |
| 179 |
\define@choicekey*{buildVoronoiInc}{styleDelaunay}[\val\nr]{none, dashed}{% |
| 180 |
\ifcase\nr\relax% |
| 181 |
\def\luameshval@bvi@styleDelaunay{none}% |
| 182 |
\or% |
| 183 |
\def\luameshval@bvi@styleDelaunay{dashed}% |
| 184 |
\fi% |
| 185 |
}% |
| 186 |
%% style dashed Voronoi |
| 187 |
\define@choicekey*{buildVoronoiInc}{styleVoronoi}[\val\nr]{none, dashed}{% |
| 188 |
\ifcase\nr\relax% |
| 189 |
\def\luameshval@bvi@styleVoronoi{none}% |
| 190 |
\or% |
| 191 |
\def\luameshval@bvi@styleVoronoi{dashed}% |
| 192 |
\fi% |
| 193 |
}% |
| 194 |
%% the name of the point |
| 195 |
\define@key{buildVoronoiInc}{meshpoint}[P]{\def\luameshval@bvi@meshpoint{#1}}% |
| 196 |
%% the name of the circum point |
| 197 |
\define@key{buildVoronoiInc}{circumpoint}[P]{\def\luameshval@bvi@circumpoint{#1}}% |
| 198 |
%% the mode for reading the points |
| 199 |
\define@choicekey*{buildVoronoiInc}{mode}[\val\nr]{int, ext}{% |
| 200 |
\ifcase\nr\relax% |
| 201 |
\def\luameshval@bvi@mode{int}% |
| 202 |
\or% |
| 203 |
\def\luameshval@bvi@mode{ext}% |
| 204 |
\fi% |
| 205 |
}% |
| 206 |
%% the mode for reading the points |
| 207 |
\define@choicekey*{buildVoronoiInc}{delaunay}[\val\nr]{none, show}{% |
| 208 |
\ifcase\nr\relax% |
| 209 |
\def\luameshval@bvi@delaunay{none}% |
| 210 |
\or% |
| 211 |
\def\luameshval@bvi@delaunay{show}% |
| 212 |
\fi% |
| 213 |
}% |
| 214 |
%% the name of the color of drawing |
| 215 |
\define@key{buildVoronoiInc}{color}[black]{\def\luameshval@bvi@color{#1}}% |
| 216 |
%% the name of the color of drawing Voronoi |
| 217 |
\define@key{buildVoronoiInc}{colorVoronoi}[red]{\def\luameshval@bvi@colorvoronoi{#1}}% |
| 218 |
%% the name of the color of drawing the bbox |
| 219 |
\define@key{buildVoronoiInc}{colorBbox}[black]{\def\luameshval@bvi@colorbbox{#1}}% |
| 220 |
% |
| 221 |
% thickness |
| 222 |
\define@key{buildVoronoiInc}{thickness}[0.4pt]{\def\luameshval@bvi@thickness{#1}}% |
| 223 |
%% voroni thickness |
| 224 |
\define@key{buildVoronoiInc}{thicknessVoronoi}[0.4pt]{\def\luameshval@bvi@thicknessVoronoi{#1}}% |
| 225 |
\presetkeys{buildVoronoiInc}{tikz=false,bbox=none,scale, |
| 226 |
meshpoint,circumpoint,mode=int,print=none,color,colorVoronoi,colorBbox,delaunay=none,styleDelaunay=none,styleVoronoi=none,thickness, |
| 227 |
thicknessVoronoi}{}% |
| 228 |
% |
| 229 |
\newcommand*{\buildVoronoiBWinc}[4][]{% |
| 230 |
% #1 : optionnal arguments |
| 231 |
% #2 : the string containing the list of points |
| 232 |
% (x1,y1);(x2,y2);... or the name file containing the points |
| 233 |
% #3 : the code to place before the generated one |
| 234 |
% #4 : the code to place after the generated one |
| 235 |
\setkeys{buildVoronoiInc}{#1} % |
| 236 |
\def\MeshPoint{\luameshval@bvi@meshpoint}% |
| 237 |
\def\CircumPoint{\luameshval@bvi@circumpoint}% |
| 238 |
\ifKV@buildVoronoiInc@tikz% if we are using tikz |
| 239 |
\directlua{% |
| 240 |
buildVoronoiTikZBWinc("#2","\luaescapestring{\unexpanded{#3}}","\luaescapestring{\unexpanded{#4}}","\luameshval@bvi@mode","\luameshval@bvi@print","\luameshval@bvi@bbox","\luameshval@bvi@scale","\luameshval@bvi@delaunay","\luameshval@bvi@color","\luameshval@bvi@colorbbox","\luameshval@bvi@colorvoronoi","\luameshval@bvi@styleDelaunay","\luameshval@bvi@styleVoronoi","\luameshval@bvi@thickness","\luameshval@bvi@thicknessVoronoi")% |
| 241 |
}% |
| 242 |
\else % we are using MP |
| 243 |
\def\luameshmpcolor{\mpcolor{\luameshval@bvi@color}}% |
| 244 |
\def\luameshmpcolorBbox{\mpcolor{\luameshval@bvi@colorbbox}}% |
| 245 |
\def\luameshmpcolorVoronoi{\mpcolor{\luameshval@bvi@colorvoronoi}}% |
| 246 |
\directlua{% |
| 247 |
buildVoronoiMPBWinc("#2","\luaescapestring{\unexpanded{#3}}","\luaescapestring{\unexpanded{#4}}","\luameshval@bvi@mode","\luameshval@bvi@print","\luameshval@bvi@bbox","\luameshval@bvi@scale","\luameshval@bvi@delaunay","\luameshval@bvi@styleDelaunay","\luameshval@bvi@styleVoronoi","\luameshval@bvi@thickness","\luameshval@bvi@thicknessVoronoi")% |
| 248 |
}% |
| 249 |
% |
| 250 |
\fi% |
| 251 |
}% |
| 252 |
% |
| 253 |
%%%%%%%%%%%%%%%% the buildVoronoiBW command |
| 254 |
%% the code is complete and we don't have any callbacks |
| 255 |
\define@boolkey{buildVoronoi}{tikz}[true]{}% |
| 256 |
%% show the bounding box for delaunay |
| 257 |
\define@choicekey*{buildVoronoi}{bbox}[\val\nr]{none, show}{% |
| 258 |
\ifcase\nr\relax% |
| 259 |
\def\luameshval@bv@bbox{none}% |
| 260 |
\or% |
| 261 |
\def\luameshval@bv@bbox{bbox}% |
| 262 |
\fi% |
| 263 |
}% |
| 264 |
%% the scale |
| 265 |
\define@key{buildVoronoi}{scale}[1cm]{\def\luameshval@bv@scale{#1}}% |
| 266 |
%% print points |
| 267 |
\define@choicekey*{buildVoronoi}{print}[\val\nr]{none, points}{% |
| 268 |
\ifcase\nr\relax% |
| 269 |
\def\luameshval@bv@print{none}% |
| 270 |
\or% |
| 271 |
\def\luameshval@bv@print{points}% |
| 272 |
\fi% |
| 273 |
}% |
| 274 |
%% the name of the point |
| 275 |
\define@key{buildVoronoi}{meshpoint}[P]{\def\luameshval@bv@meshpoint{#1}}% |
| 276 |
%% the name of the circum point |
| 277 |
\define@key{buildVoronoi}{circumpoint}[P]{\def\luameshval@bv@circumpoint{#1}}% |
| 278 |
%% the mode for reading the points |
| 279 |
\define@choicekey*{buildVoronoi}{mode}[\val\nr]{int, ext}{% |
| 280 |
\ifcase\nr\relax% |
| 281 |
\def\luameshval@bv@mode{int}% |
| 282 |
\or% |
| 283 |
\def\luameshval@bv@mode{ext}% |
| 284 |
\fi% |
| 285 |
}% |
| 286 |
%% style dashed Delaunay |
| 287 |
\define@choicekey*{buildVoronoi}{styleDelaunay}[\val\nr]{none, dashed}{% |
| 288 |
\ifcase\nr\relax% |
| 289 |
\def\luameshval@bv@styleDelaunay{none}% |
| 290 |
\or% |
| 291 |
\def\luameshval@bv@styleDelaunay{dashed}% |
| 292 |
\fi% |
| 293 |
}% |
| 294 |
%% style dashed Voronoi |
| 295 |
\define@choicekey*{buildVoronoi}{styleVoronoi}[\val\nr]{none, dashed}{% |
| 296 |
\ifcase\nr\relax% |
| 297 |
\def\luameshval@bv@styleVoronoi{none}% |
| 298 |
\or% |
| 299 |
\def\luameshval@bv@styleVoronoi{dashed}% |
| 300 |
\fi% |
| 301 |
}% |
| 302 |
%% the mode for reading the points |
| 303 |
\define@choicekey*{buildVoronoi}{delaunay}[\val\nr]{none, show}{% |
| 304 |
\ifcase\nr\relax% |
| 305 |
\def\luameshval@bv@delaunay{none}% |
| 306 |
\or% |
| 307 |
\def\luameshval@bv@delaunay{show}% |
| 308 |
\fi% |
| 309 |
}% |
| 310 |
%% the name of the color of drawing |
| 311 |
\define@key{buildVoronoi}{color}[black]{\def\luameshval@bv@color{#1}}% |
| 312 |
%% the name of the color of drawing Voronoi |
| 313 |
\define@key{buildVoronoi}{colorVoronoi}[red]{\def\luameshval@bv@colorVoronoi{#1}}% |
| 314 |
%% the name of the color of drawing the bbox |
| 315 |
\define@key{buildVoronoi}{colorBbox}[black]{\def\luameshval@bv@colorbbox{#1}}% |
| 316 |
% thickness |
| 317 |
\define@key{buildVoronoi}{thickness}[0.4pt]{\def\luameshval@bv@thickness{#1}}% |
| 318 |
%% voroni thickness |
| 319 |
\define@key{buildVoronoi}{thicknessVoronoi}[0.4pt]{\def\luameshval@bv@thicknessVoronoi{#1}}% |
| 320 |
% |
| 321 |
\presetkeys{buildVoronoi}{tikz=false,bbox=none,scale, |
| 322 |
meshpoint,circumpoint,mode=int,print=none,color,colorVoronoi,colorBbox,delaunay=none,styleDelaunay=none, styleVoronoi=none,thickness,thicknessVoronoi}{}% |
| 323 |
% |
| 324 |
\newcommand{\buildVoronoiBW}[2][]{% |
| 325 |
% #1 : optionnal arguments |
| 326 |
% #2 : the string containing the list of points |
| 327 |
% (x1,y1);(x2,y2);... or the name file containing the points |
| 328 |
\setkeys{buildVoronoi}{#1} % |
| 329 |
\def\MeshPoint{\luameshval@bv@meshpoint}% |
| 330 |
\def\CircumPoint{\luameshval@bv@circumpoint}% |
| 331 |
\ifKV@buildVoronoi@tikz% if we are using tikz |
| 332 |
\directlua{% |
| 333 |
buildVoronoiTikZBW("#2","\luameshval@bv@mode","\luameshval@bv@print","\luameshval@bv@bbox","\luameshval@bv@scale","\luameshval@bv@delaunay","\luameshval@bv@color","\luameshval@bv@colorbbox","\luameshval@bv@colorVoronoi","\luameshval@bv@styleDelaunay","\luameshval@bv@styleVoronoi","\luameshval@bv@thickness","\luameshval@bv@thicknessVoronoi")% |
| 334 |
}% |
| 335 |
\else % we are using MP |
| 336 |
\def\luameshmpcolor{\mpcolor{\luameshval@bv@color}}% |
| 337 |
\def\luameshmpcolorBbox{\mpcolor{\luameshval@bv@colorbbox}}% |
| 338 |
\def\luameshmpcolorVoronoi{\mpcolor{\luameshval@bv@colorVoronoi}}% |
| 339 |
\directlua{% |
| 340 |
buildVoronoiMPBW("#2","\luameshval@bv@mode","\luameshval@bv@print","\luameshval@bv@bbox","\luameshval@bv@scale","\luameshval@bv@delaunay","\luameshval@bv@styleDelaunay","\luameshval@bv@styleVoronoi","\luameshval@bv@thickness","\luameshval@bv@thicknessVoronoi")% |
| 341 |
}% |
| 342 |
% |
| 343 |
\fi% |
| 344 |
}% |
| 345 |
% |
| 346 |
% |
| 347 |
%%%%%%%%%%%%%%%%% the draw Points macro |
| 348 |
%% plot the list of points given in argument |
| 349 |
% the engine |
| 350 |
\define@boolkey{drawPoints}{tikz}[true]{}% |
| 351 |
%% show the bounding box for delaunay |
| 352 |
\define@choicekey*{drawPoints}{bbox}[\val\nr]{none, show}{% |
| 353 |
\ifcase\nr\relax% |
| 354 |
\def\luameshval@tp@bbox{none}% |
| 355 |
\or% |
| 356 |
\def\luameshval@tp@bbox{bbox}% |
| 357 |
\fi% |
| 358 |
}% |
| 359 |
%% the scale |
| 360 |
\define@key{drawPoints}{scale}[1cm]{\def\luameshval@tp@scale{#1}}% |
| 361 |
%% print points |
| 362 |
\define@choicekey*{drawPoints}{print}[\val\nr]{none, points}{% |
| 363 |
\ifcase\nr\relax% |
| 364 |
\def\luameshval@tp@print{none}% |
| 365 |
\or% |
| 366 |
\def\luameshval@tp@print{points}% |
| 367 |
\fi% |
| 368 |
}% |
| 369 |
%% the name of the point |
| 370 |
\define@key{drawPoints}{meshpoint}[P]{\def\luameshval@tp@meshpoint{#1}}% |
| 371 |
%% the mode for reading the points |
| 372 |
\define@choicekey*{drawPoints}{mode}[\val\nr]{int, ext}{% |
| 373 |
\ifcase\nr\relax% |
| 374 |
\def\luameshval@tp@mode{int}% |
| 375 |
\or% |
| 376 |
\def\luameshval@tp@mode{ext}% |
| 377 |
\fi% |
| 378 |
}% |
| 379 |
%% the name of the color of drawing |
| 380 |
\define@key{drawPoints}{color}[black]{\def\luameshval@tp@color{#1}}% |
| 381 |
%% the name of the color of drawing the bbox |
| 382 |
\define@key{drawPoints}{colorBbox}[black]{\def\luameshval@tp@colorbbox{#1}}% |
| 383 |
% |
| 384 |
\presetkeys{drawPoints}{tikz=false,bbox=none,scale, meshpoint,mode=int,print=none,color,colorBbox}{}% |
| 385 |
% |
| 386 |
\newcommand{\drawPointsMesh}[2][]{% |
| 387 |
% #1 : optionnal arguments |
| 388 |
% #2 : the string containing the list of points |
| 389 |
% (x1,y1);(x2,y2);... or the name file containing the points |
| 390 |
\setkeys{drawPoints}{#1} % |
| 391 |
\def\MeshPoint{\luameshval@tp@meshpoint}% |
| 392 |
\ifKV@drawPoints@tikz% if we are using tikz |
| 393 |
\directlua{% |
| 394 |
printPointsTikZ("#2","\luameshval@tp@mode","\luameshval@tp@print","\luameshval@tp@bbox","\luameshval@tp@scale","\luameshval@tp@color","\luameshval@tp@colorbbox")% |
| 395 |
}% |
| 396 |
\else % we are using MP |
| 397 |
\def\luameshmpcolor{\mpcolor{\luameshval@tp@color}}% |
| 398 |
\def\luameshmpcolorBbox{\mpcolor{\luameshval@tp@colorbbox}}% |
| 399 |
\directlua{% |
| 400 |
printPointsMP("#2","\luameshval@tp@mode","\luameshval@tp@print","\luameshval@tp@bbox","\luameshval@tp@scale")% |
| 401 |
}% |
| 402 |
% |
| 403 |
\fi% |
| 404 |
}% |
| 405 |
% |
| 406 |
|
| 407 |
%%%%%%%%%%%%%%%% the draw Points macro inc with callbacks |
| 408 |
%% engine of drawing |
| 409 |
\define@boolkey{drawPointsInc}{tikz}[true]{}% |
| 410 |
%% show the bounding box for delaunay |
| 411 |
\define@choicekey*{drawPointsInc}{bbox}[\val\nr]{none, show}{% |
| 412 |
\ifcase\nr\relax% |
| 413 |
\def\luameshval@tpi@bbox{none}% |
| 414 |
\or% |
| 415 |
\def\luameshval@tpi@bbox{bbox}% |
| 416 |
\fi% |
| 417 |
}% |
| 418 |
%% the scale |
| 419 |
\define@key{drawPointsInc}{scale}[1cm]{\def\luameshval@tpi@scale{#1}}% |
| 420 |
%% print points |
| 421 |
\define@choicekey*{drawPointsInc}{print}[\val\nr]{none, points}{% |
| 422 |
\ifcase\nr\relax% |
| 423 |
\def\luameshval@tpi@print{none}% |
| 424 |
\or% |
| 425 |
\def\luameshval@tpi@print{points}% |
| 426 |
\fi% |
| 427 |
}% |
| 428 |
%% the name of the point |
| 429 |
\define@key{drawPointsInc}{meshpoint}[P]{\def\luameshval@tpi@meshpoint{#1}}% |
| 430 |
%% the mode for reading the points |
| 431 |
\define@choicekey*{drawPointsInc}{mode}[\val\nr]{int, ext}{% |
| 432 |
\ifcase\nr\relax% |
| 433 |
\def\luameshval@tpi@mode{int}% |
| 434 |
\or% |
| 435 |
\def\luameshval@tpi@mode{ext}% |
| 436 |
\fi% |
| 437 |
}% |
| 438 |
% |
| 439 |
% color |
| 440 |
%% the name of the color of drawing |
| 441 |
\define@key{drawPointsInc}{color}[black]{\def\luameshval@tpi@color{#1}}% |
| 442 |
%% the name of the color of drawing the bbox |
| 443 |
\define@key{drawPointsInc}{colorBbox}[black]{\def\luameshval@tpi@colorbbox{#1}}% |
| 444 |
% |
| 445 |
\presetkeys{drawPointsInc}{tikz=false,bbox=none,scale, meshpoint,mode=int,print=none,color,colorBbox}{}% |
| 446 |
% |
| 447 |
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 448 |
\newcommand*{\drawPointsMeshinc}[4][]{% |
| 449 |
% #1 : optionnal arguments |
| 450 |
% #2 : the string containing the list of points |
| 451 |
% (x1,y1);(x2,y2);... or the name file containing the points |
| 452 |
% #3 : the code to place before the generated one |
| 453 |
% #4 : the code to place after the generated one |
| 454 |
\setkeys{drawPointsInc}{#1} % |
| 455 |
\def\MeshPoint{\luameshval@tpi@meshpoint}% |
| 456 |
\ifKV@drawPointsInc@tikz% if we are using tikz |
| 457 |
\directlua{% |
| 458 |
printPointsTikZinc("#2","\luaescapestring{\unexpanded{#3}}","\luaescapestring{\unexpanded{#4}}","\luameshval@tpi@mode","\luameshval@tpi@print","\luameshval@tpi@bbox","\luameshval@tpi@scale","\luameshval@tpi@color","\luameshval@tpi@colorbbox")% |
| 459 |
}% |
| 460 |
\else % we are using MP |
| 461 |
\def\luameshmpcolor{\mpcolor{\luameshval@tpi@color}}% |
| 462 |
\def\luameshmpcolorBbox{\mpcolor{\luameshval@tpi@colorbbox}}% |
| 463 |
\directlua{% |
| 464 |
printPointsMPinc("#2","\luaescapestring{\unexpanded{#3}}","\luaescapestring{\unexpanded{#4}}","\luameshval@tpi@mode","\luameshval@tpi@print","\luameshval@tpi@bbox","\luameshval@tpi@scale")% |
| 465 |
}% |
| 466 |
\fi% |
| 467 |
}% |
| 468 |
% |
| 469 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 470 |
%% the meshAddOnePointBW commande |
| 471 |
%%engine of draiwng |
| 472 |
\define@boolkey{MeshAddOneBW}{tikz}[true]{}% |
| 473 |
%% the scale |
| 474 |
\define@key{MeshAddOneBW}{scale}[1cm]{\def\luameshval@ap@scale{#1}}% |
| 475 |
%% the name of the points |
| 476 |
\define@key{MeshAddOneBW}{meshpoint}[P]{\def\luameshval@ap@meshpoint{#1}}% |
| 477 |
%% the name of the new point |
| 478 |
\define@key{MeshAddOneBW}{newpoint}[P]{\def\luameshval@ap@newpoint{#1}}% |
| 479 |
%% a complete picture or some code of the engine |
| 480 |
\define@choicekey*{MeshAddOneBW}{step}[\val\nr]{badtriangles, cavity, newtriangles}{% |
| 481 |
\ifcase\nr\relax% |
| 482 |
\def\luameshval@ap@step{badT}% |
| 483 |
\or% |
| 484 |
\def\luameshval@ap@step{cavity}% |
| 485 |
\or% |
| 486 |
\def\luameshval@ap@step{newT}% |
| 487 |
\fi% |
| 488 |
}% |
| 489 |
% color |
| 490 |
%% the color of drawing |
| 491 |
\define@key{MeshAddOneBW}{color}[black]{\def\luameshval@ap@color{#1}}% |
| 492 |
%% the color of background of new element |
| 493 |
\define@key{MeshAddOneBW}{colorBack}[black!20]{\def\luameshval@ap@colorback{#1}}% |
| 494 |
%% the color of new element |
| 495 |
\define@key{MeshAddOneBW}{colorNew}[red]{\def\luameshval@ap@colornew{#1}}% |
| 496 |
%% the color of circoncircle |
| 497 |
\define@key{MeshAddOneBW}{colorCircle}[green]{\def\luameshval@ap@colorcircle{#1}}% |
| 498 |
%% the name of the color of drawing the bbox |
| 499 |
\define@key{MeshAddOneBW}{colorBbox}[black]{\def\luameshval@ap@colorbbox{#1}}% |
| 500 |
% |
| 501 |
%% a complete picture or some code of the engine |
| 502 |
\define@choicekey*{MeshAddOneBW}{mode}[\val\nr]{int, ext}{% |
| 503 |
\ifcase\nr\relax% |
| 504 |
\def\luameshval@ap@mode{int}% |
| 505 |
\or% |
| 506 |
\def\luameshval@ap@mode{ext}% |
| 507 |
\fi% |
| 508 |
}% |
| 509 |
\define@choicekey*{MeshAddOneBW}{bbox}[\val\nr]{none, show}{% |
| 510 |
\ifcase\nr\relax% |
| 511 |
\def\luameshval@ap@bbox{none}% |
| 512 |
\or% |
| 513 |
\def\luameshval@ap@bbox{bbox}% |
| 514 |
\fi% |
| 515 |
}% |
| 516 |
%% thickness for mesh and circle and new elements |
| 517 |
\define@key{MeshAddOneBW}{thickness}[0.4pt]{\def\luameshval@ap@thickness{#1}}% |
| 518 |
\define@key{MeshAddOneBW}{thicknessCircle}[0.4pt]{\def\luameshval@ap@thicknesscircle{#1}}% |
| 519 |
\define@key{MeshAddOneBW}{thicknessNew}[1pt]{\def\luameshval@ap@thicknessnew{#1}}% |
| 520 |
|
| 521 |
\presetkeys{MeshAddOneBW}{tikz=false,scale, meshpoint,newpoint,color,colorBack,colorNew,colorCircle,step=badtriangles,mode=int,bbox=none,colorBbox,thickness,thicknessCircle,thicknessNew}{}% |
| 522 |
% |
| 523 |
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 524 |
\newcommand*{\meshAddPointBW}[3][]{% |
| 525 |
% #1 : optionnal arguments |
| 526 |
% #2 : the string containing the list of points |
| 527 |
% (x1,y1);(x2,y2);... or the name file containing the points |
| 528 |
\setkeys{MeshAddOneBW}{#1} % |
| 529 |
\def\MeshPoint{\luameshval@ap@meshpoint}% |
| 530 |
\def\NewPoint{\luameshval@ap@newpoint}% |
| 531 |
\ifKV@MeshAddOneBW@tikz% if we are using tikz |
| 532 |
\directlua{% |
| 533 |
TeXOnePointTikZBW("#2","#3","\luameshval@ap@step","\luameshval@ap@scale","\luameshval@ap@mode","\luameshval@ap@bbox","\luameshval@ap@color","\luameshval@ap@colorback","\luameshval@ap@colornew","\luameshval@ap@colorcircle","\luameshval@ap@colorbbox","\luameshval@ap@thickness","\luameshval@ap@thicknesscircle","\luameshval@ap@thicknessnew")% |
| 534 |
}% |
| 535 |
\else % we are using MP |
| 536 |
\def\luameshmpcolor{\mpcolor{\luameshval@ap@color}} |
| 537 |
\def\luameshmpcolorBack{\mpcolor{\luameshval@ap@colorback}} |
| 538 |
\def\luameshmpcolorNew{\mpcolor{\luameshval@ap@colornew}} |
| 539 |
\def\luameshmpcolorCircle{\mpcolor{\luameshval@ap@colorcircle}} |
| 540 |
\def\luameshmpcolorBbox{\mpcolor{\luameshval@ap@colorbbox}} |
| 541 |
\directlua{% |
| 542 |
TeXOnePointMPBW("#2","#3","\luameshval@ap@step","\luameshval@ap@scale","\luameshval@ap@mode","\luameshval@ap@bbox","\luameshval@ap@thickness","\luameshval@ap@thicknesscircle","\luameshval@ap@thicknessnew")% |
| 543 |
}% |
| 544 |
% |
| 545 |
\fi% |
| 546 |
}% |
| 547 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 548 |
%%% the meshAddPointBWinc commande with callbacks |
| 549 |
%% engine of drawing |
| 550 |
\define@boolkey{MeshAddOneBWinc}{tikz}[true]{}% |
| 551 |
%% the scale |
| 552 |
\define@key{MeshAddOneBWinc}{scale}[1cm]{\def\luameshval@api@scale{#1}}% |
| 553 |
%% the name of the points |
| 554 |
\define@key{MeshAddOneBWinc}{meshpoint}[P]{\def\luameshval@api@meshpoint{#1}}% |
| 555 |
%% the name of the new point |
| 556 |
\define@key{MeshAddOneBWinc}{newpoint}[P]{\def\luameshval@api@newpoint{#1}}% |
| 557 |
%% a complete picture or some code of the engine |
| 558 |
\define@choicekey*{MeshAddOneBWinc}{step}[\val\nr]{badtriangles, cavity, newtriangles}{% |
| 559 |
\ifcase\nr\relax% |
| 560 |
\def\luameshval@api@step{badT}% |
| 561 |
\or% |
| 562 |
\def\luameshval@api@step{cavity}% |
| 563 |
\or% |
| 564 |
\def\luameshval@api@step{newT}% |
| 565 |
\fi% |
| 566 |
}% |
| 567 |
% color |
| 568 |
%% the color of drawing |
| 569 |
\define@key{MeshAddOneBWinc}{color}[black]{\def\luameshval@api@color{#1}}% |
| 570 |
%% the color of background of new element |
| 571 |
\define@key{MeshAddOneBWinc}{colorBack}[black!20]{\def\luameshval@api@colorback{#1}}% |
| 572 |
%% the color of new element |
| 573 |
\define@key{MeshAddOneBWinc}{colorNew}[red]{\def\luameshval@api@colornew{#1}}% |
| 574 |
%% the color of circoncircle |
| 575 |
\define@key{MeshAddOneBWinc}{colorCircle}[green]{\def\luameshval@api@colorcircle{#1}}% |
| 576 |
\define@key{MeshAddOneBWinc}{colorBbox}[black]{\def\luameshval@api@colorbbox{#1}}% |
| 577 |
%% thickness for mesh and circle and new elements |
| 578 |
\define@key{MeshAddOneBWinc}{thickness}[0.4pt]{\def\luameshval@api@thickness{#1}}% |
| 579 |
\define@key{MeshAddOneBWinc}{thicknessCircle}[0.4pt]{\def\luameshval@api@thicknesscircle{#1}}% |
| 580 |
\define@key{MeshAddOneBWinc}{thicknessNew}[1pt]{\def\luameshval@api@thicknessnew{#1}}% |
| 581 |
|
| 582 |
|
| 583 |
% |
| 584 |
%% a complete picture or some code of the engine |
| 585 |
\define@choicekey*{MeshAddOneBWinc}{mode}[\val\nr]{int, ext}{% |
| 586 |
\ifcase\nr\relax% |
| 587 |
\def\luameshval@api@mode{int}% |
| 588 |
\or% |
| 589 |
\def\luameshval@api@mode{ext}% |
| 590 |
\fi% |
| 591 |
}% |
| 592 |
\define@choicekey*{MeshAddOneBWinc}{bbox}[\val\nr]{none, show}{% |
| 593 |
\ifcase\nr\relax% |
| 594 |
\def\luameshval@api@bbox{none}% |
| 595 |
\or% |
| 596 |
\def\luameshval@api@bbox{bbox}% |
| 597 |
\fi% |
| 598 |
}% |
| 599 |
\presetkeys{MeshAddOneBWinc}{tikz=false,scale, meshpoint,newpoint,color,colorBack,colorNew,colorCircle,step=badtriangles,mode=int,bbox=none,colorBbox,thickness,thicknessCircle,thicknessNew}{}% |
| 600 |
% |
| 601 |
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 602 |
\newcommand*{\meshAddPointBWinc}[5][]{% |
| 603 |
% #1 : optionnal arguments |
| 604 |
% #2 : the string containing the list of points |
| 605 |
% (x1,y1);(x2,y2);... or the name file containing the points |
| 606 |
% #3 : the code to place before the generated one |
| 607 |
% #4 : the code to place after the generated one |
| 608 |
\setkeys{MeshAddOneBWinc}{#1} % |
| 609 |
\def\MeshPoint{\luameshval@api@meshpoint}% |
| 610 |
\def\NewPoint{\luameshval@api@newpoint}% |
| 611 |
\ifKV@MeshAddOneBWinc@tikz% if we are using tikz |
| 612 |
\directlua{% |
| 613 |
TeXOnePointTikZBWinc("#2","#3","\luaescapestring{\unexpanded{#4}}","\luaescapestring{\unexpanded{#5}}","\luameshval@api@step","\luameshval@api@scale","\luameshval@api@mode","\luameshval@api@bbox","\luameshval@api@color","\luameshval@api@colorback","\luameshval@api@colornew","\luameshval@api@colorcircle","\luameshval@api@colorbbox","\luameshval@api@thickness","\luameshval@api@thicknesscircle","\luameshval@api@thicknessnew")% |
| 614 |
}% |
| 615 |
\else % we are using MP |
| 616 |
\def\luameshmpcolor{\mpcolor{\luameshval@api@color}} |
| 617 |
\def\luameshmpcolorBack{\mpcolor{\luameshval@api@colorback}} |
| 618 |
\def\luameshmpcolorNew{\mpcolor{\luameshval@api@colornew}} |
| 619 |
\def\luameshmpcolorCircle{\mpcolor{\luameshval@api@colorcircle}} |
| 620 |
\def\luameshmpcolorBbox{\mpcolor{\luameshval@api@colorbbox}} |
| 621 |
\directlua{% |
| 622 |
TeXOnePointMPBWinc("#2","#3","\luaescapestring{\unexpanded{#4}}","\luaescapestring{\unexpanded{#5}}","\luameshval@api@step","\luameshval@api@scale","\luameshval@api@mode","\luameshval@api@bbox","\luameshval@api@thickness","\luameshval@api@thicknesscircle","\luameshval@api@thicknessnew")% |
| 623 |
}% |
| 624 |
% |
| 625 |
\fi% |
| 626 |
}% |
| 627 |
% |
| 628 |
%%%%%%%%%%%%%%%% the drawGmsh command inc |
| 629 |
%% the user can write code (tikz or MP) |
| 630 |
%% before and after the generated code |
| 631 |
\define@boolkey{drawGmshInc}{tikz}[true]{}% |
| 632 |
%% the scale |
| 633 |
\define@key{drawGmshInc}{scale}[1cm]{\def\luameshval@dgi@scale{#1}}% |
| 634 |
%% print ponits ? |
| 635 |
\define@choicekey*{drawGmshInc}{print}[\val\nr]{none, points}{% |
| 636 |
\ifcase\nr\relax% |
| 637 |
\def\luameshval@dgi@print{none}% |
| 638 |
\or% |
| 639 |
\def\luameshval@dgi@print{points}% |
| 640 |
\fi% |
| 641 |
}% |
| 642 |
%% the name of the point |
| 643 |
\define@key{drawGmshInc}{meshpoint}[P]{\def\luameshval@dgi@meshpoint{#1}}% |
| 644 |
%% the name of the color of drawing |
| 645 |
\define@key{drawGmshInc}{color}[black]{\def\luameshval@dgi@color{#1}}% |
| 646 |
%% thickness |
| 647 |
\define@key{drawGmshInc}{thickness}[0.4pt]{\def\luameshval@dgi@thickness{#1}}% |
| 648 |
% |
| 649 |
\presetkeys{drawGmshInc}{tikz=false,scale, meshpoint,print=none,color,thickness}{}% |
| 650 |
% |
| 651 |
\newcommand*{\drawGmshinc}[4][]{% |
| 652 |
% #1 : optionnal arguments |
| 653 |
% #2 : the string containing the gmsh file |
| 654 |
% #3 : the code to place before the generated one |
| 655 |
% #4 : the code to place after the generated one |
| 656 |
\setkeys{drawGmshInc}{#1} % |
| 657 |
\def\MeshPoint{\luameshval@dgi@meshpoint}% |
| 658 |
\ifKV@drawGmshInc@tikz% if we are using tikz |
| 659 |
\directlua{% |
| 660 |
drawGmshTikZinc("#2","\luaescapestring{\unexpanded{#3}}","\luaescapestring{\unexpanded{#4}}","\luameshval@dgi@print","\luameshval@dgi@scale","\luameshval@dgi@color","\luameshval@dgi@thickness")% |
| 661 |
}% |
| 662 |
\else % we are using MP |
| 663 |
\def\luameshmpcolor{\mpcolor{\luameshval@dgi@color}}% |
| 664 |
\directlua{% |
| 665 |
drawGmshMPinc("#2","\luaescapestring{\unexpanded{#3}}","\luaescapestring{\unexpanded{#4}}","\luameshval@dgi@print","\luameshval@dgi@scale","\luameshval@dgi@thickness")% |
| 666 |
}% |
| 667 |
% |
| 668 |
\fi% |
| 669 |
}% |
| 670 |
% |
| 671 |
%%%%%%%%%%%%%%%% the drawGmshBW command |
| 672 |
%% the code is complete and we don't have any callbacks |
| 673 |
\define@boolkey{drawGmsh}{tikz}[true]{}% |
| 674 |
%% the scale |
| 675 |
\define@key{drawGmsh}{scale}[1cm]{\def\luameshval@dg@scale{#1}}% |
| 676 |
%% print points |
| 677 |
\define@choicekey*{drawGmsh}{print}[\val\nr]{none, points}{% |
| 678 |
\ifcase\nr\relax% |
| 679 |
\def\luameshval@dg@print{none}% |
| 680 |
\or% |
| 681 |
\def\luameshval@dg@print{points}% |
| 682 |
\fi% |
| 683 |
}% |
| 684 |
%% the name of the point |
| 685 |
\define@key{drawGmsh}{meshpoint}[P]{\def\luameshval@dg@meshpoint{#1}}% |
| 686 |
%% the name of the color of drawing |
| 687 |
\define@key{drawGmsh}{color}[black]{\def\luameshval@dg@color{#1}}% |
| 688 |
%% thickness |
| 689 |
\define@key{drawGmsh}{thickness}[0.4pt]{\def\luameshval@dg@thickness{#1}}% |
| 690 |
% |
| 691 |
\presetkeys{drawGmsh}{tikz=false,scale, meshpoint,print=none,color,thickness}{}% |
| 692 |
% |
| 693 |
\newcommand{\drawGmsh}[2][]{% |
| 694 |
% #1 : optionnal arguments |
| 695 |
% #2 : the gmsh file |
| 696 |
\setkeys{drawGmsh}{#1} % |
| 697 |
\def\MeshPoint{\luameshval@dg@meshpoint}% |
| 698 |
\ifKV@drawGmsh@tikz% if we are using tikz |
| 699 |
\directlua{% |
| 700 |
drawGmshTikZ("#2","\luameshval@dg@print","\luameshval@dg@scale","\luameshval@dg@color","\luameshval@dg@thickness")% |
| 701 |
}% |
| 702 |
\else % we are using MP |
| 703 |
\def\luameshmpcolor{\mpcolor{\luameshval@dg@color}}% |
| 704 |
\directlua{% |
| 705 |
drawGmshMP("#2","\luameshval@dg@print","\luameshval@dg@scale","\luameshval@dg@thickness")% |
| 706 |
}% |
| 707 |
% |
| 708 |
\fi% |
| 709 |
}% |
| 710 |
%%%%%%%%%%%%%%%% the gmshVoronoi command |
| 711 |
%% the user can write code (tikz or MP) |
| 712 |
%% before and after the generated code |
| 713 |
\define@boolkey{gmshVoronoiInc}{tikz}[true]{}% |
| 714 |
%% the scale |
| 715 |
\define@key{gmshVoronoiInc}{scale}[1cm]{\def\luameshval@gvi@scale{#1}}% |
| 716 |
%% print ponits ? |
| 717 |
\define@choicekey*{gmshVoronoiInc}{print}[\val\nr]{none, points}{% |
| 718 |
\ifcase\nr\relax% |
| 719 |
\def\luameshval@gvi@print{none}% |
| 720 |
\or% |
| 721 |
\def\luameshval@gvi@print{points}% |
| 722 |
\fi% |
| 723 |
}% |
| 724 |
%% the name of the point |
| 725 |
\define@key{gmshVoronoiInc}{meshpoint}[P]{\def\luameshval@gvi@meshpoint{#1}}% |
| 726 |
%% the name of the circum point |
| 727 |
\define@key{gmshVoronoiInc}{circumpoint}[P]{\def\luameshval@gvi@circumpoint{#1}}% |
| 728 |
%% the mode for reading the points |
| 729 |
\define@choicekey*{gmshVoronoiInc}{delaunay}[\val\nr]{none, show}{% |
| 730 |
\ifcase\nr\relax% |
| 731 |
\def\luameshval@gvi@delaunay{none}% |
| 732 |
\or% |
| 733 |
\def\luameshval@gvi@delaunay{show}% |
| 734 |
\fi% |
| 735 |
}% |
| 736 |
%% style dashed Delaunay |
| 737 |
\define@choicekey*{gmshVoronoiInc}{styleDelaunay}[\val\nr]{none, dashed}{% |
| 738 |
\ifcase\nr\relax% |
| 739 |
\def\luameshval@gvi@styleDelaunay{none}% |
| 740 |
\or% |
| 741 |
\def\luameshval@gvi@styleDelaunay{dashed}% |
| 742 |
\fi% |
| 743 |
}% |
| 744 |
%% style dashed Voronoi |
| 745 |
\define@choicekey*{gmshVoronoiInc}{styleVoronoi}[\val\nr]{none, dashed}{% |
| 746 |
\ifcase\nr\relax% |
| 747 |
\def\luameshval@gvi@styleVoronoi{none}% |
| 748 |
\or% |
| 749 |
\def\luameshval@gvi@styleVoronoi{dashed}% |
| 750 |
\fi% |
| 751 |
}% |
| 752 |
%% the name of the color of drawing |
| 753 |
\define@key{gmshVoronoiInc}{color}[black]{\def\luameshval@gvi@color{#1}}% |
| 754 |
%% the name of the color of drawing Voronoi |
| 755 |
\define@key{gmshVoronoiInc}{colorVoronoi}[red]{\def\luameshval@gvi@colorvoronoi{#1}}% |
| 756 |
%% thickness |
| 757 |
\define@key{gmshVoronoiInc}{thickness}[0.4pt]{\def\luameshval@gvi@thickness{#1}}% |
| 758 |
%% Voronoi thickness |
| 759 |
\define@key{gmshVoronoiInc}{thicknessVoronoi}[0.4pt]{\def\luameshval@gvi@thicknessVoronoi{#1}}% |
| 760 |
|
| 761 |
% |
| 762 |
\presetkeys{gmshVoronoiInc}{tikz=false,scale, |
| 763 |
meshpoint,circumpoint,print=none,color,colorVoronoi,delaunay=none,styleVoronoi=none, styleDelaunay=none}{}% |
| 764 |
% |
| 765 |
\newcommand*{\gmshVoronoiinc}[4][]{% |
| 766 |
% #1 : optionnal arguments |
| 767 |
% #2 : the gmsh file |
| 768 |
% #3 : the code to place before the generated one |
| 769 |
% #4 : the code to place after the generated one |
| 770 |
\setkeys{gmshVoronoiInc}{#1} % |
| 771 |
\def\MeshPoint{\luameshval@gvi@meshpoint}% |
| 772 |
\def\CircumPoint{\luameshval@gvi@circumpoint}% |
| 773 |
\ifKV@gmshVoronoiInc@tikz% if we are using tikz |
| 774 |
\directlua{% |
| 775 |
gmshVoronoiTikZinc("#2","\luaescapestring{\unexpanded{#3}}","\luaescapestring{\unexpanded{#4}}","\luameshval@gvi@print","\luameshval@gvi@scale","\luameshval@gvi@delaunay","\luameshval@gvi@color","\luameshval@gvi@colorvoronoi","\luameshval@gvi@styleDelaunay","\luameshval@gvi@styleVoronoi","\luameshval@gvi@thickness","\luameshval@gvi@thicknessVoronoi")% |
| 776 |
}% |
| 777 |
\else % we are using MP |
| 778 |
\def\luameshmpcolor{\mpcolor{\luameshval@gvi@color}}% |
| 779 |
\def\luameshmpcolorVoronoi{\mpcolor{\luameshval@gvi@colorvoronoi}}% |
| 780 |
\directlua{% |
| 781 |
gmshVoronoiMPinc("#2","\luaescapestring{\unexpanded{#3}}","\luaescapestring{\unexpanded{#4}}","\luameshval@gvi@print","\luameshval@gvi@scale","\luameshval@gvi@delaunay","\luameshval@gvi@styleDelaunay","\luameshval@gvi@styleVoronoi","\luameshval@gvi@thickness","\luameshval@gvi@thicknessVoronoi")% |
| 782 |
}% |
| 783 |
% |
| 784 |
\fi% |
| 785 |
}% |
| 786 |
% |
| 787 |
%%%%%%%%%%%%%%%% the gmshVoronoiBW command |
| 788 |
%% the code is complete and we don't have any callbacks |
| 789 |
\define@boolkey{gmshVoronoi}{tikz}[true]{}% |
| 790 |
%% the scale |
| 791 |
\define@key{gmshVoronoi}{scale}[1cm]{\def\luameshval@gv@scale{#1}}% |
| 792 |
%% print points |
| 793 |
\define@choicekey*{gmshVoronoi}{print}[\val\nr]{none, points}{% |
| 794 |
\ifcase\nr\relax% |
| 795 |
\def\luameshval@gv@print{none}% |
| 796 |
\or% |
| 797 |
\def\luameshval@gv@print{points}% |
| 798 |
\fi% |
| 799 |
}% |
| 800 |
%% the name of the point |
| 801 |
\define@key{gmshVoronoi}{meshpoint}[P]{\def\luameshval@gv@meshpoint{#1}}% |
| 802 |
%% the name of the circum point |
| 803 |
\define@key{gmshVoronoi}{circumpoint}[P]{\def\luameshval@gv@circumpoint{#1}}% |
| 804 |
%% the mode for reading the points |
| 805 |
\define@choicekey*{gmshVoronoi}{delaunay}[\val\nr]{none, show}{% |
| 806 |
\ifcase\nr\relax% |
| 807 |
\def\luameshval@gv@delaunay{none}% |
| 808 |
\or% |
| 809 |
\def\luameshval@gv@delaunay{show}% |
| 810 |
\fi% |
| 811 |
}% |
| 812 |
%% style dashed Delaunay |
| 813 |
\define@choicekey*{gmshVoronoi}{styleDelaunay}[\val\nr]{none, dashed}{% |
| 814 |
\ifcase\nr\relax% |
| 815 |
\def\luameshval@gv@styleDelaunay{none}% |
| 816 |
\or% |
| 817 |
\def\luameshval@gv@styleDelaunay{dashed}% |
| 818 |
\fi% |
| 819 |
}% |
| 820 |
%% style dashed Voronoi |
| 821 |
\define@choicekey*{gmshVoronoi}{styleVoronoi}[\val\nr]{none, dashed}{% |
| 822 |
\ifcase\nr\relax% |
| 823 |
\def\luameshval@gv@styleVoronoi{none}% |
| 824 |
\or% |
| 825 |
\def\luameshval@gv@styleVoronoi{dashed}% |
| 826 |
\fi% |
| 827 |
}% |
| 828 |
%% the name of the color of drawing |
| 829 |
\define@key{gmshVoronoi}{color}[black]{\def\luameshval@gv@color{#1}}% |
| 830 |
%% the name of the color of drawing Voronoi |
| 831 |
\define@key{gmshVoronoi}{colorVoronoi}[red]{\def\luameshval@gv@colorVoronoi{#1}}% |
| 832 |
% |
| 833 |
%% thickness |
| 834 |
\define@key{gmshVoronoi}{thickness}[0.4pt]{\def\luameshval@gv@thickness{#1}}% |
| 835 |
%% Voronoi thickness |
| 836 |
\define@key{gmshVoronoi}{thicknessVoronoi}[0.4pt]{\def\luameshval@gv@thicknessVoronoi{#1}}% |
| 837 |
% |
| 838 |
\presetkeys{gmshVoronoi}{tikz=false,scale, meshpoint,circumpoint,print=none,color,colorVoronoi,delaunay=none,styleVoronoi=none, styleDelaunay=none,thickness,thicknessVoronoi}{}% |
| 839 |
% |
| 840 |
\newcommand{\gmshVoronoi}[2][]{% |
| 841 |
% #1 : optionnal arguments |
| 842 |
% #2 : the gmsh file |
| 843 |
\setkeys{gmshVoronoi}{#1} % |
| 844 |
\def\MeshPoint{\luameshval@gv@meshpoint}% |
| 845 |
\def\CircumPoint{\luameshval@gv@circumpoint}% |
| 846 |
\ifKV@gmshVoronoi@tikz% if we are using tikz |
| 847 |
\directlua{% |
| 848 |
gmshVoronoiTikZ("#2","\luameshval@gv@print","\luameshval@gv@scale","\luameshval@gv@delaunay","\luameshval@gv@color","\luameshval@gv@colorVoronoi","\luameshval@gv@styleDelaunay","\luameshval@gv@styleVoronoi","\luameshval@gv@thickness","\luameshval@gv@thicknessVoronoi")% |
| 849 |
}% |
| 850 |
\else % we are using MP |
| 851 |
\def\luameshmpcolor{\mpcolor{\luameshval@gv@color}}% |
| 852 |
\def\luameshmpcolorVoronoi{\mpcolor{\luameshval@gv@colorVoronoi}}% |
| 853 |
\directlua{% |
| 854 |
gmshVoronoiMP("#2","\luameshval@gv@print","\luameshval@gv@scale","\luameshval@gv@delaunay","\luameshval@gv@styleDelaunay","\luameshval@gv@styleVoronoi","\luameshval@gv@thickness","\luameshval@gv@thicknessVoronoi")% |
| 855 |
}% |
| 856 |
% |
| 857 |
\fi% |
| 858 |
}% |
| 859 |
% |
| 860 |
% |
| 861 |
% |
| 862 |
%%%%%%%%%%%%%%%% the meshPolygon command |
| 863 |
%% |
| 864 |
\define@boolkey{meshPolygon}{tikz}[true]{}% |
| 865 |
|
| 866 |
%% the scale |
| 867 |
\define@key{meshPolygon}{scale}[1cm]{\def\luameshval@mp@scale{#1}}% |
| 868 |
%% print points |
| 869 |
\define@choicekey*{meshPolygon}{print}[\val\nr]{none, points,dotpoints}{% |
| 870 |
\ifcase\nr\relax% |
| 871 |
\def\luameshval@mp@print{none}% |
| 872 |
\or% |
| 873 |
\def\luameshval@mp@print{points}% |
| 874 |
\or% |
| 875 |
\def\luameshval@mp@print{dotpoints}% |
| 876 |
\fi% |
| 877 |
}% |
| 878 |
%% the name of the point |
| 879 |
\define@key{meshPolygon}{meshpoint}[P]{\def\luameshval@mp@meshpoint{#1}}% |
| 880 |
%% the grid parameter |
| 881 |
\define@key{meshPolygon}{h}[0.2]{\def\luameshval@mp@h{#1}}% |
| 882 |
%% the mode for reading the points |
| 883 |
\define@choicekey*{meshPolygon}{mode}[\val\nr]{int, ext}{% |
| 884 |
\ifcase\nr\relax% |
| 885 |
\def\luameshval@mp@mode{int}% |
| 886 |
\or% |
| 887 |
\def\luameshval@mp@mode{ext}% |
| 888 |
\fi% |
| 889 |
}% |
| 890 |
%% the mode for the generation of gridpoints |
| 891 |
\define@choicekey*{meshPolygon}{gridpoints}[\val\nr]{rect, perturb}{% |
| 892 |
\ifcase\nr\relax% |
| 893 |
\def\luameshval@mp@gridpoints{rect}% |
| 894 |
\or% |
| 895 |
\def\luameshval@mp@gridpoints{perturb}% |
| 896 |
\fi% |
| 897 |
}% |
| 898 |
%% the different steps of the meshing |
| 899 |
\define@choicekey*{meshPolygon}{step}[\val\nr]{polygon, grid, points, mesh}{% |
| 900 |
\ifcase\nr\relax% |
| 901 |
\def\luameshval@mp@step{polygon}% |
| 902 |
\or% |
| 903 |
\def\luameshval@mp@step{grid}% |
| 904 |
\or% |
| 905 |
\def\luameshval@mp@step{points}% |
| 906 |
\or% |
| 907 |
\def\luameshval@mp@step{mesh}% |
| 908 |
\fi% |
| 909 |
}% |
| 910 |
|
| 911 |
%% the name of the color of drawing |
| 912 |
\define@key{meshPolygon}{color}[black]{\def\luameshval@mp@color{#1}}% |
| 913 |
%% the name of the color for the polygon |
| 914 |
\define@key{meshPolygon}{colorPolygon}[red]{\def\luameshval@mp@colorPolygon{#1}}% |
| 915 |
%% thickness |
| 916 |
\define@key{meshPolygon}{thickness}[0.4pt]{\def\luameshval@mp@thickness{#1}}% |
| 917 |
%% polygon thickness |
| 918 |
\define@key{meshPolygon}{thicknessPolygon}[0.4pt]{\def\luameshval@mp@polygonThickness{#1}}% |
| 919 |
%% the name of the color of drawing the bbox |
| 920 |
% |
| 921 |
\presetkeys{meshPolygon}{tikz=false,scale,mode=int,step=mesh,print=none,color,colorPolygon,h,meshpoint,gridpoints=rect,thickness,thicknessPolygon}{}% |
| 922 |
% |
| 923 |
\newcommand{\meshPolygon}[2][]{% |
| 924 |
% #1 : optionnal arguments |
| 925 |
% #2 : the string containing the list of points |
| 926 |
% (x1,y1);(x2,y2);... or the name file containing the points |
| 927 |
\setkeys{meshPolygon}{#1} % |
| 928 |
\def\MeshPoint{\luameshval@mp@meshpoint}% |
| 929 |
\ifKV@meshPolygon@tikz% if we are using tikz |
| 930 |
\directlua{% |
| 931 |
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","\luameshval@mp@thickness","\luameshval@mp@polygonThickness")% |
| 932 |
}% |
| 933 |
\else % we are using MP |
| 934 |
\def\luameshmpcolor{\mpcolor{\luameshval@mp@color}}% |
| 935 |
\def\luameshmpcolorPoly{\mpcolor{\luameshval@mp@colorPolygon}}% |
| 936 |
\directlua{% |
| 937 |
drawMeshPolygonMP("#2","\luameshval@mp@mode","\luameshval@mp@h","\luameshval@mp@step","\luameshval@mp@print","\luameshval@mp@scale","\luameshval@mp@gridpoints","\luameshval@mp@thickness","\luameshval@mp@polygonThickness")% |
| 938 |
}% |
| 939 |
% |
| 940 |
\fi% |
| 941 |
}% |
| 942 |
%%%%%%%%%%%%%%%% the meshPolygonInc command |
| 943 |
%% |
| 944 |
\define@boolkey{meshPolygonInc}{tikz}[true]{}% |
| 945 |
|
| 946 |
%% the scale |
| 947 |
\define@key{meshPolygonInc}{scale}[1cm]{\def\luameshval@mpi@scale{#1}}% |
| 948 |
%% print points |
| 949 |
\define@choicekey*{meshPolygonInc}{print}[\val\nr]{none, points,dotpoints}{% |
| 950 |
\ifcase\nr\relax% |
| 951 |
\def\luameshval@mpi@print{none}% |
| 952 |
\or% |
| 953 |
\def\luameshval@mpi@print{points}% |
| 954 |
\or% |
| 955 |
\def\luameshval@mpi@print{dotpoints}% |
| 956 |
\fi% |
| 957 |
}% |
| 958 |
%% the mode for the generation of gridpoints |
| 959 |
\define@choicekey*{meshPolygonInc}{gridpoints}[\val\nr]{rect, perturb}{% |
| 960 |
\ifcase\nr\relax% |
| 961 |
\def\luameshval@mpi@gridpoints{rect}% |
| 962 |
\or% |
| 963 |
\def\luameshval@mpi@gridpoints{perturb}% |
| 964 |
\fi% |
| 965 |
}% |
| 966 |
%% the name of the point |
| 967 |
\define@key{meshPolygonInc}{meshpoint}[P]{\def\luameshval@mpi@meshpoint{#1}}% |
| 968 |
%% the grid parameter |
| 969 |
\define@key{meshPolygonInc}{h}[0.2]{\def\luameshval@mpi@h{#1}}% |
| 970 |
%% the mode for reading the points |
| 971 |
\define@choicekey*{meshPolygonInc}{mode}[\val\nr]{int, ext}{% |
| 972 |
\ifcase\nr\relax% |
| 973 |
\def\luameshval@mpi@mode{int}% |
| 974 |
\or% |
| 975 |
\def\luameshval@mpi@mode{ext}% |
| 976 |
\fi% |
| 977 |
}% |
| 978 |
%% the different steps of the meshing |
| 979 |
\define@choicekey*{meshPolygonInc}{step}[\val\nr]{polygon, grid, points, mesh}{% |
| 980 |
\ifcase\nr\relax% |
| 981 |
\def\luameshval@mpi@step{polygon}% |
| 982 |
\or% |
| 983 |
\def\luameshval@mpi@step{grid}% |
| 984 |
\or% |
| 985 |
\def\luameshval@mpi@step{points}% |
| 986 |
\or% |
| 987 |
\def\luameshval@mpi@step{mesh}% |
| 988 |
\fi% |
| 989 |
}% |
| 990 |
|
| 991 |
%% the name of the color of drawing |
| 992 |
\define@key{meshPolygonInc}{color}[black]{\def\luameshval@mpi@color{#1}}% |
| 993 |
%% the name of the color for the polygon |
| 994 |
\define@key{meshPolygonInc}{colorPolygon}[red]{\def\luameshval@mpi@colorPolygon{#1}}% |
| 995 |
%% thickness |
| 996 |
\define@key{meshPolygonInc}{thickness}[0.4pt]{\def\luameshval@mpi@thickness{#1}}% |
| 997 |
%% polygon thickness |
| 998 |
\define@key{meshPolygonInc}{polygonThickness}[0.4pt]{\def\luameshval@mpi@polygonThickness{#1}}% |
| 999 |
|
| 1000 |
\presetkeys{meshPolygonInc}{tikz=false,scale,mode=int,step=mesh,print=none,color,colorPolygon,h,meshpoint,gridpoints=rect,thickness,polygonThickness}{}% |
| 1001 |
% |
| 1002 |
\newcommand{\meshPolygonInc}[4][]{% |
| 1003 |
% #1 : optionnal arguments |
| 1004 |
% #2 : the string containing the list of points |
| 1005 |
% (x1,y1);(x2,y2);... or the name file containing the points |
| 1006 |
% #3 : the code to place before the generated one |
| 1007 |
% #4 : the code to place after the generated one |
| 1008 |
\setkeys{meshPolygonInc}{#1} % |
| 1009 |
\def\MeshPoint{\luameshval@mpi@meshpoint}% |
| 1010 |
\ifKV@meshPolygonInc@tikz% if we are using tikz |
| 1011 |
\directlua{% |
| 1012 |
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","\luameshval@mpi@thickness","\luameshval@mpi@polygonThickness")% |
| 1013 |
}% |
| 1014 |
\else % we are using MP |
| 1015 |
\def\luameshmpcolor{\mpcolor{\luameshval@mpi@color}}% |
| 1016 |
\def\luameshmpcolorPoly{\mpcolor{\luameshval@mpi@colorPolygon}}% |
| 1017 |
\directlua{% |
| 1018 |
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","\luameshval@mpi@thickness","\luameshval@mpi@polygonThickness")% |
| 1019 |
}% |
| 1020 |
% |
| 1021 |
\fi% |
| 1022 |
}% |