Object version of 'Talis & Friends' in
tma2.ufm. Switchable Mandelbrot/Julia.
Many thanks to Dave Makin for the
switch!
v 1.0, 2008.06.03
v1.01, 2008.11.05 (fixed small bug)
class TMA_SwitchTalis(mmf.ulb:MMF_SwitchDivergentFormula) {
;
; Object version of 'Talis & Friends' in
; tma2.ufm. Switchable Mandelbrot/Julia.
; Many thanks to Dave Makin for the
; switch!
; v 1.0, 2008.06.03
; v1.01, 2008.11.05 (fixed small bug)
;
public:
; These sections are not necessary, since they will automatically be called
; as part of the parent class
; func TMA_SwitchTalis(Generic pparent)
; MMF_SwitchDivergentFormula.MMF_SwitchDivergentFormula(pparent)
; endfunc
; complex func Init(complex pz) Done in the parent class
; return MMF_SwitchDivergentFormula.Init(pz)
; endfunc
complex func Iterate(complex pz)
complex imagz = @imagz*(0,1)
complex z0 = 0
if @type == false
if @zprime == 0
z0 = real(@fnreal(pz-@realz))+flip(imag(@fnimag(pz-imagz)))
elseif @zprime == 1
z0 = real(@fnreal(pz-@realz))-flip(imag(@fnimag(pz-imagz)))
elseif @zprime == 2
z0 = flip(imag(@fnimag(pz-imagz)))-real(@fnreal(pz-@realz))
endif
else
if @zprime == 0
z0 = @fnreal(real(pz-@realz))+@fnimag(flip(imag(pz-imagz)))
elseif @zprime == 1
z0 = @fnreal(real(pz-@realz))-@fnimag(flip(imag(pz-imagz)))
elseif @zprime == 2
z0 = @fnimag(flip(imag(pz-imagz)))-@fnreal(real(pz-@realz))
endif
endif
; Select the global definition of Z
if @select == "z"; select variable type
if @version < 1.01
pz = @fnz(z0-@zg)*@ezg
else
z0 = @fnz(z0-@zg)*@ezg
endif
elseif @select == "z+c"
z0 = @fnz(z0-@zg)*@ezg + @fnc((fConstant-@cg)*@cmg)^@ecg
elseif @select == "z-c"
z0 = @fnz(z0-@zg)*@ezg - @fnc((fConstant-@cg)*@cmg)^@ecg
elseif @select == "c-z"
z0 = @fnc((fConstant-@cg)*@cmg)^@ecg - @fnz(z0-@zg)*@ezg
elseif @select == "z*c"
z0 = @fnz(z0-@zg)*@ezg * @fnc((fConstant-@cg)*@cmg)^@ecg
elseif @select == "z/c"
z0 = @fnz(z0-@zg)*@ezg / @fnc((fConstant-@cg)*@cmg)^@ecg
elseif @select == "z+c|z+c"
z0 = @fnz(z0-@zg)*@ezg + @fnc((fConstant-@cg)*@cmg)^@ecg
z0 = @fnz(z0-@zg)*@ezg + @fnc((fConstant-@cg)*@cmg)^@ecg
elseif @select == "z+c|c-z"
z0 = @fnz(z0-@zg)*@ezg + @fnc((fConstant-@cg)*@cmg)^@ecg
z0 = @fnc((fConstant-@cg)*@cmg)^@ecg - @fnz(z0-@zg)*@ezg
elseif @select == "z+c|z*c"
z0 = @fnz(z0-@zg)*@ezg + @fnc((fConstant-@cg)*@cmg)^@ecg
z0 = @fnz(z0-@zg)*@ezg * @fnc((fConstant-@cg)*@cmg)^@ecg
elseif @select == "z+c|z/c"
z0 = @fnz(z0-@zg)*@ezg + @fnc((fConstant-@cg)*@cmg)^@ecg
z0 = @fnz(z0-@zg)*@ezg / @fnc((fConstant-@cg)*@cmg)^@ecg
elseif @select == "z-c|z-c"
z0 = @fnz(z0-@zg)*@ezg - @fnc((fConstant-@cg)*@cmg)^@ecg
z0 = @fnz(z0-@zg)*@ezg - @fnc((fConstant-@cg)*@cmg)^@ecg
elseif @select == "z-c|c-z"
z0 = @fnz(z0-@zg)*@ezg - @fnc((fConstant-@cg)*@cmg)^@ecg
z0 = @fnc((fConstant-@cg)*@cmg)^@ecg - @fnz(z0-@zg)*@ezg
elseif @select == "z-c|z*c"
z0 = @fnz(z0-@zg)*@ezg - @fnc((fConstant-@cg)*@cmg)^@ecg
z0 = @fnz(z0-@zg)*@ezg * @fnc((fConstant-@cg)*@cmg)^@ecg
elseif @select == "z-c|z/c"
z0 = @fnz(z0-@zg)*@ezg - @fnc((fConstant-@cg)*@cmg)^@ecg
z0 = @fnz(z0-@zg)*@ezg / @fnc((fConstant-@cg)*@cmg)^@ecg
elseif @select == "c-z|z*c"
z0 = @fnc((fConstant-@cg)*@cmg)^@ecg - @fnz(z0-@zg)*@ezg
z0 = @fnz(z0-@zg)*@ezg * @fnc((fConstant-@cg)*@cmg)^@ecg
elseif @select == "c-z|z/c"
z0 = @fnc((fConstant-@cg)*@cmg)^@ecg - @fnz(z0-@zg)*@ezg
z0 = @fnz(z0-@zg)*@ezg / @fnc((fConstant-@cg)*@cmg)^@ecg
elseif @select == "z*c|c-z"
z0 = @fnz(z0-@zg)*@ezg * @fnc((fConstant-@cg)*@cmg)^@ecg
z0 = @fnc((fConstant-@cg)*@cmg)^@ecg - @fnz(z0-@zg)*@ezg
elseif @select == "z*c|z*c"
z0 = @fnz(z0-@zg)*@ezg * @fnc((fConstant-@cg)*@cmg)^@ecg
z0 = @fnz(z0-@zg)*@ezg * @fnc((fConstant-@cg)*@cmg)^@ecg
elseif @select == "z/c|z+c"
z0 = @fnz(z0-@zg)*@ezg / @fnc((fConstant-@cg)*@cmg)^@ecg
z0 = @fnz(z0-@zg)*@ezg + @fnc((fConstant-@cg)*@cmg)^@ecg
elseif @select == "z/c|z-c"
z0 = @fnz(z0-@zg)*@ezg / @fnc((fConstant-@cg)*@cmg)^@ecg
z0 = @fnz(z0-@zg)*@ezg - @fnc((fConstant-@cg)*@cmg)^@ecg
elseif @select == "z/c|c-z"
z0 = @fnz(z0-@zg)*@ezg / @fnc((fConstant-@cg)*@cmg)^@ecg
z0 = @fnc((fConstant-@cg)*@cmg)^@ecg - @fnz(z0-@zg)*@ezg
elseif @select == "z/c|z/c"
z0 = @fnz(z0-@zg)*@ezg / @fnc((fConstant-@cg)*@cmg)^@ecg
z0 = @fnz(z0-@zg)*@ezg / @fnc((fConstant-@cg)*@cmg)^@ecg
elseif @select == "z*c+(Rz+Iz)"
z0 = (@fnz(z0-@zg)*@ezg*@fnc((fConstant-@cg)*@cmg)^@ecg)+((real(z0+@addz)\
*@muz)^@exz+(imag(z0+@addz)*@muz1)^@exz1)
elseif @select == "z/c+(Rz+Iz)"
z0 = (@fnz(z0-@zg)*@ezg/@fnc((fConstant-@cg)*@cmg)^@ecg)+((real(z0+@addz)\
*@muz)^@exz+(imag(z0+@addz)*@muz1)^@exz1)
elseif @select == "z/c-(Rz+Iz)"
z0 = (@fnz(z0-@zg)*@ezg/@fnc((fConstant-@cg)*@cmg)^@ecg)-((real(z0+@addz)\
*@muz)^@exz+(imag(z0+@addz)*@muz1)^@exz1)
elseif @select == "z*c-+(Rz+Iz)"
z0 = (@fnz(z0-@zg)*@ezg*@fnc((fConstant-@cg)*@cmg)^@ecg)-((real(z0+@addz)\
*@muz)\
^@exz+(imag(z0+@addz)*@muz1)^@exz1)
z0 = (@fnz(z0-@zg)*@ezg*@fnc((fConstant-@cg)*@cmg)^@ecg)+((real(z0+@addz)\
*@muz)^@exz+(imag(z0+@addz)*@muz1)^@exz1)
elseif @select == "z/c-+(Rz+Iz)"
z0 = (@fnz(z0-@zg)*@ezg/@fnc((fConstant-@cg)*@cmg)^@ecg)-((real(z0+@addz)\
*@muz)^@exz+(imag(z0+@addz)*@muz1)^@exz1)
z0 = (@fnz(z0-@zg)*@ezg/@fnc((fConstant-@cg)*@cmg)^@ecg)+((real(z0+@addz)\
*@muz)^@exz+(imag(z0+@addz)*@muz1)^@exz1)
elseif @select == "z*c+(Rz+Iz)|z+c"
z0 = (@fnz(z0-@zg)*@ezg*@fnc((fConstant-@cg)*@cmg)^@ecg)+((real(z0+@addz)\
*@muz)^@exz+(imag(z0+@addz)*@muz1)^@exz1)
z0 = @fnz(z0-@zg)*@ezg + @fnc((fConstant-@cg)*@cmg)^@ecg
elseif @select == "z*c+(Rz+Iz)|z-c"
z0 = (@fnz(z0-@zg)*@ezg*@fnc((fConstant-@cg)*@cmg)^@ecg)+((real(z0+@addz)\
*@muz)^@exz+(imag(z0+@addz)*@muz1)^@exz1)
z0 = @fnz(z0-@zg)*@ezg - @fnc((fConstant-@cg)*@cmg)^@ecg
elseif @select == "z*c+(Rz+Iz)|c-z"
z0 = (@fnz(z0-@zg)*@ezg*@fnc((fConstant-@cg)*@cmg)^@ecg)+((real(z0+@addz)\
*@muz)^@exz+(imag(z0+@addz)*@muz1)^@exz1)
z0 = @fnc((fConstant-@cg)*@cmg)^@ecg - @fnz(z0-@zg)*@ezg
elseif @select == "z*c+(Rz+Iz)|z*c"
z0 = (@fnz(z0-@zg)*@ezg*@fnc((fConstant-@cg)*@cmg)^@ecg)+((real(z0+@addz)\
*@muz)^@exz+(imag(z0+@addz)*@muz1)^@exz1)
z0 = @fnz(z0-@zg)*@ezg * @fnc((fConstant-@cg)*@cmg)^@ecg
elseif @select == "z*c+(Rz+Iz)|z/c"
z0 = (@fnz(z0-@zg)*@ezg*@fnc((fConstant-@cg)*@cmg)^@ecg)+((real(z0+@addz)\
*@muz)^@exz+(imag(z0+@addz)*@muz1)^@exz1)
z0 = @fnz(z0-@zg)*@ezg / @fnc((fConstant-@cg)*@cmg)^@ecg
endif
c1 = @cfunc(((fConstant-@pc1)*@pc2)^@pc3)
if (@zsplit == false)
if (@selform==0) ; Normal
z0 = z0
elseif (@selform==1) ; Mandelbrot
z0 = z0^2+c1
elseif (@selform==2) ; Barnsley
if real(z0) > 0
z0 = (z0-1)*c1
else
z0 = (z0+1)*c1
endif
elseif (@selform==3) ; Ikenaga Modified
z0 = z0^3+z0*(c1-1)*fConstant
elseif (@selform==4) ; Ikenaga Original
z0 = z0*z0*z0+z0*c1-z0-c1
elseif @selform == 5; Mandel Lambda
z0 = z0*c1
endif
z0 = ((z0+@paddz)*@pmuz)^@pexz
endif
if @var == "Talis"
pz =@fn1((z0-@p1)*@p1a)*@fn2(z0)/@fn3(@p2+(@fn4(z0)*@p2a))+@fn5\
(fConstant-@p3)*@p3a
elseif @var == "Talis Var 1"
pz =@fn1(((z0-@p1)*@p1a)*@fn2(z0)-@fn6(z0)) /@fn3(@p2+(@fn4(z0)*@p2a))\
+@fn5(fConstant-@p3)*@p3a
elseif @var == "Talis Var 2"
pz =@fn1(((z0-@p1)*@p1a)*@fn2(z0)*@fn6(z0)) /@fn3(@p2+(@fn4(z0)*@p2a))\
+@fn5(fConstant-@p3)*@p3a
elseif @var == "Talis Var 3"
pz =@fn1(((z0-@p1)*@p1a)*@fn2(z0)*@fn6(z0)*pz) /@fn3(@p2+(@fn4(z0)*@p2a)\
*@fn7(z0)-@fn8(z0))+@fn5(fConstant-@p3)*@p3a
elseif @var == "Talis Var 4"
pz =@fn1(((z0-@p1)*@p1a)*@fn2(z0)*@fn6(z0)) /@fn3(@p2+(@fn4(z0)*@p2a)\
*@fn7(z0)-@fn8(z0))+@fn5(fConstant-@p3)*@p3a
elseif @var == "Talis Var 5"
pz =@fn1(((z0-@p1)*@p1a)*@fn2(z0)*@fn6(z0)) /@fn3(@p2+(@fn4(z0)*@p2a)\
*@fn7(z0)-@fn8(z0)-pz)+@fn5(fConstant-@p3)*@p3a
elseif @var == "Talis Var 6"
pz =@fn1(((z0-@p1)*@p1a)*@fn2(z0)*@fn6(z0)) /@fn3(@p2+(@fn4(z0)*@p2a)\
*@fn7(z0)-@fn8(z0)+pz)+@fn5(fConstant-@p3)*@p3a
endif
if (@zsplit == true)
if (@selform==0) ; Normal
pz = pz
elseif (@selform==1) ; Mandelbrot
pz = pz^2+c1
elseif (@selform==2) ; Barnsley
if real(pz) > 0
pz = (pz-1)*c1
else
pz = (pz+1)*c1
endif
elseif (@selform==3) ; Ikenaga Modified
pz = pz^3+pz*(c1-1)*c1
elseif (@selform==4) ; Ikenaga Original
pz = pz*pz*pz+pz*c1-pz-c1
elseif @selform == 5; Mandel Lambda
pz = pz*c1
endif
pz = ((pz+@paddz)*@pmuz)^@pexz
endif
return pz
endfunc
bool func IsBailedOut(complex pz)
bool bail = false
if @test == 0
bail = (|pz| > @p_bailout)
elseif @test == 1
bail = (sqr(real(pz)) > @p_bailout)
elseif @test == 2
bail = (sqr(imag(pz)) > @p_bailout)
elseif @test == 3
bail = (sqr(real(pz)) > @p_bailout || sqr(imag(pz)) > @p_bailout)
elseif @test == 4
bail = (sqr(real(pz)) > @p_bailout && sqr(imag(pz)) > @p_bailout)
elseif @test == 5
bail = (sqr(abs(real(pz)) + abs(imag(pz))) > @p_bailout)
elseif @test == 6
bail = (sqr(real(pz) + imag(pz)) > @p_bailout)
elseif @test == 7
bail = (sqr(real(@bailfunc(pz))) > @p_bailout)
endif
return bail
endfunc
default:
title = "Switch Talis and Friends"
rating = recommended
param p_power ; Overrides p_power from Formula
caption = "Power"
default = (2,0)
visible = false
enabled = false
endparam
param version
caption = "Version"
default = 1.01
visible = false
endparam
Heading
caption = "Initial Section"
Endheading
param select
caption = "Z Mode"
enum = "z""z+c""z-c""c-z""z*c""z/c""z+c|z+c""z+c|c-z""z+c|z*c"\
"z+c|z/c""z-c|z-c""z-c|c-z""z-c|z*c""z-c|z/c""c-z|z*c""c-z|z/c"\
"z*c|c-z""z*c|z*c""z/c|z+c""z/c|z-c""z/c|c-z""z/c|z/c"\
"z*c+(Rz+Iz)""z/c+(Rz+Iz)""z/c-(Rz+Iz)""z*c-+(Rz+Iz)"\
"z/c-+(Rz+Iz)""z*c+(Rz+Iz)|z+c""z*c+(Rz+Iz)|z-c""z*c+(Rz+Iz)|c-z"\
"z*c+(Rz+Iz)|z*c""z*c+(Rz+Iz)|z/c"
default = 0
hint = "Determines the initial definition of Z"
endparam
complex param zg
caption = "Z Param 1"
default = (0,0)
endparam
complex param ezg
caption = "Z Param 2"
default = (1,0)
endparam
complex param addz
caption = "Z Param 3"
default = (1.0,0.0)
visible = (@select == 22)||(@select == 23)||(@select == 24)||\
(@select == 25)||(@select == 26)|| (@select == 27)||\
(@select == 28)||(@select == 29)||(@select == 30)|| \
(@select == 31)
endparam
complex param muz
caption = "Z Strength re"
default = (1.0,0.0)
visible = (@select == 22)||(@select == 23)||(@select == 24)||\
(@select == 25)||(@select == 26)|| (@select == 27)||\
(@select == 28)||(@select == 29)||(@select == 30)|| \
(@select == 31)
endparam
complex param muz1
caption = "Z Strength im"
default = (1.0,0.0)
visible = (@select == 22)||(@select == 23)||(@select == 24)||\
(@select == 25)||(@select == 26)|| (@select == 27)||\
(@select == 28)||(@select == 29)||(@select == 30)|| \
(@select == 31)
endparam
complex param exz
caption = "Z Power re"
default = (1.0,0.0)
visible = (@select == 22)||(@select == 23)||(@select == 24)||\
(@select == 25)||(@select == 26)|| (@select == 27)||\
(@select == 28)||(@select == 29)||(@select == 30)|| \
(@select == 31)
endparam
complex param exz1
caption = "Z Power im"
default = (1.0,0.0)
visible = (@select == 22)||(@select == 23)||(@select == 24)||\
(@select == 25)||(@select == 26)|| (@select == 27)||\
(@select == 28)||(@select == 29)||(@select == 30)|| \
(@select == 31)
endparam
complex param cg
caption = "C Param 1"
default = (0,0)
visible = @select != 0
endparam
complex param cmg
caption = "C Param 2"
default = (1,0)
visible = @select != 0
endparam
complex param ecg
caption = "C Param 3"
default = (1,0)
visible = @select != 0
endparam
func fnz
caption = "Global Z Func"
default = ident()
hint = "Applies a function to the initial Z"
endfunc
func fnc
caption = "Global C Func"
default = ident()
visible = @select != 0
hint = "Applies a function to the initial C"
endfunc
int param zprime
caption = "Change Operator"
enum = "Normal""Var 1""Var 2"
default = 0
endparam
func fnreal
caption = "Real Function"
default = ident()
endfunc
func fnimag
caption = "Imag Function"
default = ident()
endfunc
bool param type
caption = "Change R/I Fn Flavor"
default = false
hint = "Effective only with certain Real and Imag Function choices"
endparam
float param realz
caption = "Real Offset"
default = 0
endparam
float param imagz
caption = "Imag Offset"
default = 0
endparam
Heading
caption = "Formula Parameters"
Endheading
int param var
caption = "Formula Type"
enum = "Talis""Talis Var 1""Talis Var 2""Talis Var 3""Talis Var 4"\
"Talis Var 5""Talis Var 6"
default = 0
endparam
float param p_bailout ; Overrides p_bailout from DivergentFormula
caption = "Bailout value"
default = 100
min = 1.0
exponential = true
hint = "This parameter defines how soon an orbit bails out while \
iterating. Larger values give smoother outlines; values around 4 \
give more interesting shapes around the set. Values less than 4 \
will distort the fractal."
endparam
param test
caption = "Bailout Test"
default = 0
enum = "mod" "real" "imag" "or" "and" "manh" "manr" "function"
endparam
func bailfunc
caption = "Bailout Function"
default = ident ()
visible = @test == 7
endfunc
param selform
caption = "Extra Loop"
enum = "None""Mandelbrot""Barnsley""Ikenaga 1""Ikenaga 2""Mandel Lambda Fn"
default = 0
endparam
param zsplit
caption = "Change Loop Flavor"
default = false
visible = @selform != 0
endparam
complex param p1
caption = "1st Z Offset"
default = (0,0)
endparam
complex param p1a
caption = "1st Z Strength"
default = (1,0)
endparam
complex param p2
caption = "2nd Z Offset"
default = (1,0)
endparam
complex param p2a
caption = "2nd Z Strength"
default = (1,0)
endparam
complex param p3
caption = "C Offset"
default = (0,0)
endparam
complex param p3a
caption = "C Strength"
default = (1,0)
endparam
complex param paddz
caption = "Global Offset"
default = (0.0,0.0)
endparam
complex param pmuz
caption = "Global Strength"
default = (1.0,0.0)
endparam
complex param pexz
caption = "Global Power"
default = (1.0,0.0)
endparam
complex param pc1
caption = "Loop C Offset"
default = (0,0)
visible = @selform != 0
endparam
complex param pc2
caption = "Loop C Strength"
default = (1,0)
visible = @selform != 0
endparam
complex param pc3
caption = "Loop C Power"
default = (1,0)
visible = @selform != 0
endparam
func cfunc
caption = "Loop C Function"
default = ident()
visible = @selform != 0
endfunc
func fn1
caption = "1st Z Function"
default = ident ()
endfunc
func fn2
caption = "2nd Z Function"
default = ident ()
endfunc
func fn3
caption = "3rd Z Function"
default = ident ()
endfunc
func fn6
caption = "Extra Z Function"
default = ident ()
visible = @var > 0
endfunc
func fn7
caption = "Extra Z2 Function"
default = ident ()
visible = @var > 2
endfunc
func fn8
caption = "Extra Z3 Function"
default = ident ()
visible = @var > 2
endfunc
func fn4
caption = "Another Function"
default = ident ()
endfunc
func fn5
caption = "C Function"
default = ident ()
endfunc
}