我刚才又看了原来的那个文件,为了方便研究,我将文件中的伸缩变换与控制边数的参数拿掉,以方便大家研究。代码变成:
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(3/(2*pi)*arg)*2*pi/3
if round(3/(2*pi)*arg) == 0 && i > 2
if arg > 0
arg2 = 2*pi/3
else
arg2 = -2*pi/3
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 s
caption = "Magnification step"
default = 1.7
endparam
}
我重新按我们常用的符号重新演绎。我发现当S趋近于无穷,则所有的圆收缩到中间大圆。当s为了时,得到如蜂房似的等圆。上面简化后的代码的意义,更好理解了。 |