From: Maxime Chupin (escudo) Date: Thu, 24 Nov 2016 23:07:23 +0000 (+0100) Subject: Bounding box points correctement labelé avec tikz, et avancées documentation X-Git-Url: https://melusine.eu.org/syracuse/G/git/?a=commitdiff_plain;h=5921eb363f3873328cc96cb4321b2f6387b8f3f5;p=delaunay.git Bounding box points correctement labelé avec tikz, et avancées documentation --- diff --git a/doc/luamesh-doc.listing b/doc/luamesh-doc.listing index eaf92de..fff4398 100644 --- a/doc/luamesh-doc.listing +++ b/doc/luamesh-doc.listing @@ -1 +1,10 @@ - \buildMeshBW{(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)} + \buildMeshBW[% + tikz, + mode = ext, + bbox = show, + color = red, + colorBbox = blue!30, + print = points, + meshpoint = x, + scale = 1.3cm, + ]{mesh.txt} diff --git a/doc/luamesh-doc.pdf b/doc/luamesh-doc.pdf index 7223947..0212308 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 d2477b8..e59f7fc 100644 --- a/doc/luamesh-doc.tex +++ b/doc/luamesh-doc.tex @@ -23,7 +23,7 @@ }% ]{Vitem}} -\newcommand*\textme[1]{\color{black}{\rmfamily\textit{#1}}} +\newcommand*\textme[1]{\textcolor{black}{\rmfamily\textit{#1}}} \newcommand*\meta[1]{% % meta \textme{\ensuremath{\langle}#1\ensuremath{\rangle}}} \newcommand*\optstar{% % optional star @@ -195,7 +195,7 @@ points must be given in the following way : There are several options to customize the drawing. \begin{optionsenum} -\item[\color{red}\texttt{mode = int (default) or ext}:] the mode option allow to +\item[mode = int (default) 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 : @@ -206,8 +206,58 @@ x3 y3 ... xn yn \end{verbatim} +\item[bbox = none (default) 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})$, + $(x_{\max},y_{\max})$, and $(x_{\min},y_{\max})$.} 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[print = none (default) 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 + mode delimiters \Verb+$...$+. The bounding box points are labeled + with a star exponent, and numbered from 1 to 4. +\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} +To illustrate the options, let us show you an example. We consider a +file \Verb+mesh.txt+: +\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} +\begin{Exemple} + \buildMeshBW[% + tikz, + mode = ext, + bbox = show, + color = red, + colorBbox = blue!30, + print = points, + meshpoint = x, + scale = 1.3cm, + ]{mesh.txt} +\end{Exemple} + \subsection{Draw the Set of Points} \commande|\tracePointsMesh[«options»]{«list of points» or «file name»}| diff --git a/doc/mesh.txt b/doc/mesh.txt new file mode 100644 index 0000000..37b6920 --- /dev/null +++ b/doc/mesh.txt @@ -0,0 +1,7 @@ +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 diff --git a/luamesh.lua b/luamesh.lua index c8ffc51..842391b 100644 --- a/luamesh.lua +++ b/luamesh.lua @@ -266,9 +266,11 @@ function traceMeshTikZ(listPoints, triangulation,points,color,colorBbox) 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_{" .. i .. "}$};" + output = output .. "\\draw[color="..colorBbox.."] (" .. 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 .. "}$};" end @@ -381,9 +383,11 @@ end function tracePointsTikZ(listPoints,points,color,colorBbox) output = ""; 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_{" .. i .. "}$};" + output = output .. "\\draw[color="..colorBbox.."] (" .. 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 .. "}$};" end @@ -531,9 +535,11 @@ function TeXaddOnePointTikZ(chaine,point,step,color,colorBack, colorNew, colorCi output = output .. "\\draw[dashed, color="..colorCircle.."] ("..center.x .. "," .. center.y .. ") circle ("..radius ..");" end -- mark the points + 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_{" .. i .. "}$};" + output = output .. "\\draw[color="..colorBbox.."] (" .. 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 .. "}$};" end @@ -566,9 +572,11 @@ function TeXaddOnePointTikZ(chaine,point,step,color,colorBack, colorNew, colorCi end output = output .. "\\draw[color="..colorNew..",fill ="..colorBack..", thick] " .. path .. "cycle;" -- mark the points of the mesh + 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_{" .. i .. "}$};" + output = output .. "\\draw[color="..colorBbox.."] (" .. 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 .. "}$};" end @@ -607,9 +615,11 @@ function TeXaddOnePointTikZ(chaine,point,step,color,colorBack, colorNew, colorCi output = output .. "\\draw[color="..colorNew..", thick]".."(".. listPoints[polygon[i][2]].x .. "," .. listPoints[polygon[i][2]].y .. ") -- (" .. P.x .. "," .. P.y ..");" end -- mark points + 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_{" .. i .. "}$};" + output = output .. "\\draw[color="..colorBbox.."] (" .. 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 .. "}$};" end diff --git a/test/animation.pdf b/test/animation.pdf index 0804e6d..ac28b61 100644 Binary files a/test/animation.pdf and b/test/animation.pdf differ