diff options
author | Karl Berry <karl@freefriends.org> | 2024-08-29 20:31:12 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2024-08-29 20:31:12 +0000 |
commit | 02d705e3100e41f5dbff78580d0a1e3fdd44598a (patch) | |
tree | ca1b0eb710dfe421e702dfc70cea341c543a49d8 /Master/texmf-dist/tex/lualatex | |
parent | c86d4160584c8cfeeacb73f837cd3477e48abff0 (diff) |
domaincoloring (29aug24)
git-svn-id: svn://tug.org/texlive/trunk@72133 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/lualatex')
3 files changed, 36 insertions, 26 deletions
diff --git a/Master/texmf-dist/tex/lualatex/domaincoloring/domaincoloring-functions.lua b/Master/texmf-dist/tex/lualatex/domaincoloring/domaincoloring-functions.lua index bd71f282ce7..0d7b70b058a 100644 --- a/Master/texmf-dist/tex/lualatex/domaincoloring/domaincoloring-functions.lua +++ b/Master/texmf-dist/tex/lualatex/domaincoloring/domaincoloring-functions.lua @@ -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 @@ function f14(z) 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 diff --git a/Master/texmf-dist/tex/lualatex/domaincoloring/domaincoloring.lua b/Master/texmf-dist/tex/lualatex/domaincoloring/domaincoloring.lua index 872acc762f0..636c4f28df2 100644 --- a/Master/texmf-dist/tex/lualatex/domaincoloring/domaincoloring.lua +++ b/Master/texmf-dist/tex/lualatex/domaincoloring/domaincoloring.lua @@ -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 @@ if func~=nil then 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 diff --git a/Master/texmf-dist/tex/lualatex/domaincoloring/domaincoloring.sty b/Master/texmf-dist/tex/lualatex/domaincoloring/domaincoloring.sty index 170e1897f03..0eefeb37a49 100644 --- a/Master/texmf-dist/tex/lualatex/domaincoloring/domaincoloring.sty +++ b/Master/texmf-dist/tex/lualatex/domaincoloring/domaincoloring.sty @@ -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 |