我将#40的开关项1希氏曲线,在提取该开关时,误删了一段代码,并且还执行少了一句代码,结果与UF的该开关项一对照,不同如下:我这按原整理代码作出的是两个正三角形叠成的六角星形,然后再在边界线上长出牙孢成科赫雪花线,而UF中六角星形内是一片色,看不出是前后两等边三角形叠加成的。我重新整理代码,重作这开关项一,昨天带来不行,今天再重作,有进展,但仍然有问题,不知问题出在何处,大家作作看。
开关一的代码如下:
KochCurve {
; By Samuel Monnier, 2.1.00
init:
z = #pixel
x = real(z)
y = imag(z)
sq3 = sqrt(3)
bool bail2 = false
bool bail = false
i = 0
loop:
i = i + 1
if i == 2
arg = atan2(z)
if (y + 1/sq3 > 0) && (sq3*x - y + 2/sq3 > 0) \
&& (sq3*x + y - 2/sq3 < 0)
bail = true
endif
if (-y + 1/sq3 > 0) && (sq3*x + y + 2/sq3 > 0) \
&& (sq3*x - y - 2/sq3 < 0)
bail = true
endif
if (arg > 5/6*pi) || (arg < -pi/2)
z = z*exp(1i*4/3*pi)
endif
if (arg < pi/6) && (arg > -pi/2)
z = z*exp(1i*2/3*pi)
endif
z=z-1/sq3*1i
elseif i > 2
z = z + @offset
z = 3*z
x = real(z)
y = imag(z)
if (y > 0) && (sq3*x - y + sq3 > 0) \
&& (sq3*x + y - sq3 < 0)
bail2 = true
endif
z = z/3
x = real(z)
y = imag(z)
if x < -1/3
z = 3*z + 2
elseif x > 1/3
z = 3*z - 2
else
if x < 0
z = z + 1/3
z = z*exp(-1i*pi/3)
z = 3*z - 1
else
z = z - 1/3
z = z*exp(1i*pi/3)
z = 3*z + 1
endif
endif
endif
if i >= 2
z = z - @offset
endif
bailout:
bail == false && bail2 == false
default:
title = "Koch Curve"
helpfile = "sam-help/kochcurves.htm"
helptopic = "kcurve"
magn = 1.5
center = (0.0002,0)
maxiter = 50
param region
caption = "Trapped Region"
default = 0
enum = "Inside" "Outside" "Both"
endparam
param offset
caption = "Offset"
default = (0,0)
endparam
}
我扫出的图如下:
|