上楼正方形雪花与正三角形雪花造法好象差不多,我抽出其中的部分代码,在UF中运行,得到每边上的雪花图:
KochCurvesq {
; By Samuel Monnier, 3.1.99
init:
z = #pixel
x = real(z)
y = imag(z)
arg = atan2(z)
bool bail2 = false
loop:
x = real(z)
y = imag(z)
if abs(x) < 1/@s && abs(y - 1/@s) < 1/@s
bail2 = true
endif
if x < -1/@s && y < -x - 1/@s
z = 2*@s/(@s-1)*z + (@s+1)/(@s-1)
elseif x > 1/@s && y < x - 1/@s
z = 2*@s/(@s-1)*z - (@s+1)/(@s-1)
elseif x <= -1/@s && y > -x - 1/@s
z = z + 1/@s
z = z*exp(-1i*pi/2)
z = @s*z - 1
elseif x >= 1/@s && y > x - 1/@s
z = z - 1/@s
z = z*exp(1i*pi/2)
z = @s*z + 1
elseif abs(x) < 1/@s
z = @s*z - 2*1i
endif
bailout:
bail2 == false
default:
title = "Squarry Koch Curve"
helpfile = "sam-help/kochcurves.htm"
helptopic = "skcurve"
magn = 1
center = (0.00021,0.0002)
maxiter = 50
periodicity = 0
param s
caption = "Magnification step"
default = 4.0
endparam
}
|