KochCurvecir {
init:
z = #pixel
float arg =0
bool bail = false
int i = 0
loop:
i = i + 1
if i > 1
if |z| < 1
bail = true
endif
arg = atan2(z)
float arg2 = round(@n/(2*pi)*arg)*2*pi/@n
if round(@n/(2*pi)*arg) == 0 && i > 2
if arg > 0
arg2 = 2*pi/@n
else
arg2 = -2*pi/@n
endif
endif
z = z*exp(-1i*arg2)
z = - @s*z + (1 +@s)
endif
bailout:
bail == false
default:
title = "Circly Koch Curve"
helpfile = "sam-help/kochcurves.htm"
magn = .5
center = (0.00021,0.0002)
maxiter = 50
periodicity = 0
param n
caption = "Magnification step"
default = 4
endparam
param s
caption = "Magnification step"
default = 1.7
endparam
}
UF中的代码十分高明,此代码中@n,当其为3时,即为前面的三边圆迭代,改为4,即可得4边圆迭代,相当方便。分区法造,@n为3时,分二区,最后对初值z进行变换,为4时,要分三区了?有点麻烦,UF中造一个文件,一劳永逸。不过,分区法也算是颇具创新精神的方法,解决了以前不能用扫描法解决的分形。 |