看了向老师前面的任意pq庞盘扫描文件,又联想起了曾用分区法整过的圆科赫雪花。当时我们就中心角为2π/3用分区法获得完满解决。而UF中似对任意中心角,通过一个文件解决。
当中心角为:2π/3时:
当中心角为:2π/4时:
……
引进多边形边数为p,中心角为2π/p,如何通过分区法完成更一般的圆科赫雪花呢?
重新精简并编写UF代码如下:
KochCurvecir {
; By Samuel Monnier, 5.1.99
init:
z = #pixel
float arg = atan2(z)
int i = 0
loop:
i=i+1
z=z
if i > 1
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 = - z + (1 + 1/@s)
z = @s*z
endif
bailout:
|z|>1
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
param n
caption = "Curve Order"
default = 3
endparam
}
我试着先整p=4时的圆科赫,以失败告终。 |