From 4d0c22ee19d3a09c266eadd4daf7d5064aff1b06 Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Tue, 12 Jul 2022 03:00:52 +0000 Subject: CTAN sync 202207120300 --- macros/luatex/latex/luamesh/README | 9 +- macros/luatex/latex/luamesh/doc/biblio.bib | 54 +++-- macros/luatex/latex/luamesh/doc/dum.tex | 6 - .../luatex/latex/luamesh/doc/luamesh-doc.listing | 84 -------- macros/luatex/latex/luamesh/doc/luamesh-doc.pdf | Bin 173181 -> 197905 bytes macros/luatex/latex/luamesh/doc/luamesh-doc.tex | 152 +++++++++++--- macros/luatex/latex/luamesh/doc/luameshdoc.cls | 7 +- macros/luatex/latex/luamesh/metapost/luamesh.mp | 22 ++ .../luatex/latex/luamesh/scripts/luamesh-tex.lua | 233 +++++++++++---------- macros/luatex/latex/luamesh/tex/luamesh.sty | 176 ++++++++++------ 10 files changed, 414 insertions(+), 329 deletions(-) delete mode 100644 macros/luatex/latex/luamesh/doc/dum.tex delete mode 100644 macros/luatex/latex/luamesh/doc/luamesh-doc.listing create mode 100644 macros/luatex/latex/luamesh/metapost/luamesh.mp (limited to 'macros/luatex') diff --git a/macros/luatex/latex/luamesh/README b/macros/luatex/latex/luamesh/README index 926aaf6afd..a2169fe803 100644 --- a/macros/luatex/latex/luamesh/README +++ b/macros/luatex/latex/luamesh/README @@ -1,6 +1,6 @@ -*- coding: utf-8 -*- luamesh package by Maxime Chupin -Version 0.6 dated 2020/06/06 +Version 0.7 dated 2022/07/08 The LuaLaTeX package luamesh allows to compute and draw 2D Delaunay triangulation. The algorithm is written with lua, and depending on the choice of the “engine”, @@ -22,8 +22,6 @@ FILES : README animation-crop.pdf biblio.bib -dum.bbl -dum.tex fond.mp fond.pdf luameshdoc.cls @@ -43,6 +41,9 @@ luamesh-tex.lua ===== Files for LuaLaTeX ===== luamesh.sty + +===== File for MetaPost +luamesh.mp ================== -The archive luamesh-v0-6.zip contains all the files to insert into your texmf. +The archive luamesh-v0-7.zip contains all the files to insert into your texmf. diff --git a/macros/luatex/latex/luamesh/doc/biblio.bib b/macros/luatex/latex/luamesh/doc/biblio.bib index 4d7ab75ef2..bf836cc55a 100644 --- a/macros/luatex/latex/luamesh/doc/biblio.bib +++ b/macros/luatex/latex/luamesh/doc/biblio.bib @@ -35,32 +35,36 @@ Pages = {848}, Url = {http://dx.doi.org/10.1002/9780470611166} } - -@Manual{luamplib, - Title = {luamplib – Use LuaTeX's built-in METAPOST interpreter}, - Author = {Hagen, Hans and Hoekwater, Taco and Roux, Élie and Pégourié-Gonnard, Manuel and Gesang, Philipp and Kim, Dohyun}, - Note = {v. 2.11.3}, - Year = {2016}, - - Owner = {chupin}, - Timestamp = {2016.11.28} +@manual{luamplib, +title = {The Luamplib package}, +subtitle = {Use Lua\TeX{}’s built-in MetaPost interpreter}, +author = {Gesang, Philipp and Hagen, Hans and Roux, Élie and Kim, Dohyun and Hoekwater, Taco and Pégourié-Gonnard, Manuel}, +url = {https://ctan.org/pkg/luamplib}, +urldate = {2022-07-11}, +date = {2022-01-12}, +version = {2.23.0}, } -@Manual{animate, - Title = {The animate Package}, - Author = {Grahn, Alexander}, - Note = {}, - Year = {2016}, + +@manual{animate, +title = {The Animate package}, +subtitle = {Create PDF and SVG animations from graphics files and inline graphics}, +author = {Grahn, Alexander}, +url = {https://ctan.org/pkg/animate}, +urldate = {2022-07-11}, +date = {2022-02-21}, +version = {}, } @Manual{tikz, - Title = {pgf – Create PostScript and PDF graphics in TeX}, - Author = {Tantau, Till and Feuersänger, Christian}, - Note = {v. 3.0.1a}, - Year = {2015}, - +title = {The Pgf package}, +subtitle = {Create PostScript and PDF graphics in \TeX}, +author = {Menke, Henri and {The PGF/TikZ Team} and Feuersänger, Christian and Tantau, Till}, + Year = {2022}, + url = {https://ctan.org/pkg/pgf}, Owner = {chupin}, - Timestamp = {2016.11.28} + Timestamp = {2022-07-11}, + version = {3.1.9a}, } @Manual{gmsh, Title = {Gmsh Reference Manual}, @@ -90,3 +94,13 @@ Mrnumber = {619577}, Url = {http://dx.doi.org/10.1093/comjnl/24.2.167} } + +@manual{tkzeuclide, +title = {The Tkz-euclide package}, +subtitle = {Tools for drawing Euclidean geometry}, +author = {Matthes, Alain}, +url = {http://altermundus.fr}, +urldate = {2022-07-11}, +date = {2022-02-25}, +version = {4.051b}, +} diff --git a/macros/luatex/latex/luamesh/doc/dum.tex b/macros/luatex/latex/luamesh/doc/dum.tex deleted file mode 100644 index 19753f3926..0000000000 --- a/macros/luatex/latex/luamesh/doc/dum.tex +++ /dev/null @@ -1,6 +0,0 @@ -\documentclass{article} -\begin{document} -\nocite{*} -\bibliography{biblio} -\bibliographystyle{plain} -\end{document} \ No newline at end of file diff --git a/macros/luatex/latex/luamesh/doc/luamesh-doc.listing b/macros/luatex/latex/luamesh/doc/luamesh-doc.listing deleted file mode 100644 index e2c890627d..0000000000 --- a/macros/luatex/latex/luamesh/doc/luamesh-doc.listing +++ /dev/null @@ -1,84 +0,0 @@ - \documentclass{article} - %% lualatex compilation - \usepackage[margin=2.5cm]{geometry} - \usepackage{luamesh} - \usepackage{fontspec} - \usepackage{multido} - \pagestyle{empty} - \def\drawPath{draw (-2,-2)*u--(8,-2)*u--(8,6)*u--(-2,6)*u--cycle withcolor 0.99white;} - \def\clipPath{clip currentpicture to (-2,-2)*u--(8,-2)*u--(8,6)*u--(-2,6)*u--cycle;} - \begin{document} - \drawPointsMeshinc[mode=ext, bbox = show,colorBbox = blue!20,print=points]{mesh.txt}% - {% - beginfig(0); - \drawPath - }% - {% - \clipPath - endfig; - } - \newpage\buildMeshBWinc[mode=ext,bbox = show,colorBbox = blue!20,print=points]{meshInit.txt}% - {% - beginfig(0); - \drawPath - }% - {% - \clipPath - endfig; - } - \multido{\ii=5+1}{4}{% - \newpage\meshAddPointBWinc[mode=ext,step=badtriangles,colorNew - =green!20!red,colorBack=red!10,colorCircle = blue,bbox = - show,colorBbox = blue!20]{mesh.txt}{\ii}% - {% - beginfig(0); - \drawPath - }% - {% - \clipPath - endfig; - } \newpage - \meshAddPointBWinc[mode=ext,step=cavity,colorNew - =green!20!red,colorBack=red!10,colorCircle = blue,bbox = - show,colorBbox = blue!20]{mesh.txt}{\ii}% - {% - beginfig(0); - \drawPath - }% - {% - \clipPath - endfig; - } \newpage - \meshAddPointBWinc[mode=ext,step=newtriangles,colorNew - =green!20!red,colorBack=red!10,colorCircle = blue,bbox = - show,colorBbox = blue!20]{mesh.txt}{\ii}% - {% - beginfig(0); - \drawPath - }% - {% - \clipPath - endfig; - } - } - \newpage - \buildMeshBWinc[mode=ext,bbox = show,colorBbox = blue!20,print=points]{mesh.txt}% - {% - beginfig(0); - \drawPath - }% - {% - \clipPath - endfig; - } - \newpage - \buildMeshBWinc[mode=ext,print=points]{mesh.txt}% - {% - beginfig(0); - \drawPath - }% - {% - \clipPath - endfig; - } -\end{document} diff --git a/macros/luatex/latex/luamesh/doc/luamesh-doc.pdf b/macros/luatex/latex/luamesh/doc/luamesh-doc.pdf index 0d66dbf557..e444731ad3 100644 Binary files a/macros/luatex/latex/luamesh/doc/luamesh-doc.pdf and b/macros/luatex/latex/luamesh/doc/luamesh-doc.pdf differ diff --git a/macros/luatex/latex/luamesh/doc/luamesh-doc.tex b/macros/luatex/latex/luamesh/doc/luamesh-doc.tex index 07b6125f0f..25481872b4 100644 --- a/macros/luatex/latex/luamesh/doc/luamesh-doc.tex +++ b/macros/luatex/latex/luamesh/doc/luamesh-doc.tex @@ -18,6 +18,7 @@ \author{Maxime Chupin \email{notezik@gmail.com}} \date{\today} +\addbibresource{biblio.bib} \definecolor{darkred}{rgb}{0.8,0.1,0.1} @@ -137,7 +138,7 @@ \lstset{moredelim=*[s][\color{red}\rmfamily\itshape]{<}{>}} \lstset{moredelim=*[s][\color{blue}\rmfamily\itshape]{<<}{>>}} -\usepackage[colorlinks=true]{hyperref} + \begin{document} %% === Page de garde =================================================== \thispagestyle{empty} @@ -167,7 +168,7 @@ } \vfill \begin{center} - Version 0.6, 2020, June, 6th \\ + Version 0.7, 2022, July, 8th \\ \url{https://plmlab.math.cnrs.fr/mchupin/luamesh} \end{center} %% == Page de garde ==================================================== @@ -186,14 +187,18 @@ set of points, or a particular step of the algorithm. \end{abstract} -I would like to thank Jean-Michel Sarlat, who hosts the development -with a git project on the \Verb+melusine+ machine: +I would like to thank Jean-Michel Sarlat, who hosts first the development +with a git project on the \Verb+melusine+ machine. Now the project is hosted +here : \begin{center} - \url{https://melusine.eu.org/syracuse/G/delaunay/} + \url{https://plmlab.math.cnrs.fr/mchupin/luamesh} \end{center} I would also like to thank the first user, an intensive \emph{test} user, and a very kind English corrector: Nicole Spillane. +For the references of the algorithm, see~\cite{Bowyer,Watson} and a reference about +mesh is~\cite{Frey}. + \tableofcontents @@ -206,10 +211,6 @@ your distribution. \url{https://www.ctan.org/pkg/luamesh} \end{center} -Of course, you can just put the two files \Verb+luamesh.lua+ and -\Verb+luamesh.sty+ in the working directory but this is not -recommended. - \subsection{With \TeX live and Linux or Mac OSX} @@ -225,12 +226,15 @@ Then place the files in the correct directories. The \begin{center} \Verb+~/texmf/tex/latex/luamesh/+ \end{center} -and the \Verb+luamesh.lua+, the \Verb+luamesh-tex.lua+ and the +the \Verb+luamesh.lua+, the \Verb+luamesh-tex.lua+ and the \Verb-luamesh-polygon.lua+ files must be in directory: \begin{center} \Verb+~/texmf/scripts/luamesh/+ \end{center} - +and the \Verb+luamesh.mp+ file must be in directory: +\begin{center} + \Verb+~/texmf/metapost/luamesh/+ +\end{center} Once you have done this, \luamesh can be included in your document with \begin{latexcode} @@ -262,9 +266,9 @@ This package is built upon two main existing packages that one used to draw the triangulations : \begin{enumerate} -\item \Verb+luamplib+ to use MetaPost via the \luatex library +\item \Verb+luamplib+ to use MetaPost~\cite{luamplib} via the \luatex library \Verb+mplib+; -\item \Verb+tikz+. +\item \Verb+tikz+~\cite{tikz}. \end{enumerate} We will see how to choose between these two \emph{drawing engines}. Moreover, the following packages are necessary: @@ -285,7 +289,7 @@ dimensional triangulations (or meshes). \commande|\buildMeshBW[«options»]{«list of points» or «file name»}|\medskip This macro produces the Delaunay triangulation (using the Bowyer and -Watson algorithm) of the given \meta{list of points}. The list of +Watson algorithm, \cite[Bowyer]) of the given \meta{list of points}. The list of points must be given in the following way : \begin{center} \verb+(x1,y1);(x2,y2);(x3,y3);...;(xn,yn)+ @@ -339,6 +343,9 @@ xn yn the scale at which the picture is drawn (the same for both axes). It must contain the unit of length (cm, pt, etc.). +\item[thickness = \meta{value} (default: 0.4pt):] The thickness option defines + the thickness of the lines. It must contain the unit of length (cm, + pt, etc.). \end{optionsenum} To illustrate the options, let us show you an example. We consider a @@ -362,6 +369,7 @@ file \Verb+mesh.txt+: print = points, meshpoint = x, scale = 1.3cm, + thickness = 1pt ]{mesh.txt} \end{Exemple} @@ -541,6 +549,16 @@ ignored. the scale at which the picture is drawn (the same for both axis). It must contain the unit of length (cm, pt, etc.). + \item[thickness = \meta{value} (default: 0.4pt):] The thickness option defines + the thickness of the lines for the mesh. It must contain the unit of length (cm, + pt, etc.). +\item[thicknessNew = \meta{value} (default: 0.4pt):] The thickness option defines + the thickness of the lines for the polygon and the \emph{new} elements. It + must contain the unit of length (cm, + pt, etc.). +\item[thicknessCircle = \meta{value} (default: 0.4pt):] The thickness option defines + the thickness of the lines of the circles. It must contain the unit of length (cm, + pt, etc.). \end{optionsenum} Here is an example of customizing the drawing. First, recall that @@ -568,7 +586,11 @@ We draw the addition of the 6th point. The 7th line will be ignored. colorBbox = black!20, bbox = show, scale=1.4cm, - step=badtriangles] + step=badtriangles, + thickness=0.2pt, + thicknessCircle=1pt, + thicknessNew=3pt % useless because this step + ] {mesh.txt}{6} \end{Exemple} @@ -653,6 +675,12 @@ xn yn allows to specify the mode of generation of the grid points. The value \Verb+rect+ produces a simple rectangular grid, and the value \Verb+pertub+ randomly perturbs the rectangular grid. +\item[thickness = \meta{value} (default: 0.4pt):] The thickness option defines + the thickness of the lines of the mesh. It must contain the unit of length (cm, + pt, etc.). +\item[thicknessPolygon = \meta{value} (default: 0.4pt):] The thickness option defines + the thickness of the lines of the polygon. It must contain the unit of length (cm, + pt, etc.). \end{optionsenum} Here is an example of customizing the drawing. @@ -665,7 +693,9 @@ Here is an example of customizing the drawing. scale=4cm, step=mesh, print=points, - gridpoints=perturb] + gridpoints=perturb, + thickness=0.5pt, + thicknessPolygon=1pt] {(0,0);(1,0);(1,0.5);(0,0.5);(-0.20,0.35);(-0.25,0.25);(-0.20,0.15)} \end{Exemple} @@ -675,7 +705,8 @@ Here is an example of customizing the drawing. The three macros presented in the above sections have complementary macros, with the suffix \Verb+inc+ that allow the user to add code (MetaPost or \Verb+tikz+, depending of the drawing engine) before and -after the code generated by \luamesh. +after the code generated by \luamesh. These commands have the same options as +the non \emph{inc} one. The three macros are:\medskip @@ -775,7 +806,8 @@ color = red, colorBbox = blue!30, print = points, meshpoint = x, -scale=0.8cm +scale=0.8cm, +thickness = 1.4pt ]{(0.3,0.3);(1.5,1);(4,0);(4.5,2.5);(1.81,2.14);(2.5,0.5);(2.8,1.5)}% {% code before beginfig(0); @@ -876,7 +908,8 @@ code given by \meta{code colorBbox = blue!30, print = points, meshpoint = x, - scale=0.8cm + scale=0.8cm, + thickness=1pt ]{(0.3,0.3);(1.5,1);(4,0);(4.5,2.5);(1.81,2.14);(2.5,0.5);(2.8,1.5)}% {% code before } @@ -887,7 +920,7 @@ code given by \meta{code \section{Voronoï Diagrams} -Another interesting feature of b Delaunay triangulation is that its +Another interesting feature of the Delaunay triangulation is that its \emph{dual} is the so-called Voronoï diagram. More precisely, for a finite set of points $\{p_{1},\ldots, p_{n}\}$ in the Euclidean plane, the Voronoï @@ -936,11 +969,11 @@ xn yn triangulation. By default, these points are removed at the end of the algorithm. \item[color = \meta{value} (default: black):] The color of the - drawing. + drawing of the Delaunay mesh. \item[colorBbox = \meta{value} (default: black):] The color of the drawing for the elements (points and triangles) belonging to the bounding box. -\item[colorVoronoi = \meta{value} (default: black):] The color of the +\item[colorVoronoi = \meta{value} (default: red):] The color of the drawing for the elements (points and polygons) belonging to the Voronoï diagram. \item[print = none (default) \textme{or} points:] To label the @@ -970,17 +1003,28 @@ xn yn allows to draw the Delaunay triangulation in dashed lines. \item[styleVoronoi = none (default) \textme{or} dashed:] This option allows to draw the Voronoï edges in dashed lines. +\item[thickness = \meta{value} (default: 0.4pt):] The thickness option defines + the thickness of the lines of the mesh (if plotted). It must contain the unit of length (cm, + pt, etc.). +\item[thicknessVoronoi = \meta{value} (default: 0.4pt):] The thickness option defines + the thickness of the lines of the Voronoï diagram. It must contain the unit of length (cm, + pt, etc.). \end{optionsenum} \begin{Exemple} - \buildVoronoiBW[tikz,delaunay=show,styleDelaunay=dashed] + \buildVoronoiBW[tikz, + delaunay=show, + styleDelaunay=dashed, + thickness = 1pt, + thicknessVoronoi=2pt] {(0.3,0.3);(1.5,1);(4,0);(4.5,2.5);(1.81,2.14);(2.5,0.5);(2.8,1.5);(0.1,2);(1.5,-0.3)} \end{Exemple} \subsection{The \emph{inc} variant} Once again, a variant of the macros is available allowing the user to -add code before and after the code produced by \luamesh. We refer to +add code before and after the code produced by \luamesh (with the same options +as the non \emph{inc} command). We refer to section~\ref{sec:inc} because it works the same way. Let us note that: @@ -1001,7 +1045,7 @@ available (see~\ref{sec:mpcolor}): \Verb+\luameshmpcolorVoronoi+. \section{With Gmsh} -Gmsh is an open source efficient software that produces meshes. The +Gmsh~\cite{gmsh} is an open source efficient software that produces meshes. The exporting format is the \emph{MSH ASCII file format} and can be easily read by a Lua program. \luamesh provides the user with dedicated macros to read and draw meshes coming from a Gmsh exportation.\bigskip @@ -1045,10 +1089,13 @@ There are several options to customize the drawing. the scale at which the picture is drawn (the same for both axes). It must contain the unit of length (cm, pt, etc.). +\item[thickness = \meta{value} (default: 0.4pt):] The thickness option defines + the thickness of the lines of the mesh. It must contain the unit of length (cm, + pt, etc.). \end{optionsenum} Here is an example: \begin{Exemple} - \drawGmsh[scale=2cm,print=points, color=blue!30]{maillage.msh} + \drawGmsh[scale=2cm,print=points, color=blue!30,thickness=0.8pt]{maillage.msh} \end{Exemple} \subsection{Gmsh and Voronoï Diagrams} @@ -1069,8 +1116,8 @@ Voronoï diagram. This is done by the following macro:\bigskip There are several options to customize the drawing. \begin{optionsenum} \item[color = \meta{value} (default: black):] The color of the - drawing. -\item[colorVoronoi = \meta{value} (default: black):] The color of the + drawing of the Delaunay mesh. +\item[colorVoronoi = \meta{value} (default: red):] The color of the drawing for the elements (points and polygons) belonging to the Voronoï diagram. \item[print = none (default) \textme{or} points:] To label the vertices of the @@ -1100,16 +1147,28 @@ There are several options to customize the drawing. allows to draw the Delaunay triangulation in dashed lines. \item[styleVoronoi = none (default) \textme{or} dashed] This option allows to draw the Voronoï edges in dashed lines. +\item[thickness = \meta{value} (default: 0.4pt):] The thickness option defines + the thickness of the lines of the mesh (if plotted). It must contain the unit of length (cm, + pt, etc.). +\item[thicknessVoronoi = \meta{value} (default: 0.4pt):] The thickness option defines + the thickness of the lines of the Voronoï diagram. It must contain the unit of length (cm, + pt, etc.). \end{optionsenum} \begin{Exemple} - \gmshVoronoi[tikz,scale=3cm, delaunay=show,styleVoronoi=dashed]{maillagev4.msh} + \gmshVoronoi[tikz, + scale=4cm, + delaunay=show, + styleVoronoi=dashed, + thickness=0.4pt, + thicknessVoronoi=2pt + ]{maillagev4.msh} \end{Exemple} \subsection{The \emph{inc} variants} -Once again, there exist \emph{inc} variant macros:\bigskip +Once again, there exist \emph{inc} variant macros (with the same options):\bigskip \commande|\drawGmshinc[«options»]{«file name»}{«code before»}{«code after»}|\medskip @@ -1118,13 +1177,38 @@ Once again, there exist \emph{inc} variant macros:\bigskip We refer to the previous sections for explanations. +\section{\texttt{mplibcode} environments} + +All the \Verb+mplibcode+ environments produced by this package use instance +mechanism provided by the \Verb+luamplib+ package~\cite{luamplib}. The name of +the instance is \verb+luamesh+. + +\subsection{A MetaPost package} + +This package comes with a \Verb+luamesh.mp+ file. This file provide for the +moment only one macro to draw circumscribed circles of three points. All of the +\Verb+luamesh+ instances of \Verb+mplibcode+ environments include the MetaPost +\Verb+luamesh.mp+ package. +\bigskip + +\commande|circumcircle(«pair1»,«pair2»,«pair3»)|\medskip + +This macro returns a \Verb+path+: the circumscribed circle passing by the three +argument \Verb+pair+s.\footnote{For the tikz users, we refer to + \texttt{tkz-euclide}~\cite{tkzeuclide} package that provides a large number of tools including + on to draw circumscribed circles.} + +\begin{Exemple} +\buildVoronoiBWinc{(0, 0);(6,0);(2,4);(1.5,2);(2.,0.5);(3,2.6);(3.5,1);(5,3.);(0.3,3.2)}{beginfig(0);}{draw circumcircle(MeshPoints1,MeshPoints2,MeshPoints3);endfig;} +\end{Exemple} + \section{Gallery} \subsection{With Animate} -If you use \emph{Adobe Acrobat reader}, you can easily produce an +If you use \emph{Adobe Acrobat reader} or \emph{Okular}, you can easily produce an animation of the Bowyer and Watson algorithm with the package -\Verb+animate+. +\Verb+animate+~\cite{animate}. For example, the following code (in a file name \Verb+animation.tex+): \begin{latexcode} @@ -1225,6 +1309,8 @@ using the \Verb+animate+ package. \section{History} \begin{itemize} +\item July, 2022, v~0.7, adding of thickness options, creation of the MetaPost + package, and improvement of the documentation. \item June, 6th, 2020, v 0.6, correction of bug produced by the deleted \Verb+\mplibcolor+ function of \Verb+luamplib+ package. \item June, 6th, 2020, v 0.6, add support of version 4 of the @@ -1232,7 +1318,7 @@ using the \Verb+animate+ package. \end{itemize} -\input{dum.bbl} +\printbibliography \end{document} diff --git a/macros/luatex/latex/luamesh/doc/luameshdoc.cls b/macros/luatex/latex/luamesh/doc/luameshdoc.cls index c8d507d329..c7ec2ee3e1 100644 --- a/macros/luatex/latex/luamesh/doc/luameshdoc.cls +++ b/macros/luatex/latex/luamesh/doc/luameshdoc.cls @@ -1,4 +1,4 @@ -% copy of the private class for lualatex-doc, lltxdoc.sty. 2017 version. +% copy of the private class for lualatex-doc, lltxdoc.sty. 2017 version. % see lualatex-doc.tex for copying conditions % Manuel Pégourié-Gonnard @@ -8,8 +8,11 @@ \RequirePackage{luamesh} \RequirePackage{fontspec} \RequirePackage{metalogo, xspace, ifmtarg, xargs, fancyvrb} -\RequirePackage[french,english]{babel} +\RequirePackage[backend=biber,sorting=ynt]{biblatex} +\RequirePackage[english]{babel} + \RequirePackage[colorlinks=true]{hyperref} + %\RequirePackage{bookmark} \defaultfontfeatures{Ligatures=TeX, Scale=MatchLowercase} diff --git a/macros/luatex/latex/luamesh/metapost/luamesh.mp b/macros/luatex/latex/luamesh/metapost/luamesh.mp new file mode 100644 index 0000000000..4e6d3e09e2 --- /dev/null +++ b/macros/luatex/latex/luamesh/metapost/luamesh.mp @@ -0,0 +1,22 @@ +% metapost library for the lualatex package luamesh +% +vardef circumcircle(expr M,N,P)= + % Compute center and radius of the circoncircle of the triangle M N P + save a,b,c,circle,rad,center,x,y; + path circle; + pair center; + numeric a,b,c,x[],y[]; + x1 := xpart M; + y1 := ypart M; + x2 := xpart N; + y2 := ypart N; + x3 := xpart P; + y3 := ypart P; + 2*x1*a+2*y1*b+c=-(x1**2+y1**2); + 2*x2*a+2*y2*b+c=-(x2**2+y2**2); + 2*x3*a+2*y3*b+c=-(x3**2+y3**2); + center := (-a,-b); + rad := sqrt(a**2+b**2-c**2); + circle := fullcircle scaled (2.0*rad) shifted center; + circle +enddef diff --git a/macros/luatex/latex/luamesh/scripts/luamesh-tex.lua b/macros/luatex/latex/luamesh/scripts/luamesh-tex.lua index 34755092ed..2f94b2545b 100644 --- a/macros/luatex/latex/luamesh/scripts/luamesh-tex.lua +++ b/macros/luatex/latex/luamesh/scripts/luamesh-tex.lua @@ -4,7 +4,7 @@ -- AUTHOR: Maxime Chupin ----------------------------------------------------------------------- -- trace Voronoi with MP -function traceVoronoiMP(listPoints, triangulation,listVoronoi, points, tri,styleD,styleV) +function traceVoronoiMP(listPoints, triangulation,listVoronoi, points, tri,styleD,styleV,thickness,thicknessVoronoi) if(styleD == "dashed") then sDelaunay = "dashed evenly" else @@ -31,16 +31,21 @@ function traceVoronoiMP(listPoints, triangulation,listVoronoi, points, tri,style PointJ = listPoints[triangulation[i][2]] PointK = listPoints[triangulation[i][3]] if(triangulation[i].type == "bbox") then - output = output .. "draw (".. PointI.x ..",".. PointI.y ..")*u--("..PointJ.x..",".. PointJ.y ..")*u--("..PointK.x..",".. PointK.y ..")*u--cycle "..sDelaunay.." withcolor \\luameshmpcolorBbox;" + output = output .. "draw (".. PointI.x ..",".. PointI.y + ..")*u--("..PointJ.x..",".. PointJ.y + ..")*u--("..PointK.x..",".. PointK.y ..")*u--cycle"..sDelaunay.." withcolor \\luameshmpcolorBbox withpen pencircle scaled "..thickness..";" else - output = output .. "draw (".. PointI.x ..",".. PointI.y ..")*u--("..PointJ.x..",".. PointJ.y ..")*u--("..PointK.x..",".. PointK.y ..")*u--cycle "..sDelaunay.." withcolor \\luameshmpcolor;" + output = output .. "draw (".. PointI.x ..",".. PointI.y + ..")*u--("..PointJ.x..",".. PointJ.y + ..")*u--("..PointK.x..",".. PointK.y ..")*u--cycle"..sDelaunay.." withcolor \\luameshmpcolor withpen pencircle scaled "..thickness..";" end end end for i=1,#listVoronoi do PointI = listCircumC[listVoronoi[i][1]] PointJ = listCircumC[listVoronoi[i][2]] - output = output .. "draw (".. PointI.x ..",".. PointI.y ..")*u--("..PointJ.x..",".. PointJ.y ..")*u "..sVoronoi.." withcolor \\luameshmpcolorVoronoi;" + output = output .. "draw (".. PointI.x ..",".. PointI.y + ..")*u--("..PointJ.x..",".. PointJ.y ..")*u "..sVoronoi.." withcolor \\luameshmpcolorVoronoi withpen pencircle scaled "..thicknessVoronoi..";" end if(points=="points") then j=1 @@ -75,7 +80,7 @@ end -- trace Voronoi with TikZ -function traceVoronoiTikZ(listPoints, triangulation,listVoronoi, points, tri,color,colorBbox,colorVoronoi,styleD,styleV) +function traceVoronoiTikZ(listPoints, triangulation,listVoronoi, points, tri,color,colorBbox,colorVoronoi,styleD,styleV,thickness,thicknessVoronoi) if(styleD == "dashed") then sDelaunay = ",dashed" else @@ -100,16 +105,16 @@ function traceVoronoiTikZ(listPoints, triangulation,listVoronoi, points, tri,col PointJ = listPoints[triangulation[i][2]] PointK = listPoints[triangulation[i][3]] if(triangulation[i].type == "bbox") then - output = output .. "\\draw[color="..colorBbox..sDelaunay.."] (".. PointI.x ..",".. PointI.y ..")--("..PointJ.x..",".. PointJ.y ..")--("..PointK.x..",".. PointK.y ..")--cycle;" + output = output .. "\\draw[color="..colorBbox..sDelaunay..",line width="..thickness..",rounded corners=0.4pt] (".. PointI.x ..",".. PointI.y ..")--("..PointJ.x..",".. PointJ.y ..")--("..PointK.x..",".. PointK.y ..")--cycle;" else - output = output .. "\\draw[color="..color..sDelaunay.."] (".. PointI.x ..",".. PointI.y ..")--("..PointJ.x..",".. PointJ.y ..")--("..PointK.x..",".. PointK.y ..")--cycle;" + output = output .. "\\draw[color="..color..sDelaunay..",line width="..thickness..",rounded corners=0.4pt] (".. PointI.x ..",".. PointI.y ..")--("..PointJ.x..",".. PointJ.y ..")--("..PointK.x..",".. PointK.y ..")--cycle;" end end end for i=1,#listVoronoi do PointI = listCircumC[listVoronoi[i][1]] PointJ = listCircumC[listVoronoi[i][2]] - output = output .. "\\draw[color="..colorVoronoi..sVoronoi.."] (".. PointI.x ..",".. PointI.y ..")--("..PointJ.x..",".. PointJ.y ..");" + output = output .. "\\draw[color="..colorVoronoi..sVoronoi..",line width="..thicknessVoronoi..",rounded corners=0.4pt] (".. PointI.x ..",".. PointI.y ..")--("..PointJ.x..",".. PointJ.y ..");" end if(points=="points") then j=1 @@ -144,43 +149,43 @@ end -- buildVoronoi with MP -function buildVoronoiMPBW(chaine,mode,points,bbox,scale,tri,styleD,styleV) +function buildVoronoiMPBW(chaine,mode,points,bbox,scale,tri,styleD,styleV,thickness,thicknessVoronoi) local listPoints = buildList(chaine, mode) local triangulation = BowyerWatson(listPoints,bbox) local listVoronoi = buildVoronoi(listPoints, triangulation) - output = traceVoronoiMP(listPoints,triangulation,listVoronoi,points,tri,styleD,styleV) - output = "\\leavevmode\\begin{mplibcode}beginfig(0);u:="..scale.. ";" .. output .."endfig;\\end{mplibcode}" + output = traceVoronoiMP(listPoints,triangulation,listVoronoi,points,tri,styleD,styleV,thickness,thicknessVoronoi) + output = "\\leavevmode\\begin{mplibcode}[luamesh]beginfig(0);u:="..scale.. ";" .. output .."endfig;\\end{mplibcode}" tex.sprint(output) end -- buildVoronoi with TikZ -function buildVoronoiTikZBW(chaine,mode,points,bbox,scale,tri,color,colorBbox,colorVoronoi,styleD,styleV) +function buildVoronoiTikZBW(chaine,mode,points,bbox,scale,tri,color,colorBbox,colorVoronoi,styleD,styleV,thickness,thicknessVoronoi) local listPoints = buildList(chaine, mode) local triangulation = BowyerWatson(listPoints,bbox) local listVoronoi = buildVoronoi(listPoints, triangulation) - output = traceVoronoiTikZ(listPoints,triangulation,listVoronoi,points,tri,color,colorBbox,colorVoronoi,styleD,styleV) + output = traceVoronoiTikZ(listPoints,triangulation,listVoronoi,points,tri,color,colorBbox,colorVoronoi,styleD,styleV,thickness,thicknessVoronoi) output = "\\noindent\\begin{tikzpicture}[x=" .. scale .. ",y=" .. scale .."]" .. output .."\\end{tikzpicture}" tex.sprint(output) end -- buildVoronoi with MP -function buildVoronoiMPBWinc(chaine,beginning, ending,mode,points,bbox,scale,tri,styleD,styleV) +function buildVoronoiMPBWinc(chaine,beginning, ending,mode,points,bbox,scale,tri,styleD,styleV,thickness,thicknessVoronoi) local listPoints = buildList(chaine, mode) local triangulation = BowyerWatson(listPoints,bbox) local listVoronoi = buildVoronoi(listPoints, triangulation) - output = traceVoronoiMP(listPoints,triangulation,listVoronoi,points,tri,styleD,styleV) - output = "\\leavevmode\\begin{mplibcode}u:="..scale..";"..beginning .. output .. ending .. "\\end{mplibcode}" + output = traceVoronoiMP(listPoints,triangulation,listVoronoi,points,tri,styleD,styleV,thickness,thicknessVoronoi) + output = "\\leavevmode\\begin{mplibcode}[luamesh]u:="..scale..";"..beginning .. output .. ending .. "\\end{mplibcode}" tex.sprint(output) end -- buildVoronoi with TikZ -function buildVoronoiTikZBWinc(chaine,beginning, ending,mode,points,bbox,scale,tri,color,colorBbox,colorVoronoi) +function buildVoronoiTikZBWinc(chaine,beginning, ending,mode,points,bbox,scale,tri,color,colorBbox,colorVoronoi,styleD,styleV,thickness,thicknessVoronoi) local listPoints = buildList(chaine, mode,styleD,styleV) local triangulation = BowyerWatson(listPoints,bbox) local listVoronoi = buildVoronoi(listPoints, triangulation) - output = traceVoronoiTikZ(listPoints,triangulation,listVoronoi,points,tri,color,colorBbox,colorVoronoi,styleD,styleV) + output = traceVoronoiTikZ(listPoints,triangulation,listVoronoi,points,tri,color,colorBbox,colorVoronoi,styleD,styleV,thickness,thicknessVoronoi) output = "\\noindent\\begin{tikzpicture}[x=" .. scale .. ",y=" .. scale .."]" ..beginning.. output..ending .."\\end{tikzpicture}" tex.sprint(output) end @@ -188,7 +193,7 @@ end -- trace a triangulation with TikZ -function traceMeshTikZ(listPoints, triangulation,points,color,colorBbox) +function traceMeshTikZ(listPoints, triangulation,points,color,colorBbox,thickness) output = "" for i=1,#listPoints do output = output .. "\\coordinate (MeshPoints".. i .. ") at (" .. listPoints[i].x .. "," .. listPoints[i].y .. ");" @@ -198,19 +203,19 @@ function traceMeshTikZ(listPoints, triangulation,points,color,colorBbox) PointJ = listPoints[triangulation[i][2]] PointK = listPoints[triangulation[i][3]] if(triangulation[i].type == "bbox") then - output = output .. "\\draw[color="..colorBbox.."] (".. PointI.x ..",".. PointI.y ..")--("..PointJ.x..",".. PointJ.y ..")--("..PointK.x..",".. PointK.y ..")--cycle;" + output = output .. "\\draw[color="..colorBbox..",line width="..thickness..",rounded corners=0.4pt] (".. PointI.x ..",".. PointI.y ..")--("..PointJ.x..",".. PointJ.y ..")--("..PointK.x..",".. PointK.y ..")--cycle;" else - output = output .. "\\draw[color="..color.."] (".. PointI.x ..",".. PointI.y ..")--("..PointJ.x..",".. PointJ.y ..")--("..PointK.x..",".. PointK.y ..")--cycle;" + output = output .. "\\draw[color="..color..",line width="..thickness..",rounded corners=0.4pt] (".. PointI.x ..",".. PointI.y ..")--("..PointJ.x..",".. PointJ.y ..")--("..PointK.x..",".. PointK.y ..")--cycle;" end end if(points=="points") then j=1 for i=1,#listPoints do if(listPoints[i].type == "bbox") then - output = output .. "\\draw[color="..colorBbox.."] (" .. listPoints[i].x ..",".. listPoints[i].y .. ") node {$\\bullet$} node[anchor=north east] {$\\MeshPoint^*_{" .. j .. "}$};" + output = output .. "\\draw[color="..colorBbox..",line width="..thickness..",rounded corners=0.4pt] (" .. listPoints[i].x ..",".. listPoints[i].y .. ") node {$\\bullet$} node[anchor=north east] {$\\MeshPoint^*_{" .. j .. "}$};" j=j+1 else - output = output .. "\\draw[color="..color.."] (" .. listPoints[i].x ..",".. listPoints[i].y .. ") node {$\\bullet$} node[anchor=north east] {$\\MeshPoint_{" .. i .. "}$};" + output = output .. "\\draw[color="..color..",line width="..thickness..",rounded corners=0.4pt] (" .. listPoints[i].x ..",".. listPoints[i].y .. ") node {$\\bullet$} node[anchor=north east] {$\\MeshPoint_{" .. i .. "}$};" end end end @@ -230,7 +235,7 @@ end -- trace a triangulation with MP -function traceMeshMP(listPoints, triangulation,points) +function traceMeshMP(listPoints, triangulation,points,thickness) output = ""; output = output .. " pair MeshPoints[];" for i=1,#listPoints do @@ -241,9 +246,13 @@ function traceMeshMP(listPoints, triangulation,points) PointJ = listPoints[triangulation[i][2]] PointK = listPoints[triangulation[i][3]] if(triangulation[i].type == "bbox") then - output = output .. "draw (".. PointI.x ..",".. PointI.y ..")*u--("..PointJ.x..",".. PointJ.y ..")*u--("..PointK.x..",".. PointK.y ..")*u--cycle withcolor \\luameshmpcolorBbox;" + output = output .. "draw (".. PointI.x ..",".. PointI.y + ..")*u--("..PointJ.x..",".. PointJ.y + ..")*u--("..PointK.x..",".. PointK.y ..")*u--cycle withcolor \\luameshmpcolorBbox withpen pencircle scaled "..thickness..";" else - output = output .. "draw (".. PointI.x ..",".. PointI.y ..")*u--("..PointJ.x..",".. PointJ.y ..")*u--("..PointK.x..",".. PointK.y ..")*u--cycle withcolor \\luameshmpcolor;" + output = output .. "draw (".. PointI.x ..",".. PointI.y + ..")*u--("..PointJ.x..",".. PointJ.y + ..")*u--("..PointK.x..",".. PointK.y ..")*u--cycle withcolor \\luameshmpcolor withpen pencircle scaled "..thickness..";" end end if(points=="points") then @@ -273,37 +282,37 @@ end -- buildMesh with MP -function buildMeshMPBW(chaine,mode,points,bbox,scale) +function buildMeshMPBW(chaine,mode,points,bbox,scale,thickness) local listPoints = buildList(chaine, mode) local triangulation = BowyerWatson(listPoints,bbox) - output = traceMeshMP(listPoints, triangulation,points) - output = "\\leavevmode\\begin{mplibcode}beginfig(0);u:="..scale.. ";" .. output .."endfig;\\end{mplibcode}" + output = traceMeshMP(listPoints, triangulation,points,thickness) + output = "\\leavevmode\\begin{mplibcode}[luamesh]beginfig(0);u:="..scale.. ";" .. output .."endfig;\\end{mplibcode}" tex.sprint(output) end -- buildMesh with MP include code -function buildMeshMPBWinc(chaine,beginning, ending,mode,points,bbox,scale) +function buildMeshMPBWinc(chaine,beginning, ending,mode,points,bbox,scale,thickness) local listPoints = buildList(chaine, mode) local triangulation = BowyerWatson(listPoints,bbox) - output = traceMeshMP(listPoints, triangulation,points) - output = "\\leavevmode\\begin{mplibcode}u:="..scale..";"..beginning .. output .. ending .. "\\end{mplibcode}" + output = traceMeshMP(listPoints, triangulation,points,thickness) + output = "\\leavevmode\\begin{mplibcode}[luamesh]u:="..scale..";"..beginning .. output .. ending .. "\\end{mplibcode}" tex.sprint(output) end -- buildMesh with TikZ -function buildMeshTikZBW(chaine,mode,points,bbox,scale,color,colorBbox) +function buildMeshTikZBW(chaine,mode,points,bbox,scale,color,colorBbox,thickness) local listPoints = buildList(chaine, mode) local triangulation = BowyerWatson(listPoints,bbox) - output = traceMeshTikZ(listPoints, triangulation,points,color,colorBbox) + output = traceMeshTikZ(listPoints, triangulation,points,color,colorBbox,thickness) output = "\\noindent\\begin{tikzpicture}[x=" .. scale .. ",y=" .. scale .."]" .. output .."\\end{tikzpicture}" tex.sprint(output) end -- buildMesh with TikZ -function buildMeshTikZBWinc(chaine,beginning, ending,mode,points,bbox,scale,color,colorBbox) +function buildMeshTikZBWinc(chaine,beginning, ending,mode,points,bbox,scale,color,colorBbox,thickness) local listPoints = buildList(chaine, mode) local triangulation = BowyerWatson(listPoints,bbox) - output = traceMeshTikZ(listPoints, triangulation,points,color,colorBbox) + output = traceMeshTikZ(listPoints, triangulation,points,color,colorBbox,thickness) output = "\\noindent\\begin{tikzpicture}[x=" .. scale .. ",y=" .. scale .."]" ..beginning.. output..ending .."\\end{tikzpicture}" tex.sprint(output) end @@ -373,7 +382,7 @@ function printPointsMP(chaine,mode,points,bbox,scale) listPoints = buildBoundingBox(listPoints) end output = tracePointsMP(listPoints,points) - output = "\\leavevmode\\begin{mplibcode}beginfig(0);u:="..scale.. ";" .. output .."endfig;\\end{mplibcode}" + output = "\\leavevmode\\begin{mplibcode}[luamesh]beginfig(0);u:="..scale.. ";" .. output .."endfig;\\end{mplibcode}" tex.sprint(output) end @@ -385,7 +394,7 @@ function printPointsMPinc(chaine,beginning, ending, mode,points,bbox,scale) listPoints = buildBoundingBox(listPoints) end output = tracePointsMP(listPoints,points) - output = "\\leavevmode\\begin{mplibcode}u:="..scale..";"..beginning .. output .. ending .. "\\end{mplibcode}" + output = "\\leavevmode\\begin{mplibcode}[luamesh]u:="..scale..";"..beginning .. output .. ending .. "\\end{mplibcode}" tex.sprint(output) end @@ -422,7 +431,8 @@ end -- -function TeXaddOnePointTikZ(listPoints,P,step,bbox,color,colorBack, colorNew, colorCircle,colorBbox) +function TeXaddOnePointTikZ(listPoints,P,step,bbox,color,colorBack, colorNew, + colorCircle,colorBbox,thickness,thicknessCircle,thicknessAdd) output = "" -- build the triangulation local triangulation = BowyerWatson(listPoints,bbox) @@ -437,9 +447,9 @@ function TeXaddOnePointTikZ(listPoints,P,step,bbox,color,colorBack, colorNew, co PointJ = listPoints[triangulation[i][2]] PointK = listPoints[triangulation[i][3]] if(triangulation[i].type == "bbox") then - output = output .. "\\draw[color="..colorBbox.."] (".. PointI.x ..",".. PointI.y ..")--("..PointJ.x..",".. PointJ.y ..")--("..PointK.x..",".. PointK.y ..")--cycle;" + output = output .. "\\draw[color="..colorBbox..",line width="..thickness.."] (".. PointI.x ..",".. PointI.y ..")--("..PointJ.x..",".. PointJ.y ..")--("..PointK.x..",".. PointK.y ..")--cycle;" else - output = output .. "\\draw[color="..color.."] (".. PointI.x ..",".. PointI.y ..")--("..PointJ.x..",".. PointJ.y ..")--("..PointK.x..",".. PointK.y ..")--cycle;" + output = output .. "\\draw[color="..color..",line width="..thickness.."] (".. PointI.x ..",".. PointI.y ..")--("..PointJ.x..",".. PointJ.y ..")--("..PointK.x..",".. PointK.y ..")--cycle;" end end -- draw and fill the bad triangle @@ -447,7 +457,7 @@ function TeXaddOnePointTikZ(listPoints,P,step,bbox,color,colorBack, colorNew, co PointI = listPoints[triangulation[badTriangles[i]][1]] PointJ = listPoints[triangulation[badTriangles[i]][2]] PointK = listPoints[triangulation[badTriangles[i]][3]] - output = output .. "\\draw[fill="..colorBack.."] (".. PointI.x ..",".. PointI.y ..")--("..PointJ.x..",".. PointJ.y ..")--("..PointK.x..",".. PointK.y ..")--cycle;" + output = output .. "\\draw[fill="..colorBack..",line width="..thickness.."] (".. PointI.x ..",".. PointI.y ..")--("..PointJ.x..",".. PointJ.y ..")--("..PointK.x..",".. PointK.y ..")--cycle;" end -- draw the circoncircle for i=1,#badTriangles do @@ -455,7 +465,7 @@ function TeXaddOnePointTikZ(listPoints,P,step,bbox,color,colorBack, colorNew, co PointJ = listPoints[triangulation[badTriangles[i]][2]] PointK = listPoints[triangulation[badTriangles[i]][3]] center, radius = circoncircle(PointI, PointJ, PointK) - output = output .. "\\draw[dashed, color="..colorCircle.."] ("..center.x .. "," .. center.y .. ") circle ("..radius ..");" + output = output .. "\\draw[dashed, color="..colorCircle..",line width="..thicknessCircle.."] ("..center.x .. "," .. center.y .. ") circle ("..radius ..");" end -- mark the points j=1 @@ -482,9 +492,9 @@ function TeXaddOnePointTikZ(listPoints,P,step,bbox,color,colorBack, colorNew, co PointJ = listPoints[triangulation[i][2]] PointK = listPoints[triangulation[i][3]] if(triangulation[i].type == "bbox") then - output = output .. "\\draw[color="..colorBbox.."] (".. PointI.x ..",".. PointI.y ..")--("..PointJ.x..",".. PointJ.y ..")--("..PointK.x..",".. PointK.y ..")--cycle;" + output = output .. "\\draw[color="..colorBbox..",line width="..thickness.."] (".. PointI.x ..",".. PointI.y ..")--("..PointJ.x..",".. PointJ.y ..")--("..PointK.x..",".. PointK.y ..")--cycle;" else - output = output .. "\\draw[color="..color.."] (".. PointI.x ..",".. PointI.y ..")--("..PointJ.x..",".. PointJ.y ..")--("..PointK.x..",".. PointK.y ..")--cycle;" + output = output .. "\\draw[color="..color..",line width="..thickness.."] (".. PointI.x ..",".. PointI.y ..")--("..PointJ.x..",".. PointJ.y ..")--("..PointK.x..",".. PointK.y ..")--cycle;" end end -- fill and draw the cavity @@ -493,7 +503,7 @@ function TeXaddOnePointTikZ(listPoints,P,step,bbox,color,colorBack, colorNew, co PointI = listPoints[polyNew[i]] path = path .. "(".. PointI.x ..",".. PointI.y ..")--" end - output = output .. "\\draw[color="..colorNew..",fill ="..colorBack..", thick] " .. path .. "cycle;" + output = output .. "\\draw[color="..colorNew..",fill ="..colorBack..",line width="..thicknessAdd.."] " .. path .. "cycle;" -- mark the points of the mesh j=1 for i=1,#listPoints do @@ -519,9 +529,9 @@ function TeXaddOnePointTikZ(listPoints,P,step,bbox,color,colorBack, colorNew, co PointJ = listPoints[triangulation[i][2]] PointK = listPoints[triangulation[i][3]] if(triangulation[i].type == "bbox") then - output = output .. "\\draw[color="..colorBbox.."] (".. PointI.x ..",".. PointI.y ..")--("..PointJ.x..",".. PointJ.y ..")--("..PointK.x..",".. PointK.y ..")--cycle;" + output = output .. "\\draw[color="..colorBbox..",line width="..thickness.."] (".. PointI.x ..",".. PointI.y ..")--("..PointJ.x..",".. PointJ.y ..")--("..PointK.x..",".. PointK.y ..")--cycle;" else - output = output .. "\\draw[color="..color.."] (".. PointI.x ..",".. PointI.y ..")--("..PointJ.x..",".. PointJ.y ..")--("..PointK.x..",".. PointK.y ..")--cycle;" + output = output .. "\\draw[color="..color..",line width="..thickness.."] (".. PointI.x ..",".. PointI.y ..")--("..PointJ.x..",".. PointJ.y ..")--("..PointK.x..",".. PointK.y ..")--cycle;" end end -- fill and draw the cavity @@ -530,12 +540,12 @@ function TeXaddOnePointTikZ(listPoints,P,step,bbox,color,colorBack, colorNew, co PointI = listPoints[polyNew[i]] path = path .. "(".. PointI.x ..",".. PointI.y ..")--" end - output = output .. "\\draw[color="..colorNew..",fill ="..colorBack..", thick] " .. path .. "cycle;" + output = output .. "\\draw[color="..colorNew..",fill ="..colorBack..",line width="..1.1*thickWithoutPT.."pt] " .. path .. "cycle;" -- draw the new triangles composed by the edges of the polygon and the added point for i=1,#polygon do - output = output .. "\\draw[color=TeXCluaMeshNewTikZ, thick]".."(".. listPoints[polygon[i][1]].x .. "," .. listPoints[polygon[i][1]].y .. ") -- (" .. listPoints[polygon[i][2]].x .. "," .. listPoints[polygon[i][2]].y ..");" - output = output .. "\\draw[color="..colorNew..", thick]".."(".. listPoints[polygon[i][1]].x .. "," .. listPoints[polygon[i][1]].y .. ") -- (" .. P.x .. "," .. P.y ..");" - output = output .. "\\draw[color="..colorNew..", thick]".."(".. listPoints[polygon[i][2]].x .. "," .. listPoints[polygon[i][2]].y .. ") -- (" .. P.x .. "," .. P.y ..");" + output = output .. "\\draw[color=TeXCluaMeshNewTikZ,line width="..thicknessAdd.."]".."(".. listPoints[polygon[i][1]].x .. "," .. listPoints[polygon[i][1]].y .. ") -- (" .. listPoints[polygon[i][2]].x .. "," .. listPoints[polygon[i][2]].y ..");" + output = output .. "\\draw[color="..colorNew..",line width="..thicknessAdd.."]".."(".. listPoints[polygon[i][1]].x .. "," .. listPoints[polygon[i][1]].y .. ") -- (" .. P.x .. "," .. P.y ..");" + output = output .. "\\draw[color="..colorNew..",line width="..thicknessAdd.."]".."(".. listPoints[polygon[i][2]].x .. "," .. listPoints[polygon[i][2]].y .. ") -- (" .. P.x .. "," .. P.y ..");" end -- mark points j=1 @@ -553,7 +563,7 @@ function TeXaddOnePointTikZ(listPoints,P,step,bbox,color,colorBack, colorNew, co return output end -function TeXaddOnePointMPBW(listPoints,P,step,bbox) +function TeXaddOnePointMPBW(listPoints,P,step,bbox,thickness,thicknessCircle,thicknessAdd) output = ""; output = output .. "pair MeshPoints[];" -- build the triangulation @@ -571,9 +581,9 @@ function TeXaddOnePointMPBW(listPoints,P,step,bbox) PointJ = listPoints[triangulation[i][2]] PointK = listPoints[triangulation[i][3]] if(triangulation[i].type == "bbox") then - output = output .. "draw (".. PointI.x ..",".. PointI.y ..")*u--("..PointJ.x..",".. PointJ.y ..")*u--("..PointK.x..",".. PointK.y ..")*u--cycle withcolor \\luameshmpcolorBbox;" + output = output .. "draw (".. PointI.x ..",".. PointI.y ..")*u--("..PointJ.x..",".. PointJ.y ..")*u--("..PointK.x..",".. PointK.y ..")*u--cycle withcolor \\luameshmpcolorBbox withpen pencircle scaled"..thickness..";" else - output = output .. "draw (".. PointI.x ..",".. PointI.y ..")*u--("..PointJ.x..",".. PointJ.y ..")*u--("..PointK.x..",".. PointK.y ..")*u--cycle withcolor \\luameshmpcolor;" + output = output .. "draw (".. PointI.x ..",".. PointI.y ..")*u--("..PointJ.x..",".. PointJ.y ..")*u--("..PointK.x..",".. PointK.y ..")*u--cycle withcolor \\luameshmpcolor withpen pencircle scaled"..thickness..";" end end -- draw and fill the bad triangle @@ -581,8 +591,8 @@ function TeXaddOnePointMPBW(listPoints,P,step,bbox) PointI = listPoints[triangulation[badTriangles[i]][1]] PointJ = listPoints[triangulation[badTriangles[i]][2]] PointK = listPoints[triangulation[badTriangles[i]][3]] - output = output .. "draw (".. PointI.x ..",".. PointI.y ..")*u--("..PointJ.x..",".. PointJ.y ..")*u--("..PointK.x..",".. PointK.y ..")*u--cycle withcolor \\luameshmpcolor;" output = output .. "fill (".. PointI.x ..",".. PointI.y ..")*u--("..PointJ.x..",".. PointJ.y ..")*u--("..PointK.x..",".. PointK.y ..")*u--cycle withcolor \\luameshmpcolorBack;" + output = output .. "draw (".. PointI.x ..",".. PointI.y ..")*u--("..PointJ.x..",".. PointJ.y ..")*u--("..PointK.x..",".. PointK.y ..")*u--cycle withcolor \\luameshmpcolor withpen pencircle scaled"..thickness..";" end -- draw the circoncircle for i=1,#badTriangles do @@ -590,7 +600,7 @@ function TeXaddOnePointMPBW(listPoints,P,step,bbox) PointJ = listPoints[triangulation[badTriangles[i]][2]] PointK = listPoints[triangulation[badTriangles[i]][3]] center, radius = circoncircle(PointI, PointJ, PointK) - output = output .. "draw fullcircle scaled ("..radius .."*2u) shifted ("..center.x .. "*u," .. center.y .. "*u) dashed evenly withcolor \\luameshmpcolorCircle;" + output = output .. "draw fullcircle scaled ("..radius .."*2u) shifted ("..center.x .. "*u," .. center.y .. "*u) dashed evenly withcolor \\luameshmpcolorCircle withpen pencircle scaled"..thicknessCircle..";" end -- mark the points j=1 @@ -617,9 +627,9 @@ function TeXaddOnePointMPBW(listPoints,P,step,bbox) PointJ = listPoints[triangulation[i][2]] PointK = listPoints[triangulation[i][3]] if(triangulation[i].type == "bbox") then - output = output .. "draw (".. PointI.x ..",".. PointI.y ..")*u--("..PointJ.x..",".. PointJ.y ..")*u--("..PointK.x..",".. PointK.y ..")*u--cycle withcolor \\luameshmpcolorBbox;" + output = output .. "draw (".. PointI.x ..",".. PointI.y..")*u--("..PointJ.x..",".. PointJ.y ..")*u--("..PointK.x..",".. PointK.y..")*u--cycle withcolor \\luameshmpcolorBbox withpen pencircle scaled"..thickness..";" else - output = output .. "draw (".. PointI.x ..",".. PointI.y ..")*u--("..PointJ.x..",".. PointJ.y ..")*u--("..PointK.x..",".. PointK.y ..")*u--cycle withcolor \\luameshmpcolor;" + output = output .. "draw (".. PointI.x ..",".. PointI.y..")*u--("..PointJ.x..",".. PointJ.y ..")*u--("..PointK.x..",".. PointK.y ..")*u--cycle withcolor \\luameshmpcolor withpen pencircle scaled"..thickness..";" end end -- fill and draw the cavity @@ -629,7 +639,7 @@ function TeXaddOnePointMPBW(listPoints,P,step,bbox) path = path .. "(".. PointI.x ..",".. PointI.y ..")*u--" end output = output .. "fill " .. path .. "cycle withcolor \\luameshmpcolorBack;" - output = output .. "draw " .. path .. "cycle withcolor \\luameshmpcolorNew withpen pencircle scaled 1pt;" + output = output .. "draw " .. path .. "cycle withcolor \\luameshmpcolorNew withpen pencircle scaled"..thicknessAdd..";" -- mark the points of the mesh j=1 for i=1,#listPoints do @@ -655,9 +665,9 @@ function TeXaddOnePointMPBW(listPoints,P,step,bbox) PointJ = listPoints[triangulation[i][2]] PointK = listPoints[triangulation[i][3]] if(triangulation[i].type == "bbox") then - output = output .. "draw (".. PointI.x ..",".. PointI.y ..")*u--("..PointJ.x..",".. PointJ.y ..")*u--("..PointK.x..",".. PointK.y ..")*u--cycle withcolor \\luameshmpcolorBbox;" + output = output .. "draw (".. PointI.x ..",".. PointI.y ..")*u--("..PointJ.x..",".. PointJ.y ..")*u--("..PointK.x..",".. PointK.y ..")*u--cycle withcolor \\luameshmpcolorBbox withpen pencircle scaled"..thickness..";" else - output = output .. "draw (".. PointI.x ..",".. PointI.y ..")*u--("..PointJ.x..",".. PointJ.y ..")*u--("..PointK.x..",".. PointK.y ..")*u--cycle withcolor \\luameshmpcolor;" + output = output .. "draw (".. PointI.x ..",".. PointI.y ..")*u--("..PointJ.x..",".. PointJ.y ..")*u--("..PointK.x..",".. PointK.y ..")*u--cycle withcolor \\luameshmpcolor withpen pencircle scaled"..thickness..";" end end -- fill the cavity @@ -669,9 +679,9 @@ function TeXaddOnePointMPBW(listPoints,P,step,bbox) output = output .. "fill " .. path .. "cycle withcolor \\luameshmpcolorBack;" -- draw the new triangles composed by the edges of the polygon and the added point for i=1,#polygon do - output = output .. "draw".."(".. listPoints[polygon[i][1]].x .. "," .. listPoints[polygon[i][1]].y .. ")*u -- (" .. listPoints[polygon[i][2]].x .. "," .. listPoints[polygon[i][2]].y ..")*u withcolor \\luameshmpcolorNew withpen pencircle scaled 1pt;" - output = output .. "draw".."(".. listPoints[polygon[i][1]].x .. "," .. listPoints[polygon[i][1]].y .. ")*u -- (" .. P.x .. "," .. P.y ..")*u withcolor \\luameshmpcolorNew withpen pencircle scaled 1pt;" - output = output .. "draw".."(".. listPoints[polygon[i][2]].x .. "," .. listPoints[polygon[i][2]].y .. ")*u -- (" .. P.x .. "," .. P.y ..")*u withcolor \\luameshmpcolorNew withpen pencircle scaled 1pt;" + output = output .. "draw".."(".. listPoints[polygon[i][1]].x .. "," .. listPoints[polygon[i][1]].y .. ")*u -- (" .. listPoints[polygon[i][2]].x .. "," .. listPoints[polygon[i][2]].y ..")*u withcolor \\luameshmpcolorNew withpen pencircle scaled"..thicknessAdd..";" + output = output .. "draw".."(".. listPoints[polygon[i][1]].x .. "," .. listPoints[polygon[i][1]].y .. ")*u -- (" .. P.x .. "," .. P.y ..")*u withcolor \\luameshmpcolorNew withpen pencircle scaled"..thicknessAdd..";" + output = output .. "draw".."(".. listPoints[polygon[i][2]].x .. "," .. listPoints[polygon[i][2]].y .. ")*u -- (" .. P.x .. "," .. P.y ..")*u withcolor \\luameshmpcolorNew withpen pencircle scaled"..thicknessAdd..";" end -- mark points j=1 @@ -690,7 +700,8 @@ function TeXaddOnePointMPBW(listPoints,P,step,bbox) end -function TeXOnePointTikZBW(chaine,point,step,scale,mode,bbox,color,colorBack,colorNew,colorCircle,colorBbox) +function + TeXOnePointTikZBW(chaine,point,step,scale,mode,bbox,color,colorBack,colorNew,colorCircle,colorBbox,thickness,thicknessCircle,thicknessAdd) local listPoints = {} if(mode=="int") then Sx,Sy=string.match(point,"%((.+),(.+)%)") @@ -700,12 +711,12 @@ function TeXOnePointTikZBW(chaine,point,step,scale,mode,bbox,color,colorBack,col -- point is a number P, listPoints = buildListExt(chaine,tonumber(point)) end - output = TeXaddOnePointTikZ(listPoints,P,step,bbox,color,colorBack,colorNew,colorCircle,colorBbox) + output = TeXaddOnePointTikZ(listPoints,P,step,bbox,color,colorBack,colorNew,colorCircle,colorBbox,thickness,thicknessCircle,thicknessAdd) output = "\\noindent\\begin{tikzpicture}[x="..scale..",y="..scale.."]".. output .. "\\end{tikzpicture}" tex.sprint(output) end -function TeXOnePointTikZBWinc(chaine,point,beginning, ending,step,scale,mode,bbox,color,colorBack,colorNew,colorCircle,colorBbox) +function TeXOnePointTikZBWinc(chaine,point,beginning, ending,step,scale,mode,bbox,color,colorBack,colorNew,colorCircle,colorBbox,thickness,thicknessCircle,thicknessAdd) local listPoints = {} if(mode=="int") then Sx,Sy=string.match(point,"%((.+),(.+)%)") @@ -715,12 +726,12 @@ function TeXOnePointTikZBWinc(chaine,point,beginning, ending,step,scale,mode,bbo -- point is a number P, listPoints = buildListExt(chaine,tonumber(point)) end - output = TeXaddOnePointTikZ(listPoints,P,step,bbox,color,colorBack,colorNew,colorCircle,colorBbox) + output = TeXaddOnePointTikZ(listPoints,P,step,bbox,color,colorBack,colorNew,colorCircle,colorBbox,thickness,thicknessCircle,thicknessAdd) output = "\\noindent\\begin{tikzpicture}[x="..scale..",y="..scale.."]".. beginning..output ..ending.. "\\end{tikzpicture}" tex.sprint(output) end -function TeXOnePointMPBW(chaine,point,step,scale,mode,bbox) +function TeXOnePointMPBW(chaine,point,step,scale,mode,bbox,thickness,thicknessCircle,thicknessAdd) local listPoints = {} if(mode=="int") then Sx,Sy=string.match(point,"%((.+),(.+)%)") @@ -730,12 +741,12 @@ function TeXOnePointMPBW(chaine,point,step,scale,mode,bbox) -- point is a number P, listPoints = buildListExt(chaine,tonumber(point)) end - output = TeXaddOnePointMPBW(listPoints,P,step,bbox) - output = "\\leavevmode\\begin{mplibcode}beginfig(0);u:="..scale..";".. output .. "endfig;\\end{mplibcode}" + output = TeXaddOnePointMPBW(listPoints,P,step,bbox,thickness,thicknessCircle,thicknessAdd) + output = "\\leavevmode\\begin{mplibcode}[luamesh]beginfig(0);u:="..scale..";".. output .. "endfig;\\end{mplibcode}" tex.sprint(output) end -function TeXOnePointMPBWinc(chaine,point,beginning,ending,step,scale,mode,bbox) +function TeXOnePointMPBWinc(chaine,point,beginning,ending,step,scale,mode,bbox,thickness,thicknessCircle,thicknessAdd) local listPoints = {} if(mode=="int") then Sx,Sy=string.match(point,"%((.+),(.+)%)") @@ -745,79 +756,79 @@ function TeXOnePointMPBWinc(chaine,point,beginning,ending,step,scale,mode,bbox) -- point is a number P, listPoints = buildListExt(chaine,tonumber(point)) end - output = TeXaddOnePointMPBW(listPoints,P,step,bbox) - output = "\\begin{mplibcode}u:="..scale..";"..beginning .. output .. ending .. "\\end{mplibcode}" + output = TeXaddOnePointMPBW(listPoints,P,step,bbox,thickness,thicknessCircle,thicknessAdd) + output = "\\begin{mplibcode}[luamesh]u:="..scale..";"..beginning .. output .. ending .. "\\end{mplibcode}" tex.sprint(output) end -function drawGmshMP(file,points,scale) +function drawGmshMP(file,points,scale,thickness) local listPoints,triangulation = readGmsh(file) - output = traceMeshMP(listPoints,triangulation,points) - output = "\\leavevmode\\begin{mplibcode}beginfig(0);u:="..scale.. ";" .. output .."endfig;\\end{mplibcode}" + output = traceMeshMP(listPoints,triangulation,points,thickness) + output = "\\leavevmode\\begin{mplibcode}[luamesh]beginfig(0);u:="..scale.. ";" .. output .."endfig;\\end{mplibcode}" tex.sprint(output) end -function drawGmshMPinc(file,beginning,ending,points,scale) +function drawGmshMPinc(file,beginning,ending,points,scale,thickness) local listPoints,triangulation = readGmsh(file) - output = traceMeshMP(listPoints,triangulation,points) - output = "\\leavevmode\\begin{mplibcode}u:="..scale..";"..beginning .. output .. ending .. "\\end{mplibcode}" + output = traceMeshMP(listPoints,triangulation,points,thickness) + output = "\\leavevmode\\begin{mplibcode}[luamesh]u:="..scale..";"..beginning .. output .. ending .. "\\end{mplibcode}" tex.sprint(output) end -- -function drawGmshTikZ(file,points,scale,color) +function drawGmshTikZ(file,points,scale,color,thickness) local listPoints,triangulation = readGmsh(file) - output = traceMeshTikZ(listPoints, triangulation,points,color,colorBbox) + output = traceMeshTikZ(listPoints, triangulation,points,color,colorBbox,thickness) output = "\\noindent\\begin{tikzpicture}[x=" .. scale .. ",y=" .. scale .."]" .. output .."\\end{tikzpicture}" tex.sprint(output) end -- -function drawGmshTikZinc(file,beginning, ending,points,scale,color) +function drawGmshTikZinc(file,beginning, ending,points,scale,color,thickness) local listPoints,triangulation = readGmsh(file) - output = traceMeshTikZ(listPoints, triangulation,points,color,colorBbox) + output = traceMeshTikZ(listPoints, triangulation,points,color,colorBbox,thickness) output = "\\noindent\\begin{tikzpicture}[x=" .. scale .. ",y=" .. scale .."]" ..beginning.. output..ending .."\\end{tikzpicture}" tex.sprint(output) end -- buildVoronoi with MP -function gmshVoronoiMP(file,points,scale,tri,styleD,styleV) +function gmshVoronoiMP(file,points,scale,tri,styleD,styleV,thickness,thicknessVoronoi) local listPoints,triangulation = readGmsh(file) local listVoronoi = buildVoronoi(listPoints, triangulation) - output = traceVoronoiMP(listPoints,triangulation,listVoronoi,points,tri,styleD,styleV) - output = "\\leavevmode\\begin{mplibcode}beginfig(0);u:="..scale.. ";" .. output .."endfig;\\end{mplibcode}" + output = traceVoronoiMP(listPoints,triangulation,listVoronoi,points,tri,styleD,styleV,thickness,thicknessVoronoi) + output = "\\leavevmode\\begin{mplibcode}[luamesh]beginfig(0);u:="..scale.. ";" .. output .."endfig;\\end{mplibcode}" tex.sprint(output) end -- buildVoronoi with TikZ -function gmshVoronoiTikZ(file,points,scale,tri,color,colorVoronoi,styleD,styleV) +function gmshVoronoiTikZ(file,points,scale,tri,color,colorVoronoi,styleD,styleV,thickness,thicknessVoronoi) local listPoints,triangulation = readGmsh(file) local listVoronoi = buildVoronoi(listPoints, triangulation) - output = traceVoronoiTikZ(listPoints,triangulation,listVoronoi,points,tri,color,colorBbox,colorVoronoi,styleD,styleV) + output = traceVoronoiTikZ(listPoints,triangulation,listVoronoi,points,tri,color,colorBbox,colorVoronoi,styleD,styleV,thickness,thicknessVoronoi) output = "\\noindent\\begin{tikzpicture}[x=" .. scale .. ",y=" .. scale .."]" .. output .."\\end{tikzpicture}" tex.sprint(output) end -- buildVoronoi with MP -function gmshVoronoiMPinc(file,beginning, ending,points,scale,tri,styleD,styleV) +function gmshVoronoiMPinc(file,beginning, ending,points,scale,tri,styleD,styleV,thickness,thicknessVoronoi) local listPoints,triangulation = readGmsh(file) local listVoronoi = buildVoronoi(listPoints, triangulation) - output = traceVoronoiMP(listPoints,triangulation,listVoronoi,points,tri,styleD,styleV) - output = "\\leavevmode\\begin{mplibcode}u:="..scale..";"..beginning .. output .. ending .. "\\end{mplibcode}" + output = traceVoronoiMP(listPoints,triangulation,listVoronoi,points,tri,styleD,styleV,thickness,thicknessVoronoi) + output = "\\leavevmode\\begin{mplibcode}[luamesh]u:="..scale..";"..beginning .. output .. ending .. "\\end{mplibcode}" tex.sprint(output) end -- buildVoronoi with TikZ -function gmshVoronoiTikZinc(file,beginning, ending,points,scale,tri,color,colorVoronoi,styleD,styleV) +function gmshVoronoiTikZinc(file,beginning, ending,points,scale,tri,color,colorVoronoi,styleD,styleV,thickness,thicknessVoronoi) local listPoints,triangulation = readGmsh(file) local listVoronoi = buildVoronoi(listPoints, triangulation) - output = traceVoronoiTikZ(listPoints,triangulation,listVoronoi,points,tri,color,colorBbox,colorVoronoi,styleD,styleV) + output = traceVoronoiTikZ(listPoints,triangulation,listVoronoi,points,tri,color,colorBbox,colorVoronoi,styleD,styleV,thickness,thicknessVoronoi) output = "\\noindent\\begin{tikzpicture}[x=" .. scale .. ",y=" .. scale .."]" ..beginning.. output..ending .."\\end{tikzpicture}" tex.sprint(output) end @@ -852,12 +863,12 @@ function tracePolygonMP(polygon,points) end -function tracePolygonTikZ(polygon,points, colorPoly) +function tracePolygonTikZ(polygon,points, colorPoly,polygonThickness) output = ""; for i=1,#polygon do output = output .. "\\coordinate (polygon".. i .. ") at (" .. polygon[i].x .. "," .. polygon[i].y .. ");" end - output = output .. "\\draw[color=".. colorPoly .. ", thick]" + output = output .. "\\draw[color=".. colorPoly .. ", ,line width="..polygonThickness.."]" for i=1,#polygon do output = output .. "(" .. polygon[i].x .. "," .. polygon[i].y .. ") -- " end @@ -878,7 +889,7 @@ end function drawMeshPolygonMP(chaine,mode,h,step, - points,scale,random) + points,scale,random,thickness,polygonThickness) local polygon = buildList(chaine, mode) polygon = addPointsPolygon(polygon,h) local grid = buildGrid(polygon,h,random) @@ -900,48 +911,48 @@ function drawMeshPolygonMP(chaine,mode,h,step, if(step=="mesh") then -- polygon + mesh triangulation = BowyerWatson(listPoints,"none") -- no bbox - output = traceMeshMP(listPoints,triangulation,points) + output = traceMeshMP(listPoints,triangulation,points,thickness) output = output .. tracePolygonMP(polygon,points) end - output = "\\leavevmode\\begin{mplibcode}beginfig(0);u:="..scale.. ";" .. output .."endfig;\\end{mplibcode}" + output = "\\leavevmode\\begin{mplibcode}[luamesh]beginfig(0);u:="..scale.. ";" .. output .."endfig;\\end{mplibcode}" tex.sprint(output) end function drawMeshPolygonTikZ(chaine,mode,h,step, - points,scale,color,colorPoly,random) + points,scale,color,colorPoly,random,thickness,polygonThickness) local polygon = buildList(chaine, mode) polygon = addPointsPolygon(polygon,h) local grid = buildGrid(polygon,h,random) local listPoints = addGridPoints(polygon,grid,h) if(step=="polygon") then -- the polygon - output = tracePolygonTikZ(polygon,points,colorPoly) + output = tracePolygonTikZ(polygon,points,colorPoly,polygonThickness) end if(step=="grid") then -- polygon + grid output = tracePointsTikZ(grid,points,color,"none") -- none for colorBbox - output = output .. tracePolygonTikZ(polygon,points,colorPoly) + output = output .. tracePolygonTikZ(polygon,points,colorPoly,polygonThickness) end if(step=="points") then -- polygon + only grid points inside the polygon output = tracePointsTikZ(listPoints,points,color,"none") - output = output .. tracePolygonTikZ(polygon,points,colorPoly) + output = output .. tracePolygonTikZ(polygon,points,colorPoly,polygonThickness) end if(step=="mesh") then -- polygon + mesh triangulation = BowyerWatson(listPoints,"none") -- no bbox - output = traceMeshTikZ(listPoints,triangulation,points,color,"none") - output = output .. tracePolygonTikZ(polygon,points,colorPoly) + output = traceMeshTikZ(listPoints,triangulation,points,color,"none",thickness) + output = output .. tracePolygonTikZ(polygon,points,colorPoly,polygonThickness) end output = "\\noindent\\begin{tikzpicture}[x=" .. scale .. ",y=" .. scale .."]" .. output .."\\end{tikzpicture}" tex.sprint(output) end function drawMeshPolygonMPinc(chaine,beginning,ending,mode,h,step, - points,scale,random) + points,scale,random,thickness,polygonThickness) local polygon = buildList(chaine, mode) polygon = addPointsPolygon(polygon,h) local grid = buildGrid(polygon,h,random) @@ -963,17 +974,17 @@ function drawMeshPolygonMPinc(chaine,beginning,ending,mode,h,step, if(step=="mesh") then -- polygon + mesh triangulation = BowyerWatson(listPoints,"none") -- no bbox - output = traceMeshMP(listPoints,triangulation,points) + output = traceMeshMP(listPoints,triangulation,points,thickness) output = output .. tracePolygonMP(polygon,points) end - output = "\\begin{mplibcode}u:="..scale..";"..beginning .. output .. ending .. "\\end{mplibcode}" + output = "\\begin{mplibcode}[luamesh]u:="..scale..";"..beginning .. output .. ending .. "\\end{mplibcode}" tex.sprint(output) end function drawMeshPolygonTikZinc(chaine,beginning,ending,mode,h,step, - points,scale,color,colorPoly,random) + points,scale,color,colorPoly,random,thickness,polygonThickness) local polygon = buildList(chaine, mode) polygon = addPointsPolygon(polygon,h) local grid = buildGrid(polygon,h,random) @@ -995,7 +1006,7 @@ function drawMeshPolygonTikZinc(chaine,beginning,ending,mode,h,step, if(step=="mesh") then -- polygon + mesh triangulation = BowyerWatson(listPoints,"none") -- no bbox - output = traceMeshTikZ(listPoints,triangulation,points,color,"none") + output = traceMeshTikZ(listPoints,triangulation,points,color,"none",thickness) output = output .. tracePolygonTikZ(polygon,points,colorPoly) end output = "\\noindent\\begin{tikzpicture}[x="..scale..",y="..scale.."]".. beginning..output ..ending.. "\\end{tikzpicture}" diff --git a/macros/luatex/latex/luamesh/tex/luamesh.sty b/macros/luatex/latex/luamesh/tex/luamesh.sty index d2024a1da8..6e2e2d7b7d 100644 --- a/macros/luatex/latex/luamesh/tex/luamesh.sty +++ b/macros/luatex/latex/luamesh/tex/luamesh.sty @@ -1,27 +1,19 @@ \NeedsTeXFormat{LaTeX2e}% \def\PackageName{luamesh}% -\def\fileversion{v0.6}% -\def\filedate{2020/06/06}% +\def\fileversion{v0.7}% +\def\filedate{2022/07/08}% \ProvidesPackage{luamesh}[\filedate\space\fileversion]% % % package to load \RequirePackage{xkeyval,xcolor,ifthen}% -%% one global option: mp or tikz -%\newif\ifluameshmp% -%\define@key{luamesh.sty}{mp}[]{\luameshmptrue}% -%\define@key{luamesh.sty}{tikz}[]{\luameshmpfalse}% -% -%\RequirePackage{etoolbox} % pour robustifier les commandes -% -% -%\ifluameshmp% - \RequirePackage{luamplib}% -%\else% - \RequirePackage{tikz}% -%\fi% +\RequirePackage{luamplib}% +\RequirePackage{tikz}% + % % load the lua code \directlua{require("luamesh.lua")}% +% load metapost lib +\everymplib[luamesh]{input luamesh;} % %% % for tikz (default value) @@ -73,8 +65,10 @@ \define@key{buildMeshInc}{color}[black]{\def\luameshval@bmi@color{#1}}% %% the name of the color of drawing the bbox \define@key{buildMeshInc}{colorBbox}[black]{\def\luameshval@bmi@colorbbox{#1}}% +%% thickness of the drawing (default value of tikz) +\define@key{buildMeshInc}{thickness}[0.4pt]{\def\luameshval@bm@thickness{#1}}% % -\presetkeys{buildMeshInc}{tikz=false,bbox=none,scale, meshpoint,mode=int,print=none,color,colorBbox}{}% +\presetkeys{buildMeshInc}{tikz=false,bbox=none,scale, meshpoint,mode=int,print=none,color,colorBbox,thickness}{}% % \newcommand*{\buildMeshBWinc}[4][]{% % #1 : optionnal arguments @@ -86,13 +80,13 @@ \def\MeshPoint{\luameshval@bmi@meshpoint}% \ifKV@buildMeshInc@tikz% if we are using tikz \directlua{% - 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")% + 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")% }% \else % we are using MP \def\luameshmpcolor{\mpcolor{\luameshval@bmi@color}}% \def\luameshmpcolorBbox{\mpcolor{\luameshval@bmi@colorbbox}}% \directlua{% - buildMeshMPBWinc("#2","\luaescapestring{\unexpanded{#3}}","\luaescapestring{\unexpanded{#4}}","\luameshval@bmi@mode","\luameshval@bmi@print","\luameshval@bmi@bbox","\luameshval@bmi@scale")% + buildMeshMPBWinc("#2","\luaescapestring{\unexpanded{#3}}","\luaescapestring{\unexpanded{#4}}","\luameshval@bmi@mode","\luameshval@bmi@print","\luameshval@bmi@bbox","\luameshval@bmi@scale","\luameshval@bm@thickness")% }% % \fi% @@ -135,8 +129,10 @@ \define@key{buildMesh}{color}[black]{\def\luameshval@bm@color{#1}}% %% the name of the color of drawing the bbox \define@key{buildMesh}{colorBbox}[black]{\def\luameshval@bm@colorbbox{#1}}% +%% thickness of the drawing (default value of tikz) +\define@key{buildMesh}{thickness}[0.4pt]{\def\luameshval@bm@thickness{#1}}% % -\presetkeys{buildMesh}{tikz=false,bbox=none,scale, meshpoint,mode=int,print=none,color,colorBbox}{}% +\presetkeys{buildMesh}{tikz=false,bbox=none,scale, meshpoint,mode=int,print=none,color,colorBbox,thickness}{}% % \newcommand{\buildMeshBW}[2][]{% % #1 : optionnal arguments @@ -146,13 +142,13 @@ \def\MeshPoint{\luameshval@bm@meshpoint}% \ifKV@buildMesh@tikz% if we are using tikz \directlua{% - buildMeshTikZBW("#2","\luameshval@bm@mode","\luameshval@bm@print","\luameshval@bm@bbox","\luameshval@bm@scale","\luameshval@bm@color","\luameshval@bm@colorbbox")% + buildMeshTikZBW("#2","\luameshval@bm@mode","\luameshval@bm@print","\luameshval@bm@bbox","\luameshval@bm@scale","\luameshval@bm@color","\luameshval@bm@colorbbox","\luameshval@bm@thickness")% }% \else % we are using MP \def\luameshmpcolor{\mpcolor{\luameshval@bm@color}}% \def\luameshmpcolorBbox{\mpcolor{\luameshval@bm@colorbbox}}% \directlua{% - buildMeshMPBW("#2","\luameshval@bm@mode","\luameshval@bm@print","\luameshval@bm@bbox","\luameshval@bm@scale")% + buildMeshMPBW("#2","\luameshval@bm@mode","\luameshval@bm@print","\luameshval@bm@bbox","\luameshval@bm@scale","\luameshval@bm@thickness")% }% % \fi% @@ -222,7 +218,13 @@ %% the name of the color of drawing the bbox \define@key{buildVoronoiInc}{colorBbox}[black]{\def\luameshval@bvi@colorbbox{#1}}% % -\presetkeys{buildVoronoiInc}{tikz=false,bbox=none,scale, meshpoint,circumpoint,mode=int,print=none,color,colorVoronoi,colorBbox,delaunay=none,styleDelaunay=none,styleVoronoi=none}{}% +% thickness +\define@key{buildVoronoiInc}{thickness}[0.4pt]{\def\luameshval@bvi@thickness{#1}}% +%% voroni thickness +\define@key{buildVoronoiInc}{thicknessVoronoi}[0.4pt]{\def\luameshval@bvi@thicknessVoronoi{#1}}% +\presetkeys{buildVoronoiInc}{tikz=false,bbox=none,scale, + meshpoint,circumpoint,mode=int,print=none,color,colorVoronoi,colorBbox,delaunay=none,styleDelaunay=none,styleVoronoi=none,thickness, +thicknessVoronoi}{}% % \newcommand*{\buildVoronoiBWinc}[4][]{% % #1 : optionnal arguments @@ -235,14 +237,14 @@ \def\CircumPoint{\luameshval@bvi@circumpoint}% \ifKV@buildVoronoiInc@tikz% if we are using tikz \directlua{% - 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")% + 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")% }% \else % we are using MP \def\luameshmpcolor{\mpcolor{\luameshval@bvi@color}}% \def\luameshmpcolorBbox{\mpcolor{\luameshval@bvi@colorbbox}}% \def\luameshmpcolorVoronoi{\mpcolor{\luameshval@bvi@colorvoronoi}}% \directlua{% - 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")% + 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")% }% % \fi% @@ -311,9 +313,13 @@ \define@key{buildVoronoi}{colorVoronoi}[red]{\def\luameshval@bv@colorVoronoi{#1}}% %% the name of the color of drawing the bbox \define@key{buildVoronoi}{colorBbox}[black]{\def\luameshval@bv@colorbbox{#1}}% +% thickness +\define@key{buildVoronoi}{thickness}[0.4pt]{\def\luameshval@bv@thickness{#1}}% +%% voroni thickness +\define@key{buildVoronoi}{thicknessVoronoi}[0.4pt]{\def\luameshval@bv@thicknessVoronoi{#1}}% % \presetkeys{buildVoronoi}{tikz=false,bbox=none,scale, - meshpoint,circumpoint,mode=int,print=none,color,colorVoronoi,colorBbox,delaunay=none,styleDelaunay=none, styleVoronoi=none}{}% + meshpoint,circumpoint,mode=int,print=none,color,colorVoronoi,colorBbox,delaunay=none,styleDelaunay=none, styleVoronoi=none,thickness,thicknessVoronoi}{}% % \newcommand{\buildVoronoiBW}[2][]{% % #1 : optionnal arguments @@ -324,14 +330,14 @@ \def\CircumPoint{\luameshval@bv@circumpoint}% \ifKV@buildVoronoi@tikz% if we are using tikz \directlua{% - 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")% + 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")% }% \else % we are using MP \def\luameshmpcolor{\mpcolor{\luameshval@bv@color}}% \def\luameshmpcolorBbox{\mpcolor{\luameshval@bv@colorbbox}}% \def\luameshmpcolorVoronoi{\mpcolor{\luameshval@bv@colorVoronoi}}% \directlua{% - buildVoronoiMPBW("#2","\luameshval@bv@mode","\luameshval@bv@print","\luameshval@bv@bbox","\luameshval@bv@scale","\luameshval@bv@delaunay","\luameshval@bv@styleDelaunay","\luameshval@bv@styleVoronoi")% + 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")% }% % \fi% @@ -507,7 +513,12 @@ \def\luameshval@ap@bbox{bbox}% \fi% }% -\presetkeys{MeshAddOneBW}{tikz=false,scale, meshpoint,newpoint,color,colorBack,colorNew,colorCircle,step=badtriangles,mode=int,bbox=none,colorBbox}{}% +%% thickness for mesh and circle and new elements +\define@key{MeshAddOneBW}{thickness}[0.4pt]{\def\luameshval@ap@thickness{#1}}% +\define@key{MeshAddOneBW}{thicknessCircle}[0.4pt]{\def\luameshval@ap@thicknesscircle{#1}}% +\define@key{MeshAddOneBW}{thicknessNew}[1pt]{\def\luameshval@ap@thicknessnew{#1}}% + +\presetkeys{MeshAddOneBW}{tikz=false,scale, meshpoint,newpoint,color,colorBack,colorNew,colorCircle,step=badtriangles,mode=int,bbox=none,colorBbox,thickness,thicknessCircle,thicknessNew}{}% % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \newcommand*{\meshAddPointBW}[3][]{% @@ -519,7 +530,7 @@ \def\NewPoint{\luameshval@ap@newpoint}% \ifKV@MeshAddOneBW@tikz% if we are using tikz \directlua{% - 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")% + 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")% }% \else % we are using MP \def\luameshmpcolor{\mpcolor{\luameshval@ap@color}} @@ -528,7 +539,7 @@ \def\luameshmpcolorCircle{\mpcolor{\luameshval@ap@colorcircle}} \def\luameshmpcolorBbox{\mpcolor{\luameshval@ap@colorbbox}} \directlua{% - TeXOnePointMPBW("#2","#3","\luameshval@ap@step","\luameshval@ap@scale","\luameshval@ap@mode","\luameshval@ap@bbox")% + TeXOnePointMPBW("#2","#3","\luameshval@ap@step","\luameshval@ap@scale","\luameshval@ap@mode","\luameshval@ap@bbox","\luameshval@ap@thickness","\luameshval@ap@thicknesscircle","\luameshval@ap@thicknessnew")% }% % \fi% @@ -563,6 +574,12 @@ %% the color of circoncircle \define@key{MeshAddOneBWinc}{colorCircle}[green]{\def\luameshval@api@colorcircle{#1}}% \define@key{MeshAddOneBWinc}{colorBbox}[black]{\def\luameshval@api@colorbbox{#1}}% +%% thickness for mesh and circle and new elements +\define@key{MeshAddOneBWinc}{thickness}[0.4pt]{\def\luameshval@api@thickness{#1}}% +\define@key{MeshAddOneBWinc}{thicknessCircle}[0.4pt]{\def\luameshval@api@thicknesscircle{#1}}% +\define@key{MeshAddOneBWinc}{thicknessNew}[1pt]{\def\luameshval@api@thicknessnew{#1}}% + + % %% a complete picture or some code of the engine \define@choicekey*{MeshAddOneBWinc}{mode}[\val\nr]{int, ext}{% @@ -579,7 +596,7 @@ \def\luameshval@api@bbox{bbox}% \fi% }% -\presetkeys{MeshAddOneBWinc}{tikz=false,scale, meshpoint,newpoint,color,colorBack,colorNew,colorCircle,step=badtriangles,mode=int,bbox=none,colorBbox}{}% +\presetkeys{MeshAddOneBWinc}{tikz=false,scale, meshpoint,newpoint,color,colorBack,colorNew,colorCircle,step=badtriangles,mode=int,bbox=none,colorBbox,thickness,thicknessCircle,thicknessNew}{}% % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \newcommand*{\meshAddPointBWinc}[5][]{% @@ -593,7 +610,7 @@ \def\NewPoint{\luameshval@api@newpoint}% \ifKV@MeshAddOneBWinc@tikz% if we are using tikz \directlua{% - 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")% + 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")% }% \else % we are using MP \def\luameshmpcolor{\mpcolor{\luameshval@api@color}} @@ -602,7 +619,7 @@ \def\luameshmpcolorCircle{\mpcolor{\luameshval@api@colorcircle}} \def\luameshmpcolorBbox{\mpcolor{\luameshval@api@colorbbox}} \directlua{% - TeXOnePointMPBWinc("#2","#3","\luaescapestring{\unexpanded{#4}}","\luaescapestring{\unexpanded{#5}}","\luameshval@api@step","\luameshval@api@scale","\luameshval@api@mode","\luameshval@api@bbox")% + 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")% }% % \fi% @@ -613,21 +630,23 @@ %% before and after the generated code \define@boolkey{drawGmshInc}{tikz}[true]{}% %% the scale -\define@key{drawGmshInc}{scale}[1cm]{\def\luameshvaldgi@scale{#1}}% +\define@key{drawGmshInc}{scale}[1cm]{\def\luameshval@dgi@scale{#1}}% %% print ponits ? \define@choicekey*{drawGmshInc}{print}[\val\nr]{none, points}{% \ifcase\nr\relax% - \def\luameshvaldgi@print{none}% + \def\luameshval@dgi@print{none}% \or% - \def\luameshvaldgi@print{points}% + \def\luameshval@dgi@print{points}% \fi% }% %% the name of the point -\define@key{drawGmshInc}{meshpoint}[P]{\def\luameshvaldgi@meshpoint{#1}}% +\define@key{drawGmshInc}{meshpoint}[P]{\def\luameshval@dgi@meshpoint{#1}}% %% the name of the color of drawing -\define@key{drawGmshInc}{color}[black]{\def\luameshvaldgi@color{#1}}% +\define@key{drawGmshInc}{color}[black]{\def\luameshval@dgi@color{#1}}% +%% thickness +\define@key{drawGmshInc}{thickness}[0.4pt]{\def\luameshval@dgi@thickness{#1}}% % -\presetkeys{drawGmshInc}{tikz=false,scale, meshpoint,print=none,color}{}% +\presetkeys{drawGmshInc}{tikz=false,scale, meshpoint,print=none,color,thickness}{}% % \newcommand*{\drawGmshinc}[4][]{% % #1 : optionnal arguments @@ -635,15 +654,15 @@ % #3 : the code to place before the generated one % #4 : the code to place after the generated one \setkeys{drawGmshInc}{#1} % - \def\MeshPoint{\luameshvaldgi@meshpoint}% + \def\MeshPoint{\luameshval@dgi@meshpoint}% \ifKV@drawGmshInc@tikz% if we are using tikz \directlua{% - drawGmshTikZinc("#2","\luaescapestring{\unexpanded{#3}}","\luaescapestring{\unexpanded{#4}}","\luameshvaldgi@print","\luameshvaldgi@scale","\luameshvaldgi@color")% + drawGmshTikZinc("#2","\luaescapestring{\unexpanded{#3}}","\luaescapestring{\unexpanded{#4}}","\luameshval@dgi@print","\luameshval@dgi@scale","\luameshval@dgi@color","\luameshval@dgi@thickness")% }% \else % we are using MP - \def\luameshmpcolor{\mpcolor{\luameshvaldgi@color}}% + \def\luameshmpcolor{\mpcolor{\luameshval@dgi@color}}% \directlua{% - drawGmshMPinc("#2","\luaescapestring{\unexpanded{#3}}","\luaescapestring{\unexpanded{#4}}","\luameshvaldgi@print","\luameshvaldgi@scale")% + drawGmshMPinc("#2","\luaescapestring{\unexpanded{#3}}","\luaescapestring{\unexpanded{#4}}","\luameshval@dgi@print","\luameshval@dgi@scale","\luameshval@dgi@thickness")% }% % \fi% @@ -653,35 +672,37 @@ %% the code is complete and we don't have any callbacks \define@boolkey{drawGmsh}{tikz}[true]{}% %% the scale -\define@key{drawGmsh}{scale}[1cm]{\def\luameshvaldg@scale{#1}}% +\define@key{drawGmsh}{scale}[1cm]{\def\luameshval@dg@scale{#1}}% %% print points \define@choicekey*{drawGmsh}{print}[\val\nr]{none, points}{% \ifcase\nr\relax% - \def\luameshvaldg@print{none}% + \def\luameshval@dg@print{none}% \or% - \def\luameshvaldg@print{points}% + \def\luameshval@dg@print{points}% \fi% }% %% the name of the point -\define@key{drawGmsh}{meshpoint}[P]{\def\luameshvaldg@meshpoint{#1}}% +\define@key{drawGmsh}{meshpoint}[P]{\def\luameshval@dg@meshpoint{#1}}% %% the name of the color of drawing -\define@key{drawGmsh}{color}[black]{\def\luameshvaldg@color{#1}}% +\define@key{drawGmsh}{color}[black]{\def\luameshval@dg@color{#1}}% +%% thickness +\define@key{drawGmsh}{thickness}[0.4pt]{\def\luameshval@dg@thickness{#1}}% % -\presetkeys{drawGmsh}{tikz=false,scale, meshpoint,print=none,color}{}% +\presetkeys{drawGmsh}{tikz=false,scale, meshpoint,print=none,color,thickness}{}% % \newcommand{\drawGmsh}[2][]{% % #1 : optionnal arguments % #2 : the gmsh file \setkeys{drawGmsh}{#1} % - \def\MeshPoint{\luameshvaldg@meshpoint}% + \def\MeshPoint{\luameshval@dg@meshpoint}% \ifKV@drawGmsh@tikz% if we are using tikz \directlua{% - drawGmshTikZ("#2","\luameshvaldg@print","\luameshvaldg@scale","\luameshvaldg@color")% + drawGmshTikZ("#2","\luameshval@dg@print","\luameshval@dg@scale","\luameshval@dg@color","\luameshval@dg@thickness")% }% \else % we are using MP - \def\luameshmpcolor{\mpcolor{\luameshvaldg@color}}% + \def\luameshmpcolor{\mpcolor{\luameshval@dg@color}}% \directlua{% - drawGmshMP("#2","\luameshvaldg@print","\luameshvaldg@scale")% + drawGmshMP("#2","\luameshval@dg@print","\luameshval@dg@scale","\luameshval@dg@thickness")% }% % \fi% @@ -732,6 +753,11 @@ \define@key{gmshVoronoiInc}{color}[black]{\def\luameshval@gvi@color{#1}}% %% the name of the color of drawing Voronoi \define@key{gmshVoronoiInc}{colorVoronoi}[red]{\def\luameshval@gvi@colorvoronoi{#1}}% +%% thickness +\define@key{gmshVoronoiInc}{thickness}[0.4pt]{\def\luameshval@gvi@thickness{#1}}% +%% Voronoi thickness +\define@key{gmshVoronoiInc}{thicknessVoronoi}[0.4pt]{\def\luameshval@gvi@thicknessVoronoi{#1}}% + % \presetkeys{gmshVoronoiInc}{tikz=false,scale, meshpoint,circumpoint,print=none,color,colorVoronoi,delaunay=none,styleVoronoi=none, styleDelaunay=none}{}% @@ -746,13 +772,13 @@ \def\CircumPoint{\luameshval@gvi@circumpoint}% \ifKV@gmshVoronoiInc@tikz% if we are using tikz \directlua{% - 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")% + 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")% }% \else % we are using MP \def\luameshmpcolor{\mpcolor{\luameshval@gvi@color}}% \def\luameshmpcolorVoronoi{\mpcolor{\luameshval@gvi@colorvoronoi}}% \directlua{% - gmshVoronoiMPinc("#2","\luaescapestring{\unexpanded{#3}}","\luaescapestring{\unexpanded{#4}}","\luameshval@gvi@print","\luameshval@gvi@scale","\luameshval@gvi@delaunay","\luameshval@gvi@styleDelaunay","\luameshval@gvi@styleVoronoi")% + 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")% }% % \fi% @@ -804,7 +830,12 @@ %% the name of the color of drawing Voronoi \define@key{gmshVoronoi}{colorVoronoi}[red]{\def\luameshval@gv@colorVoronoi{#1}}% % -\presetkeys{gmshVoronoi}{tikz=false,scale, meshpoint,circumpoint,print=none,color,colorVoronoi,delaunay=none,styleVoronoi=none, styleDelaunay=none}{}% +%% thickness +\define@key{gmshVoronoi}{thickness}[0.4pt]{\def\luameshval@gv@thickness{#1}}% +%% Voronoi thickness +\define@key{gmshVoronoi}{thicknessVoronoi}[0.4pt]{\def\luameshval@gv@thicknessVoronoi{#1}}% +% +\presetkeys{gmshVoronoi}{tikz=false,scale, meshpoint,circumpoint,print=none,color,colorVoronoi,delaunay=none,styleVoronoi=none, styleDelaunay=none,thickness,thicknessVoronoi}{}% % \newcommand{\gmshVoronoi}[2][]{% % #1 : optionnal arguments @@ -814,13 +845,13 @@ \def\CircumPoint{\luameshval@gv@circumpoint}% \ifKV@gmshVoronoi@tikz% if we are using tikz \directlua{% - gmshVoronoiTikZ("#2","\luameshval@gv@print","\luameshval@gv@scale","\luameshval@gv@delaunay","\luameshval@gv@color","\luameshval@gv@colorVoronoi","\luameshval@gv@styleDelaunay","\luameshval@gv@styleVoronoi")% + 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")% }% \else % we are using MP \def\luameshmpcolor{\mpcolor{\luameshval@gv@color}}% \def\luameshmpcolorVoronoi{\mpcolor{\luameshval@gv@colorVoronoi}}% \directlua{% - gmshVoronoiMP("#2","\luameshval@gv@print","\luameshval@gv@scale","\luameshval@gv@delaunay","\luameshval@gv@styleDelaunay","\luameshval@gv@styleVoronoi")% + gmshVoronoiMP("#2","\luameshval@gv@print","\luameshval@gv@scale","\luameshval@gv@delaunay","\luameshval@gv@styleDelaunay","\luameshval@gv@styleVoronoi","\luameshval@gv@thickness","\luameshval@gv@thicknessVoronoi")% }% % \fi% @@ -879,11 +910,15 @@ %% 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 +%% the name of the color for the polygon \define@key{meshPolygon}{colorPolygon}[red]{\def\luameshval@mp@colorPolygon{#1}}% +%% thickness +\define@key{meshPolygon}{thickness}[0.4pt]{\def\luameshval@mp@thickness{#1}}% +%% polygon thickness +\define@key{meshPolygon}{thicknessPolygon}[0.4pt]{\def\luameshval@mp@polygonThickness{#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}{}% +\presetkeys{meshPolygon}{tikz=false,scale,mode=int,step=mesh,print=none,color,colorPolygon,h,meshpoint,gridpoints=rect,thickness,thicknessPolygon}{}% % \newcommand{\meshPolygon}[2][]{% % #1 : optionnal arguments @@ -893,13 +928,13 @@ \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")% + 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")% }% \else % we are using MP \def\luameshmpcolor{\mpcolor{\luameshval@mp@color}}% \def\luameshmpcolorPoly{\mpcolor{\luameshval@mp@colorPolygon}}% \directlua{% - drawMeshPolygonMP("#2","\luameshval@mp@mode","\luameshval@mp@h","\luameshval@mp@step","\luameshval@mp@print","\luameshval@mp@scale","\luameshval@mp@gridpoints")% + 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")% }% % \fi% @@ -955,11 +990,14 @@ %% 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 +%% the name of the color for the polygon \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}{}% +%% thickness +\define@key{meshPolygonInc}{thickness}[0.4pt]{\def\luameshval@mpi@thickness{#1}}% +%% polygon thickness +\define@key{meshPolygonInc}{polygonThickness}[0.4pt]{\def\luameshval@mpi@polygonThickness{#1}}% + +\presetkeys{meshPolygonInc}{tikz=false,scale,mode=int,step=mesh,print=none,color,colorPolygon,h,meshpoint,gridpoints=rect,thickness,polygonThickness}{}% % \newcommand{\meshPolygonInc}[4][]{% % #1 : optionnal arguments @@ -971,14 +1009,14 @@ \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")% + 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")% }% \else % we are using MP \def\luameshmpcolor{\mpcolor{\luameshval@mpi@color}}% \def\luameshmpcolorPoly{\mpcolor{\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")% + 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")% }% % \fi% -}% +}% \ No newline at end of file -- cgit v1.2.3