texlive[72133] Master/texmf-dist: domaincoloring (29aug24)
commits+karl at tug.org
commits+karl at tug.org
Thu Aug 29 22:31:12 CEST 2024
Revision: 72133
https://tug.org/svn/texlive?view=revision&revision=72133
Author: karl
Date: 2024-08-29 22:31:12 +0200 (Thu, 29 Aug 2024)
Log Message:
-----------
domaincoloring (29aug24)
Modified Paths:
--------------
trunk/Master/texmf-dist/doc/lualatex/domaincoloring/Changes
trunk/Master/texmf-dist/doc/lualatex/domaincoloring/domaincoloring-doc.pdf
trunk/Master/texmf-dist/doc/lualatex/domaincoloring/domaincoloring-doc.tex
trunk/Master/texmf-dist/tex/lualatex/domaincoloring/domaincoloring-functions.lua
trunk/Master/texmf-dist/tex/lualatex/domaincoloring/domaincoloring.lua
trunk/Master/texmf-dist/tex/lualatex/domaincoloring/domaincoloring.sty
Added Paths:
-----------
trunk/Master/texmf-dist/doc/lualatex/domaincoloring/titleImg.png
Removed Paths:
-------------
trunk/Master/texmf-dist/doc/lualatex/domaincoloring/titleImg.pdf
Modified: trunk/Master/texmf-dist/doc/lualatex/domaincoloring/Changes
===================================================================
--- trunk/Master/texmf-dist/doc/lualatex/domaincoloring/Changes 2024-08-29 20:30:59 UTC (rev 72132)
+++ trunk/Master/texmf-dist/doc/lualatex/domaincoloring/Changes 2024-08-29 20:31:12 UTC (rev 72133)
@@ -1,3 +1,4 @@
+0.04 2024-08-29 - bugfix for phi (was [0,2pi], bust must be [0,1])
0.03 2024-08-26 - use \jobname for temporary file
- added option force for not creating already existing pdf's
- allow different x|y resolutions
Modified: trunk/Master/texmf-dist/doc/lualatex/domaincoloring/domaincoloring-doc.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/lualatex/domaincoloring/domaincoloring-doc.tex
===================================================================
--- trunk/Master/texmf-dist/doc/lualatex/domaincoloring/domaincoloring-doc.tex 2024-08-29 20:30:59 UTC (rev 72132)
+++ trunk/Master/texmf-dist/doc/lualatex/domaincoloring/domaincoloring-doc.tex 2024-08-29 20:31:12 UTC (rev 72133)
@@ -1,4 +1,4 @@
-%% $Id: domaincoloring-doc.tex 966 2024-08-26 19:55:11Z herbert $
+%% $Id: domaincoloring-doc.tex 968 2024-08-29 11:44:46Z herbert $
%
\listfiles
@@ -95,6 +95,7 @@
\Lkeyword{invers} & false & inverted colors with $color=|color-255|$\\
\Lkeyword{force} & true & With \texttt{force=false} an existing pdf file will be used
without calculating a new one.\\
+\Lkeyword{grid} & false & draw a grid with one dashed subgrid at 0.5\\
\bottomrule
\end{xltabular}
@@ -103,9 +104,9 @@
\section{Examples}
-\subsection{The default with function $f(z)=z$}
+\subsection{The default with function $f(z)=z$ and $f(z)=1/z$}
\begin{lstlisting}
-\DomainColoring{z} % default filename \jobname-tmp.png
+\DomainColoring{z} % default filename \jobname-tmp.png
\end{lstlisting}
\noindent
@@ -117,7 +118,7 @@
\subsection{Defining domain, color mode, resolution and filename}
\begin{align}
- f(z) &= \cos(z)/\sin(z^4-1)
+ f(z) &= \cos(z)/\sin(z^4-1)
\end{align}
in Lua-notation: \verb|cmath.cos(z)/cmath.sin(z^4-1)|. All complex functions
@@ -125,30 +126,32 @@
can be omitted.
\begin{lstlisting}
-\DomainColoring[domain={-2.5,2.5,-2.5,2.5},resolution=500,
- grfOptions={width=0.32\linewidth},
+\DomainColoring[domain={-2.5,2.5,-2.5,2.5},resolution=500,hsvrgb={phi,1,r},
+grfOptions={width=0.32\linewidth},
filename=\jobname-tmp1a]{cmath.cos(z)/cmath.sin(z^4-1)}
\hfill
\frame{\DomainColoring[domain={-2.5,2.5,-2.5,2.5},resolution=500,
- bgcolor=true,grfOptions={width=0.32\linewidth},bgcolor=3,
+ bgcolor=3,hsvrgb={phi,1,r},grfOptions={width=0.32\linewidth},
filename=\jobname-tmp1b]{cmath.cos(z)/cmath.sin(z^4-1)}}
\hfill
-\frame{\DomainColoring[domain={-2.5,2.5,-2.5,2.5},resolution=500,
- invers=true,,grfOptions={width=0.32\linewidth},
+\frame{\DomainColoring[domain={-2.5,2.5,-2.5,2.5},resolution=500,invers=true,
+ hsvrgb={phi,1,r}, grfOptions={width=0.32\linewidth},
filename=\jobname-tmp1c]{cmath.cos(z)/cmath.sin(z^4-1)}}
\end{lstlisting}
\noindent
-\DomainColoring[domain={-2.5,2.5,-2.5,2.5},resolution=500,grfOptions={width=0.32\linewidth},
+\DomainColoring[domain={-2.5,2.5,-2.5,2.5},resolution=500,hsvrgb={phi,1,r},
+grfOptions={width=0.32\linewidth},
filename=\jobname-tmp1a]{cmath.cos(z)/cmath.sin(z^4-1)}
\hfill
-\frame{\DomainColoring[domain={-2.5,2.5,-2.5,2.5},resolution=500,bgcolor=3,grfOptions={width=0.32\linewidth},
+\frame{\DomainColoring[domain={-2.5,2.5,-2.5,2.5},resolution=500,bgcolor=3,hsvrgb={phi,1,r},
+grfOptions={width=0.32\linewidth},
filename=\jobname-tmp1b]{cmath.cos(z)/cmath.sin(z^4-1)}}
\hfill
-\frame{\DomainColoring[domain={-2.5,2.5,-2.5,2.5},resolution=500,invers=true,grfOptions={width=0.32\linewidth},
+\frame{\DomainColoring[domain={-2.5,2.5,-2.5,2.5},resolution=500,invers=true,hsvrgb={phi,1,r},
+grfOptions={width=0.32\linewidth},
filename=\jobname-tmp1c]{cmath.cos(z)/cmath.sin(z^4-1)}}
-
With \Lkeyword{bgcolor}\texttt{=<int>} all RGB-combinations with a sum $R+G+B <= \text{int}$ are set to
the color white.
@@ -158,13 +161,13 @@
\begin{lstlisting}
\DomainColoring[grfOptions={width=0.49\linewidth},filename=\jobname-tmp2a]{cmath.sin(z)}\hfill
\hfill
-\DomainColoring[grfOptions={width=0.49\linewidth},filename=\jobname-tmp2b]{1/cmath.sin(z)}
+\DomainColoring[grfOptions={width=0.49\linewidth},filename=\jobname-tmp2b]{cmath.sin(0.9*z)*cmath.sin(z)}
\end{lstlisting}
\noindent
\DomainColoring[grfOptions={width=0.49\linewidth},filename=\jobname-tmp2a]{cmath.sin(z)}
\hfill
-\DomainColoring[grfOptions={width=0.49\linewidth},filename=\jobname-tmp2b]{1/cmath.sin(z)}
+\DomainColoring[grfOptions={width=0.49\linewidth},filename=\jobname-tmp2b]{cmath.sin(0.9*z)*cmath.sin(z)}
\subsection{Higher resolution}
@@ -176,8 +179,7 @@
\begin{lstlisting}
-\DomainColoring[filename=\jobname-tmp3,resolution=1000,
- grfOptions={width=0.49\linewidth}]{z^3-1}
+\DomainColoring[filename=\jobname-tmp3,resolution=1000,grfOptions={width=0.49\linewidth}]{z^3-1}
\hfill
\DomainColoring[filename=\jobname-tmp4,resolution=1000,
grfOptions={width=0.49\linewidth}]{(z+1)^2*(z-1)/((z+i)*(z-i)^2)}
@@ -211,7 +213,7 @@
\DomainColoring[filename=\jobname-tmp5a,resolution=1000,
grfOptions={width=0.49\linewidth},hsvrgb={phi,1,r}]{cmath.sin(z)*cmath.sin(0.99*z)}
\hfill
-\DomainColoring[filename=\jobname-tmp5b,resolution=1000,
+\DomainColoring[filename=\jobname-tmp5b,resolution=1000,,hsvrgb={phi,r,1},
grfOptions={width=0.49\linewidth}]{cmath.sin(z)*cmath.sin(0.99*z)} % the default
\end{lstlisting}
@@ -219,7 +221,7 @@
\DomainColoring[filename=\jobname-tmp5a,resolution=1000,
grfOptions={width=0.49\linewidth},funcName=f10,hsvrgb={phi,1,r}]{cmath.sin(z)*cmath.sin(0.99*z)} % the default
\hfill
-\DomainColoring[filename=\jobname-tmp5b,resolution=1000,
+\DomainColoring[filename=\jobname-tmp5b,resolution=1000,,hsvrgb={phi,r,1},
grfOptions={width=0.49\linewidth}]{cmath.sin(z)*cmath.sin(0.99*z)}
%For $r$ and $\phi$ we have to use $r$ and $phi$.
@@ -238,25 +240,23 @@
of \Lcs{DomainColoring} has no meaning and can be empty.
\begin{lstlisting}
-\DomainColoring[filename=\jobname-tmp6a,resolution=1000,
- domain={-1.5,1.5,-1.5,1.5}, grfOptions={width=0.49\linewidth},
- hsvrgb={phi+pi,1,2/r}, funcName=f12]{}% using predefined function
+\DomainColoring[domain={-1.5,1.5,-1.5,1.5},resolution={1001,1001},hsvrgb={phi,1,1/r},
+ filename=\jobname-tmp4.png, grfOptions={width=0.49\linewidth},funcName=f12,bgcolor=5]{}
\hfill
-\DomainColoring[filename=\jobname-tmp6b,resolution=2000,
- domain={-2.3,0.7,-1.5,1.5}, grfOptions={width=0.49\linewidth},
- hsvrgb={phi+pi,1,2/r},funcName=f13]{}
+\DomainColoring[domain={-2.5,1.5,-2,2},resolution={1001,1001},hsvrgb={phi,1,1/r},
+ filename=\jobname-tmp5.png, grfOptions={width=0.49\linewidth},funcName=f13,bgcolor=5]{}
\end{lstlisting}
+
\noindent
-\DomainColoring[filename=\jobname-tmp6a,resolution=1000,
- domain={-1.5,1.5,-1.5,1.5}, grfOptions={width=0.49\linewidth},
- hsvrgb={phi+pi,1,2/r}, funcName=f12]{}% using predefined function
+\DomainColoring[domain={-1.5,1.5,-1.5,1.5},resolution={1001,1001},hsvrgb={phi,1,1/r},
+ filename=\jobname-tmp4.png, grfOptions={width=0.49\linewidth},funcName=f12,bgcolor=5]{}
\hfill
-\DomainColoring[filename=\jobname-tmp6b,resolution=2000,
- domain={-2.3,0.7,-1.5,1.5}, grfOptions={width=0.49\linewidth},
- hsvrgb={phi+pi,1,2/r},funcName=f13]{}
+\DomainColoring[domain={-2.5,1.5,-2,2},resolution={1001,1001},hsvrgb={phi,1,1/r},
+ filename=\jobname-tmp5.png, grfOptions={width=0.49\linewidth},funcName=f13,bgcolor=5]{}
+
The contents of the function file of the current version of \LPack{domaincoloring} is::
\lstinputlisting[language={[5.3]Lua},basicstyle=\small\ttfamily]{domaincoloring-functions.lua}
Deleted: trunk/Master/texmf-dist/doc/lualatex/domaincoloring/titleImg.pdf
===================================================================
(Binary files differ)
Added: trunk/Master/texmf-dist/doc/lualatex/domaincoloring/titleImg.png
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/lualatex/domaincoloring/titleImg.png
===================================================================
--- trunk/Master/texmf-dist/doc/lualatex/domaincoloring/titleImg.png 2024-08-29 20:30:59 UTC (rev 72132)
+++ trunk/Master/texmf-dist/doc/lualatex/domaincoloring/titleImg.png 2024-08-29 20:31:12 UTC (rev 72133)
Property changes on: trunk/Master/texmf-dist/doc/lualatex/domaincoloring/titleImg.png
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Modified: trunk/Master/texmf-dist/tex/lualatex/domaincoloring/domaincoloring-functions.lua
===================================================================
--- trunk/Master/texmf-dist/tex/lualatex/domaincoloring/domaincoloring-functions.lua 2024-08-29 20:30:59 UTC (rev 72132)
+++ trunk/Master/texmf-dist/tex/lualatex/domaincoloring/domaincoloring-functions.lua 2024-08-29 20:31:12 UTC (rev 72133)
@@ -1,4 +1,4 @@
--- $Id: domaincoloring-functions.lua 965 2024-08-26 17:50:33Z herbert $
+-- $Id: domaincoloring-functions.lua 968 2024-08-29 11:44:46Z herbert $
kpse.set_program_name("luatex")
@@ -82,3 +82,14 @@
return z
end
+function f15(z)
+ local alpha = 4
+ local C0 = complex(1,0)
+ local C1 = 2 * alpha * z
+ for n = 2,20 do
+ C = (2*z*(n+alpha-1)*C1 - (n+2*alpha-2)*C0)/n
+ C0 = C1
+ C1 = C
+ end
+ return C
+end
\ No newline at end of file
Modified: trunk/Master/texmf-dist/tex/lualatex/domaincoloring/domaincoloring.lua
===================================================================
--- trunk/Master/texmf-dist/tex/lualatex/domaincoloring/domaincoloring.lua 2024-08-29 20:30:59 UTC (rev 72132)
+++ trunk/Master/texmf-dist/tex/lualatex/domaincoloring/domaincoloring.lua 2024-08-29 20:31:12 UTC (rev 72133)
@@ -1,4 +1,4 @@
--- $Id: domaincoloring.lua 965 2024-08-26 17:50:33Z herbert $
+-- $Id: domaincoloring.lua 968 2024-08-29 11:44:46Z herbert $
-----------------------------------------------------------------------
-- FILE: domaincoloring.lua
@@ -9,7 +9,7 @@
--
-----------------------------------------------------------------------
-local version = 0.03
+local version = 0.04
kpse.set_program_name("luatex")
@@ -22,35 +22,34 @@
end
local function HSVtoRGB(h, s, v)
+-- if h == 1 then h = 0 end
local i = math.floor(h * 6)
local f = h * 6 - i
local p = v * (1 - s)
- local q = v * (1 - f * s)
- local t = v * (1 - (1 - f) * s)
- local no = i % 6
- if no == 0 then return v,t,p
- elseif no == 1 then return q,v,p
- elseif no == 2 then return p,v,t
- elseif no == 3 then return p,q,v
- elseif no == 4 then return t,p,v
- else return v,p,q
+ local q = v * (1 - s * f)
+ local t = v * (1 - s * (1 - f))
+ v = math.floor(255*v) % 256
+ p = math.floor(255*p) % 256
+ q = math.floor(255*q) % 256
+ t = math.floor(255*t) % 256
+ if i == 0 then return v,t,p
+ elseif i == 1 then return q,v,p
+ elseif i == 2 then return p,v,t
+ elseif i == 3 then return p,q,v
+ elseif i == 4 then return t,p,v
+ elseif i == 5 then return v,p,q
+ else return v,v,v
end
end
function my_color_scheme(z,hsvrgb)
r, phi = cmath.polar(z)
--- phi is in -pi,+pi; change it to [0;2pi]
- phi = phi+pi
+-- phi is in -pi,+pi; change it to [0;2pi] and normalize it to [0;1]
+ phi = (phi+pi)/(2*pi)
h_str,s_str,v_str = hsvrgb:match("([^,]+),([^,]+),([^,]+)")
--- h = load("return "..h_str)()
--- s = load("return "..s_str)()
--- v = load("return "..v_str)()
- --h,s,v = loadstring("return"..hsvrgb)
- -- R,G,B, is [0,...,1]
+-- print(load("return "..h_str)(),load("return "..s_str)(),load("return "..v_str)())
R,G,B = HSVtoRGB(load("return "..h_str)(),load("return "..s_str)(),load("return "..v_str)()) -- h,s,v) -- (phi+3.14,1,r)
- return { math.fmod(math.floor(R*255+0.5),255),
- math.fmod(math.floor(G*255+0.5),255),
- math.fmod(math.floor(B*255+0.5),255) }
+ return {R,G,B}
end
Modified: trunk/Master/texmf-dist/tex/lualatex/domaincoloring/domaincoloring.sty
===================================================================
--- trunk/Master/texmf-dist/tex/lualatex/domaincoloring/domaincoloring.sty 2024-08-29 20:30:59 UTC (rev 72132)
+++ trunk/Master/texmf-dist/tex/lualatex/domaincoloring/domaincoloring.sty 2024-08-29 20:31:12 UTC (rev 72133)
@@ -1,4 +1,4 @@
-%% $Id: domaincoloring.sty 966 2024-08-26 19:55:11Z herbert $
+%% $Id: domaincoloring.sty 968 2024-08-29 11:44:46Z herbert $
%% This is file `domaincoloring.sty',
%%
%% Copyright (C) 2024- Herbert Voss
@@ -14,8 +14,8 @@
\RequirePackage{graphicx}
\RequirePackage{shellesc}
-\def\fileversion{0.03}
-\def\filedate{2024/08/26}
+\def\fileversion{0.04}
+\def\filedate{2024/08/29}
\message{`DCol' v\fileversion, \filedate}
\ProvidesPackage{domaincoloring}
[\filedate\ \fileversion\ package for domain coloring of complex functions]
@@ -48,7 +48,7 @@
\setDColkeys{
funcName={}, % corresponding to external file
- hsvrgb={phi+pi,1,r}, % given (r,phi) of the complex value
+ hsvrgb={phi,1,1}, % given (r,phi) of the complex value
filename=\jobname-tmp, % the external image filename
resolution=500, % pixel per (x|y) interval
domain={-2,2,-2,2}, % x|y domain
More information about the tex-live-commits
mailing list.