CheckerBoard {
; Marcelo Anelli
; Caution!!:
; this method does not work with fast Mandel and fast Julia.
init:
float p = 0.0
float w = 320 / #width * 0.03 * sqrt(@p1)
int tx = 0
int ty = 0
float rx = real( #screenpixel )
float ry = imag( #screenpixel )
tx = floor( rx * w )
if @ratio
ty = floor( ry * w * #width / #height )
else
ty = floor( ry * w )
endif
int t = ( tx + ty ) % 2
if (t == 0)
p = @pmin
else
p = @pmax
endif
final:
#index = p
default:
title = "CheckerBoard"
param p1
caption = "Width"
default = 1.0
hint = "Not depending of magnification."
endparam
param ratio
default = false
caption = "Aspect ratio"
hint = "Enable to match the aspect ratio of the square and the image"
endparam
param pmin
caption = "White Square Color"
min = 0.0
max = 1.0
default = 0.1
endparam
param pmax
caption = "Black Square Color"
min = 0.0
max = 1.0
default = 0.7
endparam
}
特效代码如下:
FamilyGradient(BOTH) {
; By Samuel Monnier, 20.3.00
; Designed for the "Familly formulas"
; (Julifamilly and Pcfamilly in my file
; and Pinskyfamilly in kpk.ufm.
init:
complex z = pixel
complex zc = 0
loop:
final:
z = z - @tilem
z = z*exp(1i*pi/180*@rottile)
zc = round(z/@sizesq)*@sizesq
z = z*exp(-1i*pi/180*@rottile)
zc = zc*exp(-1i*pi/180*@rottile)
z = z + @tilem
zc = zc + @tilem
z = 2*(z - zc)/@sizesq
z = z*exp(1i*pi/180*@rottile)
if @mode == 0
#index = cabs(z)
elseif @mode == 1
float x = abs(real(z))
float y = abs(imag(z))
if x > y
#index = x
else
#index = y
endif
endif
default:
title = "Gradient for <<Familly>>"
helpfile = "sam-help/variouscol.htm"
helptopic = "gradforfam"
HilbertCurve(BOTH) {
; By Samuel Monnier, 2.9.00
init:
z = 0
int i = 0
int ttype = 0
float d = -1e20
loop:
final:
z = #z/2
z = abs(z) - (.5,.5)
while i < @niter
i = i + 1
if ttype == 0
if real(z) < 0 && imag(z) < 0
z = 2*z + (.5,.5)
z = -conj(z)
elseif real(z) > 0 && imag(z) < 0
z = 2*z + (-.5,.5)
z = 1i*z
elseif real(z) > 0 && imag(z) > 0
z = 2*z + (-.5,-.5)
z = 1i*conj(z)
elseif real(z) < 0 && imag(z) > 0
z = 2*z + (.5,-.5)
ttype = 1
endif
else
if real(z) < 0 && imag(z) < 0
z = 2*z + (.5,.5)
z = 1i*z
ttype = 0
elseif real(z) > 0 && imag(z) < 0
z = 2*z + (-.5,.5)
z = -1i*conj(z)
ttype = 0
elseif real(z) > 0 && imag(z) > 0
z = 2*z + (-.5,-.5)
ttype = 0
elseif real(z) < 0 && imag(z) > 0
z = 2*z + (.5,-.5)
z = -conj(z)
ttype = 0
endif
endif
endwhile
if @style == 0
z = z + (1,1)
if ttype == 0
if abs(real(z))-1 > d
d = abs(real(z))-1
endif
if abs(imag(z))-1 > d
d = abs(imag(z))-1
endif
else
d = imag(z)-1
endif
elseif @style == 1 || @style == 2
if ttype == 0
d = cabs(z+(.5,.5))-.5
else
if @style == 1
d = imag(z)
else
d = imag(z) - (real(z)^2-.25)^2*3
endif
endif
elseif @style == 3
if ttype == 0
z = z + (.5,.5)
d = abs(real(z)) + abs(imag(z)) - .5
else
;d = imag(z)-.5
d = abs(real(z)) - imag(z) - .5
endif
endif
#index = abs(d)^@power
default:
title = "Hilbert Curve"
helpfile = "sam-help/hilbert.htm"
着色代码:
dmj-Lyapunov {
;
; This algorithm computes the Lyapunov exponent
; for Mandelbrot types. This exponent is usually
; negative for divergent orbits (outside points),
; and positive for convergent orbits (inside
; points).
;
; This might have interesting results when used
; with other fractal types, although the results
; would not be mathematically accurate.
;
; Optimizations suggested by Charles Vassallo.
;
init:
float oldsum = 0
float sum = 1
float v = 0
float il = 1/log(real(@power))
float lp = log(log(@bailout)/2.0)
float f = 0.0
loop:
IF (@trackvariable == 0) ; |z|
v = cabs(#z)
ELSEIF (@trackvariable == 1) ; real(z)
v = real(#z)
ELSEIF (@trackvariable == 2) ; imag(z)
v = imag(#z)
ELSEIF (@trackvariable == 3) ; real(z)/imag(z)
v = real(#z)/imag(#z)
ELSEIF (@trackvariable == 4) ; imag(z)/real(z)
v = imag(#z)/real(#z)
ELSEIF (@trackvariable == 5) ; arg(z)
v = atan2(#z)
ELSEIF (@trackvariable == 6) ; 1/real(z)
v = 1.0/real(#z)
ELSEIF (@trackvariable == 7) ; 1/imag(z)
v = 1.0/imag(#z)
ENDIF
oldsum = sum
; sum = sum + log(abs(2*v)) ; sum the Lyapunov exponent (slow method)
sum = sum * (abs(2*v)) ; sum the Lyapunov exponent
final:
oldsum = log(oldsum)
sum = log(sum)
IF (@negative == 1)
sum = -sum/#numiter
oldsum = -oldsum/(#numiter-1)
ELSEIF (@negative == 2)
sum = abs(sum/#numiter)
oldsum = abs(oldsum/(#numiter-1))
ELSE
sum = sum/#numiter
oldsum = oldsum/(#numiter-1)
ENDIF
IF (@smooth)
f = il*lp - il*log(log(cabs(#z)))
#index = oldsum + (sum-oldsum) * (f+1)
ELSE
#index = sum
ENDIF
default:
title = "Lyapunov"
helpfile = "dmj-pub\dmj-pub-uf-lyapunov.htm"
param trackvariable
caption = "Variable to Track"
default = 0
enum = "magnitude of z" "real part of z" "imaginary part of z" \
"real / imag" "imag / real" "angle of z" "1 / real(z)" "1 / imag(z)"
hint = "Indicates which variable to measure the Lyapunov exponent for."
endparam
param negative
caption = "Sign"
default = 2
enum = "positive" "negative" "absolute value"
hint = "Affects the sign of the exponent. 'Negative' and 'absolute \
value' are useful for inside coloring."
endparam
param power
caption = "Exponent"
default = 2.0
hint = "This should be set to match the exponent of the \
formula you are using. For Mandelbrot, this is 2."
endparam
param bailout
caption = "Bailout"
default = 1e20
min = 1
hint = "This should be set to match the bailout value in \
the Formula tab. Use a very high bailout!"
endparam
param smooth
caption = "Smooth Coloring"
default = false
hint = "If set, results will be 'smoothed' to hide iteration bands."
endparam
}