位于gnd.ufm中,
gnd-slope-sierpinski2 {
; Based on a formula by Ramiro Perez
; Slope version by Gilles Nadeau, 2007
init:
z1 = #pixel
z2 = #pixel + @offset
z3 = #pixel + flip(@offset)
int done = 2
float modz = 0.0
float e1 = 0.0 ; potentials
float e2 = 0.0
float e3 = 0.0
float vx = 0.0 ; normal vector
float vy = 0.0
float vz = 0.0
float vd = 0.0
float iterexp1 = 0.0
float iterexp2 = 0.0
float iterexp3 = 0.0
loop:
IF ((imag(z1)>=.575*real(z1)) && (-.575*real(z1)<=imag(z1)))
z1 = 2*z1-1i
ELSEIF (real(z1)<=0)
z1 = 2*z1+(.8660254, 0.5)
ELSEIF (real(z1)>0)
z1 = 2*z1+(-.8660254, 0.5)
ELSE
z1 = 2*z1
ENDIF
IF ((imag(z2)>=.575*real(z2)) && (-.575*real(z2)<=imag(z2)))
z2 = 2*z2-1i
ELSEIF (real(z2)<=0)
z2 = 2*z2+(.8660254, 0.5)
ELSEIF (real(z2)>0)
z2 = 2*z2+(-.8660254, 0.5)
ELSE
z2 = 2*z2
ENDIF
IF ((imag(z3)>=.575*real(z3)) && (-.575*real(z3)<=imag(z3)))
z3 = 2*z3-1i
ELSEIF (real(z3)<=0)
z3 = 2*z3+(.8660254, 0.5)
ELSEIF (real(z3)>0)
z3 = 2*z3+(-.8660254, 0.5)
ELSE
z3 = 2*z3
ENDIF
modz = |z1|
iterexp1 = iterexp1 + exp(-cabs(z1))
iterexp2 = iterexp2 + exp(-cabs(z2))
iterexp3 = iterexp3 + exp(-cabs(z3))
done = done + 1 ; increment iteration counter
IF (modz > @bailout || \
@everyiter || \
done == #maxit + 2) ; done, or every iteration, or last
; determine continuous iteration (height) for each point
e1 = iterexp1 * @zscale
e2 = iterexp2 * @zscale
e3 = iterexp3 * @zscale
; apply transfer function
; a function is not used because these are floats
; and not all functions apply to floats
IF (@xfer == 1) ; log
e1 = log(e1)
e2 = log(e2)
e3 = log(e3)
ELSEIF (@xfer == 2) ; sqrt
e1 = sqrt(e1)
e2 = sqrt(e2)
e3 = sqrt(e3)
ELSEIF (@xfer == 3) ; cuberoot
e1 = (e1)^(1/3)
e2 = (e2)^(1/3)
e3 = (e3)^(1/3)
ELSEIF (@xfer == 4) ; exp
e1 = exp(e1)
e2 = exp(e2)
e3 = exp(e3)
ELSEIF (@xfer == 5) ; sqr
e1 = sqr(e1)
e2 = sqr(e2)
e3 = sqr(e3)
ELSEIF (@xfer == 6) ; cube
e1 = (e1)^3
e2 = (e2)^3
e3 = (e3)^3
ELSEIF (@xfer == 7) ; sin
e1 = sin(e1)
e2 = sin(e2)
e3 = sin(e3)
ELSEIF (@xfer == 8) ; cos
e1 = cos(e1)
e2 = cos(e2)
e3 = cos(e3)
ELSEIF (@xfer == 9) ; tan
e1 = tan(e1)
e2 = tan(e2)
e3 = tan(e3)
ENDIF
; apply post-scale
e1 = e1 * @zscale2
e2 = e2 * @zscale2
e3 = e3 * @zscale2
vx = e2-e1
vy = e3-e1
vz = -@offset
; normalize vector
vd = 1/sqrt(sqr(vx)+sqr(vy)+sqr(vz))
vx = vx*vd
vy = vy*vd
vz = vz*vd
z = vx + flip(vy) ; fudge z from vector
ELSE ; didn't compute z this time
z = z1 ; use primary iteration value to keep
; periodicity working
ENDIF
IF (modz > @bailout) ; we're done
done = 0
ENDIF
bailout:
(done > 0)
default:
title = "Slope Sierpinski Triangle II"
center = (0.0, 0.0)
magn = 1.1538
maxiter = 149
method = multipass
periodicity = 0
float param version
default = 1.1
visible = false
endparam
param bailout
caption = "Bailout value"
default = 127
min = 1
endparam
param offset
caption = "Orbit Separation"
default = 0.01
hint = "Defines how far apart the simultaneous orbits are. Smaller \
distances will produce more accurate results."
endparam
param xfer
caption = "Height Transfer"
default = 0
enum = "linear" "log" "sqrt" "cuberoot" "exp" "sqr" "cube" \
"sin" "cos" "tan"
hint = "This function will be applied to the height value \
before a slope is calculated."
endparam
param zscale
caption = "Height Pre-Scale"
default = 1.0
hint = "Specifies the ratio between height and distance. Higher \
values will exaggerate differences between high and low. \
In general, you will want to use smaller numbers here."
endparam
param zscale2
caption = "Height Post-Scale"
default = 0.025
hint = "Specifies the ratio between height and distance; like \
Height Pre-Scale, except that this value is applied after \
the transfer function."
endparam
param everyiter
caption = "Every Iteration"
default = false
hint = "If set, the surface normal will be computed at every \
iteration. If you are using a coloring algorithm which \
processes every iteration, you will need this."
endparam
}
我从面板上看了,好象那些函数开关项,一点作用都不起,榕兄再看看,是不是这样。 |