来一个稍微复杂点的带开关项的M集.在akl.ufm中。
MoebiusMandel {
init:
z = @start
(柳烟注:既是M集,Z的初值定在何处呢?代码后面或面板上有,你结合面板,就知starting ponte(Re)与starting ponte(Im)即为z的定位的横纵标。)
float xLim = abs(real(@limit))
float yLim = abs(imag(@limit))
(在面板上能找到,接下来的二行,即是。这用来后面条件语句(IF后面的句子)中,当条件成立时,改变迭代算法而用。)
float reZ = 0
float imZ = 0
(这两句好象是叫电脑腾出两个位子,存贮两变量reZ与imZ,对用画板制作复分形,可不考虑,事实上,这两句在画板中没啥作用。)
loop:
z = z^@power + #pixel
(@power的值面板上有,后面也告诉了,这大家对前面几个程序应该有所熟悉,在代码后面何方,不难找到。#pixel就是C的值,将来的M集对其着色扫图的那个点。)
reZ = real(z)
imZ = imag(z)
reZNew = reZ
imZNew = imZ
if (reZ < -xLim)
reZNew = reZNew + 2*xLim
if (@mode == 1)
(这里的@mode是何意思?找代码后面,有
param mode
caption = "Moebius Mode"
enum = "Normal" "Double" "Inverse"
default = 0
再看面板上,找到Normal后,你点下拉菜单,可看到"Double" "Inverse",你就会恍然大悟,原来这是一个开关项。当你只某一个开关项的分形时,其余开关项有关的语句,你就别去考虑了。换句话说,一个开关项,造一个分形。理论上,所有的开关项,程序很容易实现的,画板能作出,但太繁顼,我试过,当开关项太多,一是造起来杀伤脑细胞,另由于计算过于复杂,太过秀气的几何画板吃不消,有可能扫不动。所以我喜欢一个分形一个分形去造。注意,@mode == 1成立时,对应第二个开关项"Double",当mode == 2成立时,对应第三个开关项"Inverse",当不考虑这二个开关项,也就是说mode == 1,2,将其后面的语句删去,则得第一个开关项的分形Normal) imZNew = imZNew - yLim
elseif (@mode == 2)
imZNew = -imZNew
endif
elseif (reZ > xLim)
reZNew = reZNew - 2*xLim
if (@mode == 1)
imZNew = imZNew + yLim
elseif (@mode == 2)
imZNew = -imZNew
endif
endif
if (imZ < -yLim)
imZNew = imZNew + 2*yLim
if (@mode == 1)
reZNew = reZNew - xLim
elseif (@mode == 2)
reZNew = -reZNew
endif
elseif (imZ > yLim)
imZNew = imZNew - 2*yLim
if (@mode == 1)
reZNew = reZNew + xLim
elseif (@mode == 2)
reZNew = reZNew
endif
endif
z = reZNew + 1i*imZNew
bailout:
|z| < @bailout
default:
title = "Moebius' Mandel"
center = (-0.5, 0)
maxiter = 100
method = multipass
periodicity = 0
param start
caption = "Starting point"
default = (0,0)
hint = "Perturbation. Use (0,0) for the standard Mandelbrot set."
(这告诉你z的定位的横纵坐标,与面板上的一致,这定位点,你可改换其它的定位坐标试试,说不定会看到比面板上还美的分形。)
endparam
param limit
caption = "Moebius limits"
default = (2,2)
(这横纵坐标,前面已解说,主要用来作条件判断所用的。)
endparam
param mode
caption = "Moebius Mode"
enum = "Normal" "Double" "Inverse"
default = 0
endparam
param power
caption = "Power"
default = (2,0)
hint = "This defines the power of the Mandelbrot set. Use (2,0) \
for the standard Mandelbrot set."
(这是前面loop:
z = z^@power + #pixel中,z的指数。)
endparam
param bailout
caption = "Bailout value"
default = 4.0(这是阈值)
hint = "Defines how soon an orbit bails out, i.e. doesn't belong \
to the inner set anymore."
endparam
switch:
type = "MoebiusJulia"
seed = #pixel
power = power
bailout = bailout
limit = limit
mode = mode
}
解释了这通,就可以造作第一个开关项的分形了。为造好这个分形,我已作好了几个画板用于逻辑判断的算式的工具,发在此(下楼文件中),大家直接运用,提高造分形的效率。 |