Première version Voronoi avec MetaPost
[delaunay.git] / luamesh.sty
1 \NeedsTeXFormat{LaTeX2e}%
2 \def\PackageName{luamesh}%
3 \def\fileversion{v0.1}%
4 \def\filedate{2016/11/20}%
5 \ProvidesPackage{luamesh}[\filedate\space\fileversion]%
6 %
7 % package to load
8 \RequirePackage{xkeyval,xcolor,ifthen}%
9 %% one global option: mp or tikz
10 %\newif\ifluameshmp%
11 %\define@key{luamesh.sty}{mp}[]{\luameshmptrue}%
12 %\define@key{luamesh.sty}{tikz}[]{\luameshmpfalse}%
13 %
14 %\RequirePackage{etoolbox} % pour robustifier les commandes
15 %
16 %
17 %\ifluameshmp%
18    \RequirePackage{luamplib}%
19 %\else%
20    \RequirePackage{tikz}%
21 %\fi%
22 %
23 % load the lua code
24 \directlua{require("luamesh.lua")}%
25 %
26 %%
27 % for tikz (default value)
28 % default color for the plot of a global mesh
29 \definecolor{TeXCluaMeshTikZ}{rgb}{0.,0.,0.}
30 % default color for a new element
31 \definecolor{TeXCluaMeshNewTikZ}{rgb}{0.5,0.1,0.1}
32 % defaut color for the background of new element
33 \definecolor{TeXCluaMeshBackTikZ}{rgb}{0.99,0.85,0.85}
34 % default color for circoncircle
35 \definecolor{TeXCluaMeshCircleTikZ}{rgb}{0.1,0.6,0.1}
36 %%
37 %
38 %%%%%%%%%%%%%%%% the buildMesh command
39 %% the user can write code (tikz or MP)
40 %% before and after the generated code
41 \define@boolkey{buildMeshInc}{tikz}[true]{}%
42 %% show the bounding box for delaunay
43 \define@choicekey*{buildMeshInc}{bbox}[\val\nr]{none, show}{%
44   \ifcase\nr\relax%
45   \def\luameshval@bmi@bbox{none}%
46   \or%
47   \def\luameshval@bmi@bbox{bbox}%
48   \fi%
49 }%
50 %% the scale
51 \define@key{buildMeshInc}{scale}[1cm]{\def\luameshval@bmi@scale{#1}}%
52 %% print ponits ?
53 \define@choicekey*{buildMeshInc}{print}[\val\nr]{none, points}{%
54   \ifcase\nr\relax%
55   \def\luameshval@bmi@print{none}%
56   \or%
57   \def\luameshval@bmi@print{points}%
58   \fi%
59 }%
60 %% the name of the point
61 \define@key{buildMeshInc}{meshpoint}[P]{\def\luameshval@bmi@meshpoint{#1}}%
62 %% the mode for reading the points
63 \define@choicekey*{buildMeshInc}{mode}[\val\nr]{int, ext}{%
64   \ifcase\nr\relax%
65   \def\luameshval@bmi@mode{int}%
66   \or%
67   \def\luameshval@bmi@mode{ext}%
68   \fi%
69 }%
70 %% the name of the color of drawing
71 \define@key{buildMeshInc}{color}[black]{\def\luameshval@bmi@color{#1}}%
72 %% the name of the color of drawing the bbox
73 \define@key{buildMeshInc}{colorBbox}[black]{\def\luameshval@bmi@colorbbox{#1}}%
74 %
75 \presetkeys{buildMeshInc}{tikz=false,bbox=none,scale, meshpoint,mode=int,print=none,color,colorBbox}{}%
76 %
77 \newcommand*{\buildMeshBWinc}[4][]{%
78   % #1 : optionnal arguments
79   % #2 : the string containing the list of points
80   %      (x1,y1);(x2,y2);... or the name file containing the points
81   % #3 : the code to place before the generated one
82   % #4 : the code to place after the generated one
83   \setkeys{buildMeshInc}{#1} %
84   \def\MeshPoint{\luameshval@bmi@meshpoint}%
85   \ifKV@buildMeshInc@tikz% if we are using tikz
86   \directlua{%
87     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")%
88   }%
89   \else % we are using MP
90   \mplibcolor{\luameshmpcolor}{\luameshval@bmi@color}%
91   \mplibcolor{\luameshmpcolorBbox}{\luameshval@bmi@colorbbox}%
92   \directlua{%
93     buildMeshMPBWinc("#2","\luaescapestring{\unexpanded{#3}}","\luaescapestring{\unexpanded{#4}}","\luameshval@bmi@mode","\luameshval@bmi@print","\luameshval@bmi@bbox","\luameshval@bmi@scale")%
94   }%
95   %
96   \fi%
97 }%
98 %
99 %%%%%%%%%%%%%%%% the buildMeshBW command
100 %% the code is complete and we don't have any callbacks
101 \define@boolkey{buildMesh}{tikz}[true]{}%
102 %% show the bounding box for delaunay
103 \define@choicekey*{buildMesh}{bbox}[\val\nr]{none, show}{%
104   \ifcase\nr\relax%
105   \def\luameshval@bm@bbox{none}%
106   \or%
107   \def\luameshval@bm@bbox{bbox}%
108   \fi%
109 }%
110 %% the scale
111 \define@key{buildMesh}{scale}[1cm]{\def\luameshval@bm@scale{#1}}%
112 %% print points
113 \define@choicekey*{buildMesh}{print}[\val\nr]{none, points}{%
114   \ifcase\nr\relax%
115   \def\luameshval@bm@print{none}%
116   \or%
117   \def\luameshval@bm@print{points}%
118   \fi%
119 }%
120 %% the name of the point
121 \define@key{buildMesh}{meshpoint}[P]{\def\luameshval@bm@meshpoint{#1}}%
122 %% the mode for reading the points
123 \define@choicekey*{buildMesh}{mode}[\val\nr]{int, ext}{%
124   \ifcase\nr\relax%
125   \def\luameshval@bm@mode{int}%
126   \or%
127   \def\luameshval@bm@mode{ext}%
128   \fi%
129 }%
130 %% the name of the color of drawing
131 \define@key{buildMesh}{color}[black]{\def\luameshval@bm@color{#1}}%
132 %% the name of the color of drawing the bbox
133 \define@key{buildMesh}{colorBbox}[black]{\def\luameshval@bm@colorbbox{#1}}%
134 %
135 \presetkeys{buildMesh}{tikz=false,bbox=none,scale, meshpoint,mode=int,print=none,color,colorBbox}{}%
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")%
146   }%
147   \else % we are using MP
148   \mplibcolor{\luameshmpcolor}{\luameshval@bm@color}%
149   \mplibcolor{\luameshmpcolorBbox}{\luameshval@bm@colorbbox}%
150   \directlua{%
151     buildMeshMPBW("#2","\luameshval@bm@mode","\luameshval@bm@print","\luameshval@bm@bbox","\luameshval@bm@scale")%
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 %% the name of the point
179 \define@key{buildVoronoiInc}{meshpoint}[P]{\def\luameshval@bvi@meshpoint{#1}}%
180 %% the mode for reading the points
181 \define@choicekey*{buildVoronoiInc}{mode}[\val\nr]{int, ext}{%
182   \ifcase\nr\relax%
183   \def\luameshval@bvi@mode{int}%
184   \or%
185   \def\luameshval@bvi@mode{ext}%
186   \fi%
187 }%
188 %% the name of the color of drawing
189 \define@key{buildVoronoiInc}{color}[black]{\def\luameshval@bvi@color{#1}}%
190 %% the name of the color of drawing the bbox
191 \define@key{buildVoronoiInc}{colorBbox}[black]{\def\luameshval@bvi@colorbbox{#1}}%
192 %
193 \presetkeys{buildVoronoiInc}{tikz=false,bbox=none,scale, meshpoint,mode=int,print=none,color,colorBbox}{}%
194 %
195 \newcommand*{\buildVoronoiBWinc}[4][]{%
196   % #1 : optionnal arguments
197   % #2 : the string containing the list of points
198   % (x1,y1);(x2,y2);... or the name file containing the points
199   % #3 : the code to place before the generated one
200   % #4 : the code to place after the generated one
201   \setkeys{buildVoronoiInc}{#1} %
202   \def\MeshPoint{\luameshval@bvi@meshpoint}%
203   \ifKV@buildVoronoiInc@tikz% if we are using tikz
204   \directlua{%
205     buildVoronoiTikZBWinc("#2","\luaescapestring{\unexpanded{#3}}","\luaescapestring{\unexpanded{#4}}","\luameshval@bvi@mode","\luameshval@bvi@print","\luameshval@bvi@bbox","\luameshval@bvi@scale","\luameshval@bvi@color","\luameshval@bvi@colorbbox")%
206   }%
207   \else % we are using MP
208   \mplibcolor{\luameshmpcolor}{\luameshval@bvi@color}%
209   \mplibcolor{\luameshmpcolorBbox}{\luameshval@bvi@colorbbox}%
210   \directlua{%
211     buildVoronoiMPBWinc("#2","\luaescapestring{\unexpanded{#3}}","\luaescapestring{\unexpanded{#4}}","\luameshval@bvi@mode","\luameshval@bvi@print","\luameshval@bvi@bbox","\luameshval@bvi@scale")%
212   }%
213   %
214   \fi%
215 }%
216 %
217 %%%%%%%%%%%%%%%% the buildVoronoiBW command
218 %% the code is complete and we don't have any callbacks
219 \define@boolkey{buildVoronoi}{tikz}[true]{}%
220 %% show the bounding box for delaunay
221 \define@choicekey*{buildVoronoi}{bbox}[\val\nr]{none, show}{%
222   \ifcase\nr\relax%
223   \def\luameshval@bv@bbox{none}%
224   \or%
225   \def\luameshval@bv@bbox{bbox}%
226   \fi%
227 }%
228 %% the scale
229 \define@key{buildVoronoi}{scale}[1cm]{\def\luameshval@bv@scale{#1}}%
230 %% print points
231 \define@choicekey*{buildVoronoi}{print}[\val\nr]{none, points}{%
232   \ifcase\nr\relax%
233   \def\luameshval@bv@print{none}%
234   \or%
235   \def\luameshval@bv@print{points}%
236   \fi%
237 }%
238 %% the name of the point
239 \define@key{buildVoronoi}{meshpoint}[P]{\def\luameshval@bv@meshpoint{#1}}%
240 %% the name of the circum point
241 \define@key{buildVoronoi}{circumpoint}[P]{\def\luameshval@bv@circumpoint{#1}}%
242 %% the mode for reading the points
243 \define@choicekey*{buildVoronoi}{mode}[\val\nr]{int, ext}{%
244   \ifcase\nr\relax%
245   \def\luameshval@bv@mode{int}%
246   \or%
247   \def\luameshval@bv@mode{ext}%
248   \fi%
249 }%
250 %% the mode for reading the points
251 \define@choicekey*{buildVoronoi}{delaunay}[\val\nr]{none, show}{%
252   \ifcase\nr\relax%
253   \def\luameshval@bv@delaunay{none}%
254   \or%
255   \def\luameshval@bv@delaunay{show}%
256   \fi%
257 }%
258 %% the name of the color of drawing
259 \define@key{buildVoronoi}{color}[black]{\def\luameshval@bv@color{#1}}%
260 %% the name of the color of drawing Voronoi
261 \define@key{buildVoronoi}{colorVoronoi}[red]{\def\luameshval@bv@colorVoronoi{#1}}%
262 %% the name of the color of drawing the bbox
263 \define@key{buildVoronoi}{colorBbox}[black]{\def\luameshval@bv@colorbbox{#1}}%
264 %
265 \presetkeys{buildVoronoi}{tikz=false,bbox=none,scale, meshpoint,circumpoint,mode=int,print=none,color,colorVoronoi,colorBbox,delaunay=none}{}%
266 %
267 \newcommand{\buildVoronoiBW}[2][]{%
268   % #1 : optionnal arguments
269   % #2 : the string containing the list of points
270   % (x1,y1);(x2,y2);... or the name file containing the points
271   \setkeys{buildVoronoi}{#1} %
272   \def\MeshPoint{\luameshval@bv@meshpoint}%
273   \def\CircumPoint{\luameshval@bv@circumpoint}%
274   \ifKV@buildVoronoi@tikz% if we are using tikz
275   \directlua{%
276     buildVoronoiTikZBW("#2","\luameshval@bv@mode","\luameshval@bv@print","\luameshval@bv@bbox","\luameshval@bv@scale","\luameshval@bv@color","\luameshval@bv@colorbbox")%
277   }%
278   \else % we are using MP
279   \mplibcolor{\luameshmpcolor}{\luameshval@bv@color}%
280   \mplibcolor{\luameshmpcolorBbox}{\luameshval@bv@colorbbox}%
281   \mplibcolor{\luameshmpcolorVoronoi}{\luameshval@bv@colorVoronoi}%
282   \directlua{%
283     buildVoronoiMPBW("#2","\luameshval@bv@mode","\luameshval@bv@print","\luameshval@bv@bbox","\luameshval@bv@scale","\luameshval@bv@delaunay")%
284   }%
285   %
286   \fi%
287 }%
288 %
289 %
290 %%%%%%%%%%%%%%%%% the draw Points macro
291 %% plot the list of points given in argument
292 % the engine
293 \define@boolkey{drawPoints}{tikz}[true]{}%
294 %% show the bounding box for delaunay
295 \define@choicekey*{drawPoints}{bbox}[\val\nr]{none, show}{%
296   \ifcase\nr\relax%
297   \def\luameshval@tp@bbox{none}%
298   \or%
299   \def\luameshval@tp@bbox{bbox}%
300   \fi%
301 }%
302 %% the scale
303 \define@key{drawPoints}{scale}[1cm]{\def\luameshval@tp@scale{#1}}%
304 %% print points
305 \define@choicekey*{drawPoints}{print}[\val\nr]{none, points}{%
306   \ifcase\nr\relax%
307   \def\luameshval@tp@print{none}%
308   \or%
309   \def\luameshval@tp@print{points}%
310   \fi%
311 }%
312 %% the name of the point
313 \define@key{drawPoints}{meshpoint}[P]{\def\luameshval@tp@meshpoint{#1}}%
314 %% the mode for reading the points
315 \define@choicekey*{drawPoints}{mode}[\val\nr]{int, ext}{%
316   \ifcase\nr\relax%
317   \def\luameshval@tp@mode{int}%
318   \or%
319   \def\luameshval@tp@mode{ext}%
320   \fi%
321 }%
322 %% the name of the color of drawing
323 \define@key{drawPoints}{color}[black]{\def\luameshval@tp@color{#1}}%
324 %% the name of the color of drawing the bbox
325 \define@key{drawPoints}{colorBbox}[black]{\def\luameshval@tp@colorbbox{#1}}%
326 %
327 \presetkeys{drawPoints}{tikz=false,bbox=none,scale, meshpoint,mode=int,print=none,color,colorBbox}{}%
328 %
329 \newcommand{\drawPointsMesh}[2][]{%
330   % #1 : optionnal arguments
331   % #2 : the string containing the list of points
332   % (x1,y1);(x2,y2);... or the name file containing the points
333   \setkeys{drawPoints}{#1} %
334   \def\MeshPoint{\luameshval@tp@meshpoint}%
335   \ifKV@drawPoints@tikz% if we are using tikz
336   \directlua{%
337     printPointsTikZ("#2","\luameshval@tp@mode","\luameshval@tp@print","\luameshval@tp@bbox","\luameshval@tp@scale","\luameshval@tp@color","\luameshval@tp@colorbbox")%
338   }%
339   \else % we are using MP
340   \mplibcolor{\luameshmpcolor}{\luameshval@tp@color}%
341   \mplibcolor{\luameshmpcolorBbox}{\luameshval@tp@colorbbox}%
342   \directlua{%
343     printPointsMP("#2","\luameshval@tp@mode","\luameshval@tp@print","\luameshval@tp@bbox","\luameshval@tp@scale")%
344   }%
345   %
346   \fi%
347 }%
348 %
349
350 %%%%%%%%%%%%%%%% the draw Points macro inc with callbacks
351 %% engine of drawing
352 \define@boolkey{drawPointsInc}{tikz}[true]{}%
353 %% show the bounding box for delaunay
354 \define@choicekey*{drawPointsInc}{bbox}[\val\nr]{none, show}{%
355   \ifcase\nr\relax%
356   \def\luameshval@tpi@bbox{none}%
357   \or%
358   \def\luameshval@tpi@bbox{bbox}%
359   \fi%
360 }%
361 %% the scale
362 \define@key{drawPointsInc}{scale}[1cm]{\def\luameshval@tpi@scale{#1}}%
363 %% print points
364 \define@choicekey*{drawPointsInc}{print}[\val\nr]{none, points}{%
365   \ifcase\nr\relax%
366   \def\luameshval@tpi@print{none}%
367   \or%
368   \def\luameshval@tpi@print{points}%
369   \fi%
370 }%
371 %% the name of the point
372 \define@key{drawPointsInc}{meshpoint}[P]{\def\luameshval@tpi@meshpoint{#1}}%
373 %% the mode for reading the points
374 \define@choicekey*{drawPointsInc}{mode}[\val\nr]{int, ext}{%
375   \ifcase\nr\relax%
376   \def\luameshval@tpi@mode{int}%
377   \or%
378   \def\luameshval@tpi@mode{ext}%
379   \fi%
380 }%
381 %
382 % color
383 %% the name of the color of drawing
384 \define@key{drawPointsInc}{color}[black]{\def\luameshval@tpi@color{#1}}%
385 %% the name of the color of drawing the bbox
386 \define@key{drawPointsInc}{colorBbox}[black]{\def\luameshval@tpi@colorbbox{#1}}%
387 %
388 \presetkeys{drawPointsInc}{tikz=false,bbox=none,scale, meshpoint,mode=int,print=none,color,colorBbox}{}%
389 %
390 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
391 \newcommand*{\drawPointsMeshinc}[4][]{%
392   % #1 : optionnal arguments
393   % #2 : the string containing the list of points
394   % (x1,y1);(x2,y2);... or the name file containing the points
395   % #3 : the code to place before the generated one
396   % #4 : the code to place after the generated one
397   \setkeys{drawPointsInc}{#1} %
398   \def\MeshPoint{\luameshval@tpi@meshpoint}%
399   \ifKV@drawPointsInc@tikz% if we are using tikz
400   \directlua{%
401     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")%
402   }%
403   \else % we are using MP
404   \mplibcolor{\luameshmpcolor}{\luameshval@tpi@color}%
405   \mplibcolor{\luameshmpcolorBbox}{\luameshval@tpi@colorbbox}%
406   \directlua{%
407     printPointsMPinc("#2","\luaescapestring{\unexpanded{#3}}","\luaescapestring{\unexpanded{#4}}","\luameshval@tpi@mode","\luameshval@tpi@print","\luameshval@tpi@bbox","\luameshval@tpi@scale")%
408   }%
409   \fi%
410 }%
411 %
412 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
413 %% the meshAddOnePointBW commande
414 %%engine of draiwng
415 \define@boolkey{MeshAddOneBW}{tikz}[true]{}%
416 %% the scale
417 \define@key{MeshAddOneBW}{scale}[1cm]{\def\luameshval@ap@scale{#1}}%
418 %% the name of the points
419 \define@key{MeshAddOneBW}{meshpoint}[P]{\def\luameshval@ap@meshpoint{#1}}%
420 %% the name of the new point
421 \define@key{MeshAddOneBW}{newpoint}[P]{\def\luameshval@ap@newpoint{#1}}%
422 %% a complete picture or some code of the engine
423 \define@choicekey*{MeshAddOneBW}{step}[\val\nr]{badtriangles, cavity, newtriangles}{%
424   \ifcase\nr\relax%
425   \def\luameshval@ap@step{badT}%
426   \or%
427   \def\luameshval@ap@step{cavity}%
428   \or%
429   \def\luameshval@ap@step{newT}%
430   \fi%
431 }%
432 % color
433 %% the color of drawing
434 \define@key{MeshAddOneBW}{color}[black]{\def\luameshval@ap@color{#1}}%
435 %% the color of background of new element
436 \define@key{MeshAddOneBW}{colorBack}[black!20]{\def\luameshval@ap@colorback{#1}}%
437 %% the color of new element
438 \define@key{MeshAddOneBW}{colorNew}[red]{\def\luameshval@ap@colornew{#1}}%
439 %% the color of circoncircle
440 \define@key{MeshAddOneBW}{colorCircle}[green]{\def\luameshval@ap@colorcircle{#1}}%
441 %% the name of the color of drawing the bbox
442 \define@key{MeshAddOneBW}{colorBbox}[black]{\def\luameshval@ap@colorbbox{#1}}%
443 %
444 %% a complete picture or some code of the engine
445 \define@choicekey*{MeshAddOneBW}{mode}[\val\nr]{int, ext}{%
446   \ifcase\nr\relax%
447   \def\luameshval@ap@mode{int}%
448   \or%
449   \def\luameshval@ap@mode{ext}%
450   \fi%
451 }%
452 \define@choicekey*{MeshAddOneBW}{bbox}[\val\nr]{none, show}{%
453   \ifcase\nr\relax%
454   \def\luameshval@ap@bbox{none}%
455   \or%
456   \def\luameshval@ap@bbox{bbox}%
457   \fi%
458 }%
459 \presetkeys{MeshAddOneBW}{tikz=false,scale, meshpoint,newpoint,color,colorBack,colorNew,colorCircle,step=badtriangles,mode=int,bbox=none,colorBbox}{}%
460 %
461 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
462 \newcommand*{\meshAddPointBW}[3][]{%
463   % #1 : optionnal arguments
464   % #2 : the string containing the list of points
465   % (x1,y1);(x2,y2);... or the name file containing the points
466   \setkeys{MeshAddOneBW}{#1} %
467   \def\MeshPoint{\luameshval@ap@meshpoint}%
468   \def\NewPoint{\luameshval@ap@newpoint}%
469   \ifKV@MeshAddOneBW@tikz% if we are using tikz
470   \directlua{%
471     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")%
472   }%
473   \else % we are using MP
474   \mplibcolor{\luameshmpcolor}{\luameshval@ap@color}
475   \mplibcolor{\luameshmpcolorBack}{\luameshval@ap@colorback}
476   \mplibcolor{\luameshmpcolorNew}{\luameshval@ap@colornew}
477   \mplibcolor{\luameshmpcolorCircle}{\luameshval@ap@colorcircle}
478   \mplibcolor{\luameshmpcolorBbox}{\luameshval@ap@colorbbox}
479   \directlua{%
480     TeXOnePointMPBW("#2","#3","\luameshval@ap@step","\luameshval@ap@scale","\luameshval@ap@mode","\luameshval@ap@bbox")%
481   }%
482   %
483   \fi%
484 }%
485 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
486 %%% the meshAddPointBWinc commande with callbacks
487 %% engine of drawing
488 \define@boolkey{MeshAddOneBWinc}{tikz}[true]{}%
489 %% the scale
490 \define@key{MeshAddOneBWinc}{scale}[1cm]{\def\luameshval@api@scale{#1}}%
491 %% the name of the points
492 \define@key{MeshAddOneBWinc}{meshpoint}[P]{\def\luameshval@api@meshpoint{#1}}%
493 %% the name of the new point
494 \define@key{MeshAddOneBWinc}{newpoint}[P]{\def\luameshval@api@newpoint{#1}}%
495 %% a complete picture or some code of the engine
496 \define@choicekey*{MeshAddOneBWinc}{step}[\val\nr]{badtriangles, cavity, newtriangles}{%
497   \ifcase\nr\relax%
498   \def\luameshval@api@step{badT}%
499   \or%
500   \def\luameshval@api@step{cavity}%
501   \or%
502   \def\luameshval@api@step{newT}%
503   \fi%
504 }%
505 % color
506 %% the color of drawing
507 \define@key{MeshAddOneBWinc}{color}[black]{\def\luameshval@api@color{#1}}%
508 %% the color of background of new element
509 \define@key{MeshAddOneBWinc}{colorBack}[black!20]{\def\luameshval@api@colorback{#1}}%
510 %% the color of new element
511 \define@key{MeshAddOneBWinc}{colorNew}[red]{\def\luameshval@api@colornew{#1}}%
512 %% the color of circoncircle
513 \define@key{MeshAddOneBWinc}{colorCircle}[green]{\def\luameshval@api@colorcircle{#1}}%
514 \define@key{MeshAddOneBWinc}{colorBbox}[black]{\def\luameshval@api@colorbbox{#1}}%
515 %
516 %% a complete picture or some code of the engine
517 \define@choicekey*{MeshAddOneBWinc}{mode}[\val\nr]{int, ext}{%
518   \ifcase\nr\relax%
519   \def\luameshval@api@mode{int}%
520   \or%
521   \def\luameshval@api@mode{ext}%
522   \fi%
523 }%
524 \define@choicekey*{MeshAddOneBWinc}{bbox}[\val\nr]{none, show}{%
525   \ifcase\nr\relax%
526   \def\luameshval@api@bbox{none}%
527   \or%
528   \def\luameshval@api@bbox{bbox}%
529   \fi%
530 }%
531 \presetkeys{MeshAddOneBWinc}{tikz=false,scale, meshpoint,newpoint,color,colorBack,colorNew,colorCircle,step=badtriangles,mode=int,bbox=none,colorBbox}{}%
532 %
533 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
534 \newcommand*{\meshAddPointBWinc}[5][]{%
535   % #1 : optionnal arguments
536   % #2 : the string containing the list of points
537   % (x1,y1);(x2,y2);... or the name file containing the points
538   % #3 : the code to place before the generated one
539   % #4 : the code to place after the generated one
540   \setkeys{MeshAddOneBWinc}{#1} %
541   \def\MeshPoint{\luameshval@api@meshpoint}%
542   \def\NewPoint{\luameshval@api@newpoint}%
543   \ifKV@MeshAddOneBWinc@tikz% if we are using tikz
544   \directlua{%
545     TeXOnePointTikZBWinc("#2","#3","\luaescapestring{\unexpanded{#4}}","\luaescapestring{\unexpanded{#5}}","\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")%
546   }%
547   \else % we are using MP
548   \mplibcolor{\luameshmpcolor}{\luameshval@api@color}
549   \mplibcolor{\luameshmpcolorBack}{\luameshval@api@colorback}
550   \mplibcolor{\luameshmpcolorNew}{\luameshval@api@colornew}
551   \mplibcolor{\luameshmpcolorCircle}{\luameshval@api@colorcircle}
552   \mplibcolor{\luameshmpcolorBbox}{\luameshval@api@colorbbox}
553   \directlua{%
554     TeXOnePointMPBWinc("#2","#3","\luaescapestring{\unexpanded{#4}}","\luaescapestring{\unexpanded{#5}}","\luameshval@api@step","\luameshval@api@scale","\luameshval@api@mode","\luameshval@api@bbox")%
555   }%
556   %
557   \fi%
558 }%
559 %

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.