Board logo

标题: UF真是复分形的宝藏 [打印本页]

作者: 榕坚    时间: 2013-12-4 09:32     标题: UF真是复分形的宝藏

UF中的复分形还有很多没被发现,其实包括之前的DEM法也都在UF的范例中。今天看了一下还有这个东西呢:

图片附件: Fractal1.jpg (2013-12-4 09:32, 60.03 KB) / 下载次数 1287
http://inrm3d.cn/attachment.php?aid=20704&k=11d5f85a589790310d9f06952993fd91&t=1732396836&sid=nXKp6c


作者: 柳烟    时间: 2013-12-4 11:31

这种分形不知姓甚名谁。
作者: 榕坚    时间: 2013-12-4 14:27

在mt系列:
mt-latoocarfian {
; Mark Townsend, 18 August 2001
; Strange attractors from Clifford Pickover's
; book "Chaos in Wonderland" (the "De Jong"
; mutation uses similar equations from A. K.
; Dewdney's "The Armchair Universe".)
global:
  float max = 0
  int i = 0
  float xx = 0, float yy = 0
  float a = 0, float b = 0
  float c = 0, float d = 0
  int seed = @seed
  if !@rnd
    a = @a
    b = @b
    c = @c
    d = @d
  else
  ; We randomize the parameters in a loop
  ; until we find a set that has a reasonably
  ; high Lyapunov exponent.
    float L = -1
    while L < @lthresh
    ; Parameters in the range (-3 < a, b < 3)
    ; and (0.5 < c, d < 1.5)
      seed = random(seed)
      a = (seed / #randomrange) * 3
      seed = random(seed)
      b = (seed / #randomrange) * 3
      seed = random(seed)
      c = (seed / #randomrange) + 0.5
      seed = random(seed)
      d = (seed / #randomrange) + 0.5
      float Lsum = 0
      float lx = 0.1
      float ly = 0.1
      float xe = lx + 0.000001
      float ye = ly
      i = 0
      while i < 1000
      ; Pickover suggests 10 million iterations,
      ; but this is enough to produce decent
      ; attractors
        if @mutation == "Standard"
          xx = sin(ly * b) + c * sin(lx * b)
          yy = (sin(lx * a) + d * sin(ly * a))
        elseif  @mutation == "Alpha"
          xx = sin(ly * b) + sin(lx * b)^2 + sin(lx * b)^3
          yy = sin(lx * a) + sin(ly * a)^2 + sin(ly * c)^3
        elseif  @mutation == "Beta"
          xx = sin(ly * b) + sin(lx * b)^2
          yy = sin(lx * a) + sin(ly * a)^2
        elseif  @mutation == "Gamma"
          xx = abs(sin(ly * b)) + sin(lx * b)^2
          yy = abs(sin(lx * a)) + sin(ly * a)^2
        elseif  @mutation == "De Jong"
          xx = sin(ly * a) - cos(lx * b)
          yy = sin(lx * c) - cos(ly * d)
        endif
        float xsave = xx, float ysave = yy, lx = xe, ly = ye
        i = i + 1
        if @mutation == "Standard"
          xx = sin(ly * b) + c * sin(lx * b)
          yy = (sin(lx * a) + d * sin(ly * a))
        elseif  @mutation == "Alpha"
          xx = sin(ly * b) + sin(lx * b)^2 + sin(lx * b)^3
          yy = sin(lx * a) + sin(ly * a)^2 + sin(ly * c)^3
        elseif  @mutation == "Beta"
          xx = sin(ly * b) + sin(lx * b)^2
          yy = sin(lx * a) + sin(ly * a)^2
        elseif  @mutation == "Gamma"
          xx = abs(sin(ly * b)) + sin(lx * b)^2
          yy = abs(sin(lx * a)) + sin(ly * a)^2
        elseif  @mutation == "De Jong"
          xx = sin(ly * a) - cos(lx * b)
          yy = sin(lx * c) - cos(ly * d)
        endif
        float dLx = xx - xsave, float dLy = yy - ysave
        float dL2 = dLx * dLx + dLy * dLy
        float df = 1000000000000. * dL2
        float rs = 1/sqrt(df)
        xe = xsave + rs * (xx - xsave)
        ye = ysave + rs * (yy - ysave)
        xx = xsave, yy = ysave
        Lsum = Lsum + log(df)
        L = 0.721347 * lsum / i
        lx = xx
        ly = yy  
      endwhile  
    endwhile
  endif
  int pix[#width, #height]
  if 3 * #width < 4 * #height
    float scale = (#width * #magn) / 4
  else
    scale = (#height * #magn) / 3
  endif
  int x = 0, int y = 0
; initialize array  
  while x < #width
    y = 0
    while y < #height
      pix[x, y] = 0
      y = y + 1
    endwhile
    x = x + 1
  endwhile   
  float xnew = 0
  float ynew = 0
  xx = 0.1
  yy = 0.1
  i = 0
  int iters = #width * #height * @max
  while i < iters
    if @mutation == "Standard"
      xnew = sin(yy * b) + c * sin(xx * b)
      ynew = (sin(xx * a) + d * sin(yy * a))
    elseif  @mutation == "Alpha"
      xnew = sin(yy * b) + sin(xx * b)^2 + sin(xx * b)^3
      ynew = sin(xx * a) + sin(yy * a)^2 + sin(yy * c)^3
    elseif  @mutation == "Beta"
      xnew = sin(yy * b) + sin(xx * b)^2
      ynew = sin(xx * a) + sin(yy * a)^2
    elseif  @mutation == "Gamma"
      xnew = abs(sin(yy * b)) + sin(xx * b)^2
      ynew = abs(sin(xx * a)) + sin(yy * a)^2
    elseif  @mutation == "De Jong"
      xnew = sin(yy * a) - cos(xx * b)
      ynew = sin(xx * c) - cos(yy * d)
    endif
    xx = xnew
    yy = ynew
    float xc = real(#center)
    float yc = imag(#center)
    x = round(((xx - xc) * cos(#angle) - (yy + yc) * \
        sin(#angle)) * scale + #width / 2)
    y = round(((xx - xc) * sin(#angle) + (yy + yc) * \
        cos(#angle)) * scale + #height / 2)
  ; plot the point only if inside array
    if x >= 0 && x < #width && y >= 0 && y < #height
      pix[x, y] = pix[x, y] + 1
      if pix[x, y] > max
        max = pix[x, y]
      endif  
    endif
    i = i + 1
  endwhile
final:
  #index = (log(pix[#x, #y])) / log(max)
default:
  title = "Lat鲻carfian Attractors"
  render = false
  param mutation
    caption = "Mutation"
    enum = "Standard" "Alpha" "Beta" "Gamma" "De Jong"
  endparam
  int param max
    caption = "Sample Density"
    default = 30
    min = 1
  endparam  
  float param a
    caption = "a"
    default = -0.966918
    visible = !@rnd
  endparam  
  param b
    caption = "b"
    default = 2.879879
    visible = !@rnd
  endparam  
  float param c
    caption = "c"
    default = 0.765145
    visible = !@rnd && (@mutation == "Standard" || \
              @mutation == "Alpha" || @mutation == "De Jong")
  endparam  
  float param d
    caption = "d"
    default = 0.744728
    visible = !@rnd && (@mutation == "Standard" || \
              @mutation == "De Jong")
  endparam  
  bool param rnd
    caption = "Random Parameters"
    default = false
  endparam
  float param lthresh
    caption = "Lyapunov"
    default = 0.3
    visible = @rnd
  endparam  
  int param seed  
    caption = "Seed"
    default = 12345678
    visible = @rnd
  endparam  
}
作者: xuefeiyang    时间: 2013-12-4 20:01

3# 榕坚


你们用的这些在哪里有?能给我传一份吗?邮箱422161240@qq.com
作者: 榕坚    时间: 2013-12-4 20:34

4# xuefeiyang


你有安装UF程序吧。所有的范例都在里面的。
作者: xuefeiyang    时间: 2013-12-4 20:37

我安装了UF程序,但找不到你所说的那个系列:
New.jpg

图片附件: New.jpg (2014-7-9 11:59, 18.25 KB) / 下载次数 1296
http://inrm3d.cn/attachment.php?aid=20710&k=d569fefc6ad4fd46fc7b3c04c8839a83&t=1732396836&sid=nXKp6c


作者: 榕坚    时间: 2013-12-4 21:04

6# xuefeiyang


不是在formula面版中找,在outside的面版中的mt系列中。它是一个分形外部着色程序,象那希尔伯特曲线一样。
作者: 榕坚    时间: 2013-12-5 08:20

代码太吓人了:
KleinianLimitSets {
; modified june 2009, original June 2006 Ronald Barnett
;
; Based upon the depth-first tree search algorithm in the book \
; Indra's Pearls by Mumford, Series and Wright. It is considerably faster \
; than most other algorithms in generating the limit set.
; modified Feb 2010 to allow mapping transforms to work.
;
global:
  import "common.ulb"
  import "reb.ulb"

  Circle C = new Circle(0,0)
  Circle cir[4]
  Mobius gen[4]
  MobiusArray word = new MobiusArray(@level)
  complex cs[4]
  float rad[4]
  int tag[]
  setlength(tag,@level)

  float magn = #magn
  float scrsize = #width*#height
  float epsilon = @epsilon

  ; this uses a 640x640 screen with magn = 1 as the reference
  if @screen
    epsilon = epsilon*409600/scrsize/magn
  endif

  int w = 0
  int h = 0
  float Inc = @percentInc*0.01
  float wd = Inc*#width
  float ht = Inc*#height
  int wd2 = round(wd*0.5)
  int ht2 = round(ht*0.5)
  int ilev = 0
  complex ta = @ta
  complex tb = @tb
  complex taj = @taj
  complex tbj = @tbj
  if !@expert && @typeb == "Double Cusps"
    tb = (2,0)
    if @tb2 == "1 100 Cusp"
      ta = (1.99901430461837,-3.94468287279129e-005)
    elseif @tb2 == "1 99 Cusp"
      ta = (1.99899431720688,-4.06536410107979e-005)
    elseif @tb2 == "1 98 Cusp"
      ta = (1.9989737159102,-4.19101798220381e-005)
    elseif @tb2 == "1 97 Cusp"
      ta = (1.99895247534081,-4.32190326141746e-005)
    elseif @tb2 == "1 96 Cusp"
      ta = (1.99893056878569,-4.45829500728911e-005)
    elseif @tb2 == "1 95 Cusp"
      ta = (1.99890796812253,-4.60048582566762e-005)
    elseif @tb2 == "1 94 Cusp"
      ta = (1.99888464372953,-4.74878717791897e-005)
    elseif @tb2 == "1 93 Cusp"
      ta = (1.99886056438849,-4.90353081361803e-005)
    elseif @tb2 == "1 92 Cusp"
      ta = (1.99883569718054, -5.06507032899056e-005 )
    elseif @tb2 == "1 91 Cusp"
      ta = (1.99881000737372, -5.23378286366251e-005 )
    elseif @tb2 == "1 90 Cusp"
      ta = (1.99878345830198, -5.41007094967586e-005 )
    elseif @tb2 == "1 89 Cusp"
      ta = (1.99875601123446, -5.59436452831306e-005 )
    elseif @tb2 == "1 88 Cusp"
      ta = (1.99872762523451, -5.78712315206112e-005 )
    elseif @tb2 == "1 87 Cusp"
      ta = (1.99869825700728, -5.98883839104726e-005 )
    elseif @tb2 == "1 86 Cusp"
      ta = (1.99866786073491, -6.20003646555514e-005 )
    elseif @tb2 == "1 85 Cusp"
      ta = (1.99863638789812, -6.42128112880125e-005 )
    elseif @tb2 == "1 84 Cusp"
      ta = (1.99860378708289, -6.6531768270374e-005 )


……

图片附件: New.gif (2014-7-9 12:00, 16.48 KB) / 下载次数 1172
http://inrm3d.cn/attachment.php?aid=20716&k=1b772259a84f8dcaa7755d9c4d19b90d&t=1732396836&sid=nXKp6c


作者: 榕坚    时间: 2013-12-5 08:29

这个应该可以用几何画板来做一下:
ESAFractalTree {
;
; version 1.0
; By Etienne Saint-Amant, 2002/07/02
;
; Go to http://ESAfractal.com for examples and tutorial
;
; Based on FractalTree
; By Samuel Monnier, 11.1.00
; Modified with his kind permission
;
init:
  z = 0
  float arg = 0
  int i = 0
  float j = 0
  float d = 0
  float dist = 1e5
  float x = 0
  float y = 0
  float imagCof = @imaginaryCoefficient
  if @mode == 0
    z = #pixel
  endif

  float dr = pi/@rotincrCoefficient*@rotincr/@altitudeTree
  
loop:
  if @mode == 1
    i = i + 1
    if i == @itertr
      z = #z
    endif
  endif
final:
  ; Performs translation, rotation
  ; and magnification
  z = z - @center
  z = z*exp(-1i*@rot*pi/@rotationchange)
  z = z/@size
  i = 0

  while i < @niter
    i = i + 1
   
    imagCof = imagCof + @alterimaginary

    x = abs(real(z))
    y = imag(z)
    z = x + imagCof * 1i * y
    arg = -atan2(z) + pi/@weirdness            
    ; Estimate distance
    if y >= -1 && y <= 0
      d = x^@power
    elseif y < -1
      d = cabs(z + imagCof * 1i)^@power
    elseif y > 0
      d = cabs(z)^@power
    endif
   
    if d < dist
      dist = d
    endif
   
    ; Computes the rotation to apply
    j = @order-1
    rotincr = j*dr
    while j > 0
      j = j - 2
      if arg < (j+1)*dr
        rotincr = j*dr
      endif
    endwhile
   
    ; Performs transformation
    z = z*exp(imagCof*1i*rotincr)
    z = z*@magnincr
    z = z - imagCof*1i
   
  endwhile
  
  #index = dist
   
default:
  title = "ESA Fractal Tree"
  param mode
    caption = "Mode"
    default = 0
    enum = "Pixel" "Distance Estimator"
  endparam
  param power
    caption = "Dist. Est. Power"
    default = 1.0
  endparam
  param order
    caption = "Tree Order"
    default = 4.0
  endparam
  param rotincr
    caption = "Angle Between Branches"
    default = 40.0
  endparam
  param magnincr
    caption = "Tree Magnification Increment"
    default = 1.9
  endparam
  param center
    caption = "Center"
    default = (0,0)
  endparam
  param rot
    caption = "Rotation"
    default = 0.0
  endparam
  param size
    caption = "Size"
    default = 1.0
  endparam
  param niter
    caption = "Number of Iteration"
    default = 10
  endparam
  param itertr
    caption = "Iteration to observe"
    default = 1
  endparam

  ;parameter added by ESA
  param imaginaryCoefficient
    caption = "Imaginary Coefficient"
    default = 0.75
    hint = "Imaginary Coefficient to change the shape of the branches (default .75)"
  endparam

  ;parameter added by ESA
  param alterimaginary
    caption = "Alter Imaginary Coefficient"
    default = 0.1
    hint = "Alter the Imaginary Coefficient for each iteration (default 0.1)"
  endparam

  ;parameter added by ESA
  param altitudeTree
    caption = "Altitude Tree"
    default = 2.0
    hint = "Create a tree developing more vertically (default 2.0)"
  endparam
  
  ;parameter added by ESA
  param weirdness
    caption = "Weirdness"
    default = 2.2
    hint = "Weirdness (default 2.2)"
   endparam
   
  ;parameter added by ESA
  param rotincrCoefficient
    caption = "Rotation Incrementation"
    default = 120
    hint = "Rotation Incrementation Coefficient (default 120)"
   endparam
   
  ;parameter added by ESA
  param rotationchange
    caption = "Rotation Change"
    default = 50
    hint = "Rotation Change (default 50)"
   endparam
}

图片附件: New.jpg (2014-7-9 12:01, 21.28 KB) / 下载次数 1185
http://inrm3d.cn/attachment.php?aid=20717&k=fac73ca5fb4641ba638b42d75c8ac985&t=1732396836&sid=nXKp6c


作者: xuefeiyang    时间: 2013-12-5 09:31

2# 柳烟


flame!
作者: 榕坚    时间: 2014-4-27 21:22

今天无意间看到UF中的一个范例,想半天不知道是怎么能把小M给变到那些位置上去:

图片附件: Recurring Dream.jpg (2014-4-27 21:22, 26.89 KB) / 下载次数 1871
http://inrm3d.cn/attachment.php?aid=21455&k=f8afeb81fdb2988ea7a28350bafed747&t=1732396836&sid=nXKp6c


作者: changxde    时间: 2014-4-27 22:12

要是每个圆饼上都有一个小M就更好了。
这是UF中的那个?
作者: 榕坚    时间: 2014-4-27 22:21

12# changxde


不要打开主程序,直接从public文件夹中打开lkm.upr,有个recurring dream就是。
作者: xiaongxp    时间: 2014-4-29 20:10

11# 榕坚
这是用叠加六个相似变换和一个翻折变换的办法扫出的图形,足以乱真。

图片附件: M Set.jpg (2014-4-29 23:00, 19.37 KB) / 下载次数 1952
http://inrm3d.cn/attachment.php?aid=21476&k=60091fa53c015bcf41ad17341dc5c3f4&t=1732396836&sid=nXKp6c


作者: xiaongxp    时间: 2014-4-30 13:08

M Set 2.jpg

图片附件: M Set 2.jpg (2014-4-30 23:55, 27.15 KB) / 下载次数 2021
http://inrm3d.cn/attachment.php?aid=21480&k=0a0ea4081b5471223c316ff56335e048&t=1732396836&sid=nXKp6c


作者: 榕坚    时间: 2014-4-30 13:39

这个图也在这里:

图片附件: Multi-Embossed Julia, Smallest Mag.jpg (2014-4-30 13:39, 24.51 KB) / 下载次数 1857
http://inrm3d.cn/attachment.php?aid=21482&k=b59e876741620aaf738a110a01d308be&t=1732396836&sid=nXKp6c


作者: changxde    时间: 2014-4-30 16:54

New.jpg
此UF图是增加映射Circle Zoom得到的,比1#多了两个映射共128个映射。

图片附件: New.jpg (2014-7-9 12:01, 22.94 KB) / 下载次数 2020
http://inrm3d.cn/attachment.php?aid=21483&k=af298c39ea091e4f1ed8888bf9be36d9&t=1732396836&sid=nXKp6c


作者: 榕坚    时间: 2014-4-30 19:42

17# changxde
哪些中心点的坐标,缩放比,旋转角是怎么算出来的?UF是一个个做变换,能否一次性解决?
作者: changxde    时间: 2014-4-30 20:02

我加上去的两个是试着来的,
作者: xiaongxp    时间: 2014-4-30 20:04

17# changxde
哪些中心点的坐标,缩放比,旋转角是怎么算出来的?UF是一个个做变换,能否一次性解决?
榕坚 发表于 2014-4-30 19:42
在画板中用几何法比用代数公式法作变换要方便得多,而且扫描速度会更快。榕老师试试我这工具:

附件: 相似变换(局部缩放同步扫描).gsp (2014-4-30 20:25, 4.06 KB) / 下载次数 2330
http://inrm3d.cn/attachment.php?aid=21486&k=139bcd8f5fb141661c5af5ed1375f392&t=1732396836&sid=nXKp6c
作者: xiaongxp    时间: 2014-5-1 19:04

再加两个变换,行列数可设
New.jpg
M Set 3.gsp (20.9 KB)

图片附件: New.jpg (2014-7-9 12:02, 28.77 KB) / 下载次数 1741
http://inrm3d.cn/attachment.php?aid=21500&k=f9ab6440cbeb7c4f3d76d0ea50158ebc&t=1732396836&sid=nXKp6c



附件: M Set 3.gsp (2014-5-1 19:04, 20.9 KB) / 下载次数 3015
http://inrm3d.cn/attachment.php?aid=21501&k=7dacf5f8d7a4effd6bcff38699b60522&t=1732396836&sid=nXKp6c
作者: lnszdzg    时间: 2014-5-3 13:07

Carr1984

New.jpg

图片附件: New.jpg (2014-7-9 12:02, 15.15 KB) / 下载次数 1665
http://inrm3d.cn/attachment.php?aid=21520&k=2f94f435b82732bcabd1508833e4c799&t=1732396836&sid=nXKp6c


作者: lnszdzg    时间: 2014-5-3 13:11

Carr2003
New.jpg

图片附件: New.jpg (2014-7-9 12:03, 11.89 KB) / 下载次数 1656
http://inrm3d.cn/attachment.php?aid=21521&k=eae520012e3b00f0012eab18417097fb&t=1732396836&sid=nXKp6c


作者: lnszdzg    时间: 2014-5-3 13:14

New.jpg

Carr1972

图片附件: New.jpg (2014-7-9 12:03, 13.64 KB) / 下载次数 1666
http://inrm3d.cn/attachment.php?aid=21522&k=dbb7b70cc81d6a3d2e24513c40745324&t=1732396836&sid=nXKp6c






欢迎光临 inRm3D: 画板论坛 (http://inrm3d.cn/) Powered by Discuz! 7.0.0