返回列表 回复 发帖
传图片卡住了:
mandalaEpsilonJulia.JPG
30# 榕坚
如何变通?
31# 榕坚
这个别致,很强的立体感和金属感。
32# 柳烟


这是指数幂运算的不尽人意问题了,因为底数为负值时几何画板认定为无意义的。只要把底数改为复数(如(-2)^3改为real((-2,0)^3))就不会出现不存在了。
它后面的mandalaGammaJulia,将seed实部改为0.93,扫出的图不错,放**点,居然又发现直线分形。
未命名.jpg
2011-3-1 09:33

未命名.jpg
2011-3-1 17:50

未命名(1).jpg
2011-3-1 17:50
34# 榕坚
此变通太神妙了!

mandalaGammaJulia-2.JPG
2011-3-1 17:51
35# 柳烟


改一下确实好看多了:
mandalaGammaJulia-1.JPG
38# 榕坚
是的。这类分形的美有其特色,玩起来有趣。
位于sam.ufm系列中的科赫雪花曲线,我看了,扫描法出来的图形,美。我正在造第一个开关项,觉得这开关项可能简单点,单就这开关项的程序还没完全懂,我感觉到此分形能用几何画板做。
KochCurve {
; By Samuel Monnier, 2.1.00
init:
  z = #pixel
  zz = 0
  ; Twist
  z = 1/sqrt(@r)*real(z) + 1i*sqrt(@r)*imag(z)
  x = real(z)
  y = imag(z)
  sq3 = sqrt(3)
  bool bail2 = false
  bool bail = false
  i = 0
loop:
  i = i + 1
  ;----------------
  ; First Iteration
  ;----------------
  if i == 2
   
   
   
    ; Calculate the argument of z
    arg = atan2(z)
  
    ; Inside approximation
    if @region == 0 || @region == 2
  
      ; Draw the Star of David
      if (y + 1/sq3 > 0) && (sq3*x - y + 2/sq3 > 0) \
         && (sq3*x + y - 2/sq3 < 0)
        bail = true
      endif
      if (-y + 1/sq3 > 0) && (sq3*x + y + 2/sq3 > 0) \
         && (sq3*x - y - 2/sq3 < 0)
        bail = true
      endif
   
      ; Deal the case where z needs a rotation
      if (arg > 5/6*pi) || (arg < -pi/2)
        z = z*exp(1i*4/3*pi)
      endif
      if (arg < pi/6) && (arg > -pi/2)
        z = z*exp(1i*2/3*pi)
      endif
      z = z - 1i*1/sq3
      if @region == 2
        zz = z
        z = #pixel
      endif
    endif
  
    ; Outside approximation
    if @region == 1 || @region == 2
  
      ; Draw the hexagon
      if |x| > 1 || x/sq3 + y - 2*sq3/3 > 0 \
         || x/sq3 + y + 2*sq3/3 < 0 || x/sq3 \
         - y + 2*sq3/3 < 0 || x/sq3 - y - \
         2*sq3/3 > 0
        bail = true
      endif
   
      ; Deal the case where z needs a rotation
      if (abs(arg) < pi/6)
        z = z*exp(-1i*pi/2)
      elseif (arg > pi/6) && (arg < pi/2)
        z = z*exp(-1i*5*pi/6)
      elseif (arg > pi/2) && (arg < 5*pi/6)
        z = z*exp(1i*5*pi/6)
      elseif (abs(arg) > 5*pi/6)
        z = z*exp(1i*pi/2)
      elseif (arg < -pi/6) && (arg > -pi/2)
        z = z*exp(-1i*pi/6)
      elseif (arg < -pi/2) && (arg > -5*pi/6)
        z = z*exp(1i*pi/6)
      endif
      z = z + 1i
      z = sq3*z
      
    endif
  
  ;----------------
  ;Other Iterations
  ;----------------
  elseif i > 2
    ; "Undo" the offset parameter's
    ; action
    z = z + @offset
    z = 1/sqrt(@r)*real(z) + 1i*sqrt(@r)*imag(z)
    if @region == 2
      oldz = z
      z = zz
      zz = oldz
    endif
    ; Magnify z so that a simple formula
    ; allows to compute...
    z = 3*z
    x = real(z)
    y = imag(z)
    ; ...the new triangle on the segment   
    if (y > 0) && (sq3*x - y + sq3 > 0) \
       && (sq3*x + y - sq3 < 0)
      bail2 = true
    endif
    ; Restore the original value of z
    z = z/3
  
    x = real(z)
    y = imag(z)
    ; Transforms the left segment
    if x < -1/3
      z = 3*z + 2
    ; Transforms the right segment
    elseif x > 1/3
      z = 3*z - 2
    else
      ; Transforms the middle-left segment
      if x < 0
        z = z + 1/3
        z = z*exp(-1i*pi/3)
        z = 3*z - 1
      ; Transforms the middle-right segment
      else
        z = z - 1/3
        z = z*exp(1i*pi/3)
        z = 3*z + 1
      endif
    endif
  
  endif
  
  ; A parameter to fool some coloring
  ; algorythms like final decomposition...
  if i >= 2
    z = z - @offset
  endif
  
bailout:
  bail == false && bail2 == false
  
default:
  title = "Koch Curve"
  helpfile = "sam-help/kochcurves.htm"
  helptopic = "kcurve"
  magn = 1.5
  center = (0.0002,0)
  maxiter = 50
  param region
    caption = "Trapped Region"
    default = 0
    enum = "Inside" "Outside" "Both"
  endparam
  param offset
    caption = "Offset"
    default = (0,0)
  endparam
  param r
    caption = "Twist Parameter"
    default = (1,0)
  endparam  
}
返回列表