返回列表 回复 发帖
UF中的范例:MandelLevels {
;Use Multipass or Onepass linear for drawing
init:
if @nothreads==true
  z=0
  aa=#pixel
else
  if real(#screenmax)/imag(#screenmax)>4/3
    float scale=3.0/imag(#screenmax)/#magn
  else
    float scale=4.0/real(#screenmax)/#magn
  endif
  bool flag=false
  bool flag2=false
  complex z=0
  complex a=#pixel
  complex aa=@col
  complex a1=a+scale
  complex a2=a-scale
  complex a3=a+flip(scale)
  complex a4=a-flip(scale)
  complex a5=a1+flip(scale)
  complex a6=a1-flip(scale)
  complex a7=a2+flip(scale)
  complex a8=a2-flip(scale)
  int max=#maxiter
  int c=0
  int ac=0
  repeat
    c=c+1
    z=z^@n+@f1(a)
  until (c==max)||(|z|>@bailout)
  if c==max
    flag=true
  endif
  ac=c
  if flag==false
    c=0
    z=0
    repeat
      c=c+1
      z=z^@n+@f1(a1)
    until (c==max)||(|z|>@bailout)
    if (c>ac)&&(c<max)
      flag2=true
      aa=a1
    endif
    c=0
    z=0
    if flag2==false
      repeat
        c=c+1
        z=z^@n+@f1(a2)
      until (c==max)||(|z|>@bailout)
      if (c>ac)&&(c<max)
        flag2=true
        aa=a2
      endif
      c=0
      z=0
    endif
    if flag2==false
      repeat
        c=c+1
        z=z^@n+@f1(a3)
      until (c==max)||(|z|>@bailout)
      if (c>ac)&&(c<max)
        flag2=true
        aa=a3
      endif
      c=0
      z=0
    endif
    if flag2==false
      repeat
        c=c+1
        z=z^@n+@f1(a4)
      until (c==max)||(|z|>@bailout)
      if (c>ac)&&(c<max)
        flag2=true
        aa=a4
      endif
      c=0
      z=0
    endif
    if flag2==false
      repeat
        c=c+1
        z=z^@n+@f1(a5)

      until (c==max)||(|z|>@bailout)
      if (c>ac)&&(c<max)

        flag2=true
        aa=a5
      endif
      c=0
      z=0
    endif
    if flag2==false
      repeat
        c=c+1
        z=z^@n+@f1(a6)
      until (c==max)||(|z|>@bailout)
      if (c>ac)&&(c<max)
        flag2=true
        aa=a6
      endif
      c=0
      z=0
    endif
    if flag2==false
      repeat
        c=c+1
        z=z^@n+@f1(a7)
      until (c==max)||(|z|>@bailout)
      if (c>ac)&&(c<max)
        flag2=true
        aa=a7
      endif
      c=0
      z=0

    endif
    if flag2==false
      repeat
        c=c+1
        z=z^@n+@f1(a8)
      until (c==max)||(|z|>@bailout)
      if (c>ac)&&(c<max)
        flag2=true
        aa=a8
      endif
      c=0
      z=0
    endif
  endif
  if flag==true
    aa=#pixel
  endif
endif
  
loop:

  z = z^@n + @f1(aa)

bailout:
  |z|<@bailout
  
switch:
  type="JuliaLevels"
  seed=#pixel
  nothreads=nothreads
  f1=f1
  col=col
  n=n
  bailout=bailout

default:
  title = "MandelLevels"
  method=multipass
  periodicity=0
  center=(-0.5,0)

  
  func f1
    caption="Function"
    hint="Function for parameter c."
    default=ident()
  endfunc
  
  param nothreads
    caption="No threads"
    hint="The routine will work as a normal mandelbrot."
    default=false
  endparam
  
  param col
    caption="Colour"
    hint="Choose color between bands with geographic coords"
    default=(0.0,0.0)
  endparam
  
  param n
    caption="exponent"
    hint="2 is the normal Mandelbrot."
    default=(2,0)
  endparam
  
  param bailout
    caption="bailout"
    hint="bailout"
    default=4.0
  endparam
}
这可是M集的又一表现形式,可是做了一半下不去了。请高手出招:

Fractal1.jpg (47.84 KB)

Fractal1.jpg

好象掺入了扫描框大小、缩放比等算法。
19# xiaongxp


谢过向老师,学习了,等暑假再来消化。顺便问一下:在同一逃逸区内的点离边界的远近是否能用什么加以区别。
20# xiaongxp


我之前也是采取类似做法,但没办法耐心扫描就放弃了。因为它要设置较慢的速度进行扫描才会使那些线相对连续。等过一阵子再来研究一下UF的做法。谢谢向老师。
这个奇怪的UF中的范例,我做了两遍都与结果相去甚远:
Critper3 {
; Generic Mandelbrot set
init:
  complex s = #pixel
  ;s=1-1/s
  ;s=1-1/s
  complex a3 = 0.3333333333333333333
  complex pp = (1/(s - s*s) - s)*3/s
  complex a0 = sqrt(pp)
  complex a2 = a0*((s - 1)/pp - a3)
  z = -2*a2
loop:
  z = (a3*z + a2)*sqr(z) + a0
bailout:
  |z| <= @bailout
default:
  title = "Critper3"
  center = (0, 0)
  param start
    caption = "Starting point"
    default = (1,0)
    hint = "Perturbation. Use (1,0) for the standard Mandelbrot set."
  endparam
  param power
    caption = "Power"
    default = (1,0)
    hint = "This defines the power of the Mandelbrot set. Use (1,0) \
            for the standard Mandelbrot set."
  endparam
  param bailout
    caption = "Bailout value"
    default = 128.0
    min = 1.0
    hint = "Defines how soon an orbit bails out, i.e. doesn't belong \
            to the Mandelbrot set anymore."
  endparam
switch:
  type = "Jritper3"
  seed = #pixel
  power = power
  bailout = bailout
}

Fractal1.jpg (56.39 KB)

Fractal1.jpg

真奇怪了,这个分形我破天荒的做了四次,每次得到的结果都不一样,第一次因为代码中s=s-1/s前有分号,而且是灰色的,我以为是注释(而且我试着把原软件中s=s-1/s删掉、保存。再打开结果没变。)就不算,后面算一次,算两次,可结果还是不行,晚上再来。就不信做不出来。
第五次了,真是气遍我了下面两幅是s=1-1/s算一遍与算两遍的结果:

捕获348.JPG (36.86 KB)

捕获348.JPG

捕获349.JPG (29.13 KB)

捕获349.JPG

原来这是M集的变异:

Fractal1.jpg (27.65 KB)

Fractal1.jpg

柳老师不要再试了,我重新跳过s=1-1/s做出来的形状与它一样,但是可能是软件有经过特殊的处理才会有那个结果。其实我第一次就做对了。只是结果与它不一样,外观是M集的外观。怪不得我删掉那两行没有影响图形。
31# 柳烟


这个分形你已经做的非常成功了。你只要跳过这一段代码最后的图形就跟它一样了:
if @insout
    st = 1/st
  endif
它是一个开关项,可以选择两个图形中的某一个。其中一个就是你做出来的图形。
返回列表