lk3.ufm中的Rational Newton Mandelbrot一个开关项代码精简如下:
rational-newton-mandelbrot {
init:
float theta=@lightangle*#pi/180.0
dr=size*(cos(theta)+flip(sin(theta)))
c1=#pixel-dr
c2=#pixel+dr
int iter1=0
int iter=0
z=@zc
z1=@zc
temp=z^(@m-1)
p=z*temp+@b
pp=@m*temp
ppp=(@m-1)*pp/z
temp=z^(@n-1)
q=z*temp-@b
qp=@n*temp
qpp=(@n-1)*qp/z
hpp=ppp+qpp
a=-0.5*hpp
loop:
iter=iter+1
if(iter1==0)
temp=z1^(@m-1)
p=z1*temp+@b
pp=@m*temp
temp=z1^(@n-1)
q=z1*temp-@b
qp=@n*temp
h=p+q
hp=pp+qp
g=h+a*sqr(z1)+c1
gp=hp+2*a*z1
dz=g/gp
z1=z1-dz
temp=1/dz
if(|temp|>@bailout)
iter1=iter
endif
endif
z=z1
bailout:
(iter1==0)
default:
title="Rational Newton Mandelbrot"
method=multipass
maxiter=100
periodicity=0
center=(0,0)
magn=0.01
heading
caption="Rational Newton parameters"
endheading
param zc
caption="critical point"
default=(1,0)
hint="Keep to a fairly small value."
endparam
param bailout
caption="bailout"
default=1000.0
hint="Set to a large value."
endparam
param m
caption="m"
default=8.0
hint="Exponent in p(z) function; p(z) = z^m + b."
endparam
param n
caption="n"
default=4.0
hint="Exponent in q(z) function; q(z) = z^n - b."
endparam
param b
caption="b"
default=(-1,0)
endparam
heading
caption="Embossing parameters"
endheading
bool param emboss
caption="embossed image"
default=false
endparam
float param sizefac
caption="contour size"
default=1.0
hint="Specifies the relative size of the contour bands. Larger values \
give thicker bands."
endparam
float param lightangle
caption="light angle"
default=0.0
hint="Angle of apparent light source, in degrees."
endparam
switch:
type="rational-newton-julia"
zc=zc
julparam=#pixel
bailout=bailout
m=m
n=n
b=b
htype=htype
ztype=ztype
emboss=emboss
sizefac=sizefac
lightangle=lightangle
}
效果图:
我整了一天,没整出,代码看起来不长,要算上一大篇.此分形代码解读不是很难的,就是整不出. |