范例位于reb.ufm系列中:
OldPhoenix {
; Ron Barnett, 1990
; Old formula from Stevens Turbo Pascal book
; Modified and tweaked March 2000
init:
#z = flip(#pixel)
这是z的初值,画板采取的是先迭代,后定位亦即合并方法。最后将z定位于何处?flip函数是将点#pixel的实部与虚部相交换,即横坐坐标交换后的点。如果不交换行不行呢,行,则与原图比校,只是旋转了一个角度,旋转了多少,你可按中学里的点变换算处即知。最后是对#pixel点进行着色。)
complex x1 = 0
complex y = 0
(这是x1与y点的初值,均为原点。)
loop:
x1 = #z*#z + real(@p1) + imag(@p1)*y
y = #z
#z = x1
(这段代码意思是,将初值的象算出,即为x1 = #z*#z + real(@p1) + imag(@p1)*y
,然后将其赋值给z的象点 #z = x1,而将Z的原象赋给y(注意这里的x1就相当于画板里的z',而y的象点,在迭代过程中,相当于上一个z值。)我是这样理解的,不知对不对,大家可发表意见。)
bailout:
(@test == 0 && |#z| <= @bailout) || \
(@test == 1 && sqr(real(#z)) <= @bailout) || \
(@test == 2 && sqr(imag(#z)) <= @bailout) || \
(@test == 3 && (sqr(real(#z)) <= @bailout && sqr(imag(#z)) < @bailout)) || \
(@test == 4 && (sqr(real(#z)) <= @bailout || sqr(imag(#z)) < @bailout)) || \
(@test == 5 && (sqr(abs(real(#z)) + abs(imag(#z))) <= @bailout)) || \
(@test == 6 && (sqr(real(#z) + imag(#z)) <= @bailout))
这里的开关项,面板上可看出,是test ,主要功能是改变画板里的逃逸参数p的算法。我以test==0,与test==1为例,其余你可举一而反三。
default:
title = "OldPhoenix"
center = (0.0, 0.0)
maxiter = 256
periodicity = 0
param version
caption = "Formula Version"
default = 1.0
hint = "You should never see this parameter; it's used internally to track \
which version of the formula was used to create your image, so that \
if a bug is found which breaks backwards-compatibility, the formula \
can adapt transparently."
visible = false
endparam
param test
caption = "Bailout Test"
default = 0
enum = "mod" "real" "imag" "or" "and" "manh" "manr"
(这里的"mod" "real" "imag" "or" "and" "manh" "manr"即为代表前面的不同的test ,面板上可发现。)
endparam
param bailout
caption = "Bailout value"
default = 100.0
(阈值为100,这大家对前面的讲解熟了后,一看便知。)
min = 1
endparam
param p1
caption = "Parameter 1"
default = (0.56667, -0.5)
(P1的值,面板上也有。)
endparam
switch:
type = "OldMandelPhoenix"
bailout = @bailout
}
上面对代码粗略讲了讲,初学者可能一头雾水,不过,你接着看下楼即将发表的视频后,可加深对代码的了解。我去制作视频去了,干了这么久,制作视频很是一件麻烦的事。另外,在科学的大道上,没有平坦的大道可走,只有不畏劳苦沿着陡峭山路登攀的人,才能达到希望的顶点——-马克思。顺便写上这句名言,与各位板友共勉。 |