class JLB_SpiroGlyphicUserTransform(common.ulb:UserTransform) {
; Part of the Spiroglyphics formula, as in tma2.ufm, as a Transform.
public:
func JLB_SpiroGlyphicUserTransform(Generic pparent)
UserTransform.UserTransform(pparent)
endfunc
func Init(complex pz)
if @op1 == "++++"
m1=+1, m2=+1, m3=+1, m4=+1
elseif @op1 == "+++-"
m1=+1, m2=+1, m3=+1, m4=-1
elseif @op1 == "++-+"
m1=+1, m2=+1, m3=-1, m4=+1
elseif @op1 == "+-++"
m1=+1, m2=-1, m3=+1, m4=+1
elseif @op1 == "-+++"
m1=-1, m2=+1, m3=+1, m4=+1
elseif @op1 == "++--"
m1=+1, m2=+1, m3=-1, m4=-1
elseif @op1 == "+--+"
m1=+1, m2=-1, m3=-1, m4=+1
elseif @op1 == "--++"
m1=-1, m2=-1, m3=+1, m4=+1
elseif @op1 == "-++-"
m1=-1, m2=+1, m3=+1, m4=-1
elseif @op1 == "+-+-"
m1=+1, m2=-1, m3=+1, m4=-1
elseif @op1 == "-+-+"
m1=-1, m2=+1, m3=-1, m4=+1
elseif @op1 == "+---"
m1=+1, m2=-1, m3=-1, m4=+1
elseif @op1 == "-+--"
m1=-1, m2=+1, m3=-1, m4=-1
elseif @op1 == "--+-"
m1=-1, m2=-1, m3=+1, m4=-1
elseif @op1 == "---+"
m1=-1, m2=-1, m3=-1, m4=+1
else;if @op1 == "----"
m1=-1, m2=-1, m3=-1, m4=-1
endif
if @op2 == "++++"
n1=+1, n2=+1, n3=+1, n4=+1
elseif @op2 == "+++-"
n1=+1, n2=+1, n3=+1, n4=-1
elseif @op2 == "++-+"
n1=+1, n2=+1, n3=-1, n4=+1
elseif @op2 == "+-++"
n1=+1, n2=-1, n3=+1, n4=+1
elseif @op2 == "-+++"
n1=-1, n2=+1, n3=+1, n4=+1
elseif @op2 == "++--"
n1=+1, n2=+1, n3=-1, n4=-1
elseif @op2 == "+--+"
n1=+1, n2=-1, n3=-1, n4=+1
elseif @op2 == "--++"
n1=-1, n2=-1, n3=+1, n4=+1
elseif @op2 == "-++-"
n1=-1, n2=+1, n3=+1, n4=-1
elseif @op2 == "+-+-"
n1=+1, n2=-1, n3=+1, n4=-1
elseif @op2 == "-+-+"
n1=-1, n2=+1, n3=-1, n4=+1
elseif @op2 == "+---"
n1=+1, n2=-1, n3=-1, n4=+1
elseif @op2 == "-+--"
n1=-1, n2=+1, n3=-1, n4=-1
elseif @op2 == "--+-"
n1=-1, n2=-1, n3=+1, n4=-1
elseif @op2 == "---+"
n1=-1, n2=-1, n3=-1, n4=+1
else;if @op2 == "----"
n1=-1, n2=-1, n3=-1, n4=-1
endif
endfunc
; @param pz
; @return the new pz
complex func Iterate(complex pz)
complex x = real(@fnx(pz)) + flip(real(@start/10))
complex y = imag(@fny(pz)) + flip(imag(@start/10))
complex newx = y
complex newy = x
int i = 0
if @chain == "Separate"
while i < @flavor
i = i + 1
newx = y + m1*real(@h2a/10)*@fn1(@a1 * newx) + \
m2*imag(@h2a/10)*@fn3(@a2 * newx)
newy = x + m3*real(@h2b/10)*@fn2(@a3 * newy) + \
m4 *imag(@h2b/10)*@fn4(@a4 * newy)
endwhile
x = x + n1*real(@h1a/10)*@fn5(newx) + n2*imag(@h1a/10)*@fn7(newx)
y = y + n3*real(@h1b/10)*@fn6(newy) + n4*imag(@h1b/10)*@fn8(newy)
elseif @chain == "Ganged"
while i < @flavor
i = i + 1
newx = y + m1*real(@h2/10)*@fn1(@a1 * newx) + \
m2*imag(@h2/10)*@fn3(@a2 * newx)
newy = x + m3*real(@h2/10)*@fn2(@a3 * newy) + \
m4*imag(@h2/10)*@fn4(@a4 * newy)
endwhile
x = x + n1*real(@h1/10)*@fn5(newx) + n2*imag(@h1/10)*@fn7(newx)
y = y + n3*real(@h1/10)*@fn6(newy) + n4*imag(@h1/10)*@fn8(newy)
endif
if @op == "x+y"
pz = @fna(x) + flip(@fnb(y))
elseif @op == "x-y"
pz = @fna(x)- flip(@fnb(y))
else;if @op == "y-x"
pz = flip(@fnb(y)) - @fna(x)
endif
return pz
endfunc
protected:
int m1, int m2, int m3, int m4
int n1, int n2, int n3, int n4
default:
title = "Spiroglyphic"
int param v_SpiroglyphicUsertransform
caption = "Version (SpiroglyphicUserTransform)"
default = 100
hint = "This version parameter is used to detect when a change has been made to the formula that is incompatible with the previous version. When that happens, this field will reflect the old version number to alert you to the fact that an alternate rendering is being used."
visible = @v_SpiroglyphicUsertransform < 100
endparam
int param chain
caption = "Intensity Mode"
enum = "Separate" "Ganged"
default = 0
hint = "Choose whether X/Y intensity and step sizes vary together \
or separately"
endparam
complex param h1a
caption = "Intensity X"
default = (.1,.1)
visible = @chain == 0
endparam
complex param h1b
caption = "Intensity Y"
default = (.1,.1)
visible = @chain == 0
endparam
complex param h2a
caption = "Step Size X"
default = (.8,.8)
visible = @chain == 0 && (@h1a != (0,0) || @h1b != (0,0))
endparam
complex param h2b
caption = "Step Size Y"
default = (.8,.8)
visible = @chain == 0 && (@h1a != (0,0) || @h1b != (0,0))
endparam
complex param h1
caption = "Intensity X/Y"
default = (.1, .1)
visible = @chain == 1
endparam
complex param h2
caption = "Step Size X/Y"
default = (.8,.8)
visible = @chain == 1 && @h1 != (0,0)
endparam
complex param start
caption = "Glyph Start"
default = (0,0)
endparam
int param flavor
caption = "Flavor"
default = 2
min = 0
hint = "This is an integer param which works in steps. Higher \
numbers generally create more intense effects"
visible = (@chain == 0 && @h1a != (0,0) || @h1b != (0,0) ) || \
(@chain == 1 && @h1 != (0,0))
endparam
float param a1
caption = "Alpha 1"
default = 2.7
visible = (@chain == 0 && @h1a != (0,0) || @h1b != (0,0) ) || \
(@chain == 1 && @h1 != (0,0))
endparam
float param a2
caption = "Alpha 2"
default = 2.7
visible = (@chain == 0 && @h1a != (0,0) || @h1b != (0,0) ) || \
(@chain == 1 && @h1 != (0,0))
endparam
float param a3
caption = "Alpha 3"
default = 2.7
visible = (@chain == 0 && @h1a != (0,0) || @h1b != (0,0) ) || \
(@chain == 1 && @h1 != (0,0))
endparam
float param a4
caption = "Alpha 4"
default = 2.7
visible = (@chain == 0 && @h1a != (0,0) || @h1b != (0,0) ) || \
(@chain == 1 && @h1 != (0,0))
endparam
param op
caption = "Main Operator"
enum = "x+y" "x-y" "y-x"
default = 0
endparam
param op1
caption = "Operator 1"
enum = "++++" "+++-" "++-+" "+-++" "-+++" "++--" "+--+" "--++" \
"-++-" "+-+-" "-+-+" "+---" "-+--" "--+-" "---+" "----"
default = 0
visible = (@chain == 0 && @h1a != (0,0) || @h1b != (0,0) ) || \
(@chain == 1 && @h1 != (0,0))
endparam
param op2
caption = "Operator 2"
enum = "++++" "+++-" "++-+" "+-++" "-+++" "++--" "+--+" "--++" \
"-++-" "+-+-" "-+-+" "+---" "-+--" "--+-" "---+" "----"
default = 7
visible = (@chain == 0 && @h1a != (0,0) || @h1b != (0,0) ) || \
(@chain == 1 && @h1 != (0,0))
endparam
func fn1
caption = "Function 1"
default = sin()
visible = (@chain == 0 && @h1a != (0,0) || @h1b != (0,0) ) || \
(@chain == 1 && @h1 != (0,0))
endfunc
func fn2
caption = "Function 2"
default = sin()
visible = (@chain == 0 && @h1a != (0,0) || @h1b != (0,0) ) || \
(@chain == 1 && @h1 != (0,0))
endfunc
func fn3
caption = "Function 3"
default = cos()
visible = (@chain == 0 && @h1a != (0,0) || @h1b != (0,0) ) || \
(@chain == 1 && @h1 != (0,0))
endfunc
func fn4
caption = "Function 4"
default = cos()
visible = (@chain == 0 && @h1a != (0,0) || @h1b != (0,0) ) || \
(@chain == 1 && @h1 != (0,0))
endfunc
func fn5
caption = "Function 5"
default = sin()
visible = (@chain == 0 && @h1a != (0,0) || @h1b != (0,0) ) || \
(@chain == 1 && @h1 != (0,0))
endfunc
func fn6
caption = "Function 6"
default = sin()
visible = (@chain == 0 && @h1a != (0,0) || @h1b != (0,0) ) || \
(@chain == 1 && @h1 != (0,0))
endfunc
func fn7
caption = "Function 7"
default = cos()
visible = (@chain == 0 && @h1a != (0,0) || @h1b != (0,0) ) || \
(@chain == 1 && @h1 != (0,0))
endfunc
func fn8
caption = "Function 8"
default = cos()
visible = (@chain == 0 && @h1a != (0,0) || @h1b != (0,0) ) || \
(@chain == 1 && @h1 != (0,0))
endfunc
func fna
caption = "Initial X Fn"
default = ident()
endfunc
func fnb
caption = "Initial Y Fn"
default = ident()
endfunc
func fnx
caption = "Global X Fn"
default = ident()
endfunc
func fny
caption = "Global Y Fn"
default = ident()
endfunc
}