From: Maxime Chupin (escudo) Date: Fri, 25 Nov 2016 09:47:30 +0000 (+0100) Subject: Bug avec la fonction TeXaddOnePoint Tikz côté lua X-Git-Url: https://melusine.eu.org/syracuse/G/git/?a=commitdiff_plain;h=8f69ee8fd8ba6b022d1aaae4c4f2b93e1694765f;p=delaunay.git Bug avec la fonction TeXaddOnePoint Tikz côté lua --- diff --git a/doc/luamesh-doc.listing b/doc/luamesh-doc.listing index fda8d32..a9b8131 100644 --- a/doc/luamesh-doc.listing +++ b/doc/luamesh-doc.listing @@ -1 +1,14 @@ -\meshAddPointBW{(1.5,1);(4,0);(4.5,2.5);(1.81,2.14);(2.5,0.5);(2.8,1.5)}{(2.2,1.8)} + \meshAddPointBW[ + tikz, + mode = ext, + color = blue!70, + meshpoint = x, + newpoint = y, + colorBack=red!10, + colorNew = green!20!red, + colorCircle = blue, + colorBbox = black!20, + bbox = show, + scale=1.4cm, + step=cavity] + {mesh.txt}{6} diff --git a/doc/luamesh-doc.pdf b/doc/luamesh-doc.pdf index 7c7a86a..b8d9ef6 100644 Binary files a/doc/luamesh-doc.pdf and b/doc/luamesh-doc.pdf differ diff --git a/doc/luamesh-doc.tex b/doc/luamesh-doc.tex index 5a7b9d2..9a6e6ad 100644 --- a/doc/luamesh-doc.tex +++ b/doc/luamesh-doc.tex @@ -282,7 +282,7 @@ points must be given in the following way : There are several options to customize the drawing. \begin{optionsenum} -\item[mode = int (default) or ext:] this option allows to +\item[mode = int (default) \textme{or} ext:] this option allows to use either the previously described set of point in the argument, or a file, containing, line by line (2 columns), the points. Such a file looks like : @@ -293,7 +293,7 @@ x3 y3 ... xn yn \end{verbatim} -\item[bbox = none (default) or show:] this option allows to draw the +\item[bbox = none (default) \textme{or} show:] this option allows to draw the added points to form a \emph{bounding box}\footnote{The bounding box is defined by four points place at 15\% around the box defined by $(x_{\min},y_{\min})$, $(x_{\min},y_{\max})$, @@ -305,7 +305,7 @@ xn yn \item[colorBbox = \meta{value} (default: black):] The color of the drawing for the elements (points and triangles) belonging to the bounding box. -\item[print = none (default) or points:] To label the vertices of the +\item[print = none (default) \textme{or} points:] To label the vertices of the triangulations with an adding dot. \item[meshpoint = \meta{value} (default: P):] The letter(s) used to label the vertices of the triangulation. It is include in the math @@ -372,7 +372,7 @@ The use of this macro is quite similar to the There are several options (exactly the same that for the \Verb+\buildMeshBW+)to customize the drawing. \begin{optionsenum} -\item[mode = int (default) or ext:] this option allows to +\item[mode = int (default) \textme{or} ext:] this option allows to use either the previously described set of point in the argument, or a file, containing, line by line (2 columns), the points. Such a file looks like : @@ -383,7 +383,7 @@ x3 y3 ... xn yn \end{verbatim} -\item[bbox = none (default) or show:] this option allows to draw the +\item[bbox = none (default) \textme{or} show:] this option allows to draw the added points to form a \emph{bounding box} and the corresponding triangulation. By default, these triangles are removed at the end of the algorithm. \emph{Here, because we plot only the vertices of the @@ -393,7 +393,7 @@ xn yn \item[colorBbox = \meta{value} (default: black):] The color of the drawing for the elements (points and triangles) belonging to the bounding box. -\item[print = none (default) or points:] To label the vertices of the +\item[print = none (default) \textme{or} points:] To label the vertices of the triangulations with an adding dot. Without label, there is a dot. \item[meshpoint = \meta{value} (default: P):] The letter(s) used to label the vertices of the triangulation. It is include in the math @@ -456,8 +456,100 @@ line is then equivalent to \meshAddPointBW{(1.5,1);(4,0);(4.5,2.5);(1.81,2.14);(2.5,0.5);(2.8,1.5)}{(2.2,1.8)} \end{latexcode} +\subsubsection{The Options} + +There are several options (some of them are the same as for +\Verb+\buildMeshBW+) to customize the drawing. +\begin{optionsenum} +\item[mode = int (default) \textme{or} ext:] this option allows to + use either the previously described set of point in the argument + number one, or + a file, containing, line by line (2 columns), the points. Such a + file looks like : +\begin{verbatim} +x1 y1 +x2 y2 +x3 y3 +... +xn yn +\end{verbatim} +For the second argument of the macro, if we are in the +\Verb+mode = ext+, the argument must be the \emph{line number} of the file +corresponding to the point we want to add. The algorithm will stop the +line before to build the initial triangulation for which it will add +the point corresponding to the line. The other lines of the file are +ignored. +\item[bbox = none (default) \textme{or} show:] this option allows to draw the + added points to form a \emph{bounding box} and the corresponding + triangulation. By default, these triangles are removed at the end of + the algorithm. +\item[color = \meta{value} (default: black):] The color of the + drawing. +\item[colorBbox = \meta{value} (default: black):] The color of the + drawing for the elements (points and triangles) belonging to the + bounding box. +\item[colorNew = \meta{value} (default: red):] The color of the + drawing of the ``new'' elements which are the point to add, the + polygon of the cavity, and the new triangles. +\item[colorBack = \meta{value} (default: black!20):] The color for the + filling of the region concerned by the addition of the new point. +\item[colorCircle = \meta{value} (default: green):] The color for + circoncircle of the triangles containing the point to add. +\item[meshpoint = \meta{value} (default: P):] The letter(s) used to + label the vertices of the triangulation. It is include in the math + mode delimiters \Verb+$...$+. The bounding box points are labeled + with a star exponent, and numbered from 1 to 4. +\item[step = badtriangles (default) \textme{or} cavity \textme{or} + newtriangles:] To choose the step we want to draw, corresponding to + the steps of the Bowyer and Watson algorithm. +\item[newpoint = \meta{value} (default: P):] The letter(s) used to + label the new point of the triangulation. It is include in the math + mode delimiters \Verb+$...$+. +\item[tikz (boolean, default:false):] By default, this boolean is set + to \Verb+false+, and MetaPost (with \Verb+luamplib+) is used to draw + the picture. With this option, it is \Verb+tikz+ the \textit{drawing + engine}. +\item[scale = \meta{value} (default: 1cm):] The scale option defines + the scale at which the picture is draw (the same for the two + axis). It must contain the unit of length (cm, + pt, etc.). +\end{optionsenum} + +Here is an example of customization of the drawing. First, recall that +the external file \Verb+mesh.txt+ is: +\begin{verbatim} +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 +\end{verbatim} +We draw the addition of the 6th point. The 7th line will be ignored. +\begin{Exemple} + \meshAddPointBW[ + tikz, + mode = ext, + color = blue!70, + meshpoint = x, + newpoint = y, + colorBack=red!10, + colorNew = green!20!red, + colorCircle = blue, + colorBbox = black!20, + bbox = show, + scale=1.4cm, + step=cavity] + {mesh.txt}{6} +\end{Exemple} + \section{The \emph{inc} Macros}\label{sec:inc} +\subsection{With MetaPost} + +%\subsection{With \Verb+tikz+} + \section{Gallery of Examples} \end{document} diff --git a/luamesh.lua b/luamesh.lua index 842391b..83c2c25 100644 --- a/luamesh.lua +++ b/luamesh.lua @@ -502,10 +502,10 @@ function cleanPoly(polygon) end -- -function TeXaddOnePointTikZ(chaine,point,step,color,colorBack, colorNew, colorCircle,colorBbox) +function TeXaddOnePointTikZ(listPoints,P,step,bbox,color,colorBack, colorNew, colorCircle,colorBbox) output = "" -- build the triangulation - triangulation = BowyerWatson(listPoints,"none") + triangulation = BowyerWatson(listPoints,bbox) badTriangles = buildBadTriangles(P,triangulation) if(step == "badT") then -- draw all triangle @@ -790,7 +790,7 @@ function TeXOnePointTikZBW(chaine,point,step,scale,mode,bbox,color,colorBack,col -- point is a number P, listPoints = buildListExt(chaine,tonumber(point)) end - output = TeXaddOnePointTikZ(chaine,point,step,color,colorBack,colorNew,colorCircle,colorBbox) + output = TeXaddOnePointTikZ(listPoints,P,step,bbox,color,colorBack,colorNew,colorCircle,colorBbox) output = "\\noindent\\begin{tikzpicture}[x="..scale..",y="..scale.."]".. output .. "\\end{tikzpicture}" tex.sprint(output) end @@ -804,7 +804,7 @@ function TeXOnePointTikZBWinc(chaine,point,beginning, ending,step,scale,mode,bbo -- point is a number P, listPoints = buildListExt(chaine,tonumber(point)) end - output = TeXaddOnePointTikZ(chaine,point,step,color,colorBack,colorNew,colorCircle,colorBbox) + output = TeXaddOnePointTikZ(listPoints,P,step,bbox,color,colorBack,colorNew,colorCircle,colorBbox) output = "\\noindent\\begin{tikzpicture}[x="..scale..",y="..scale.."]".. beginning..output ..ending.. "\\end{tikzpicture}" tex.sprint(output) end