返回列表 回复 发帖
一圆六环陷阱
New.jpg
7Circles {
init:
  int iter = 0
  float num = 5
  float Xabs = 0
  float Yabs = 0
  float Dsgd0 = 0
  float Dsgd1 = 0
  float Dsgd2 = 0
  float Circle = 0
  float ZtoPsqd = 0
  float Rc = @r
  int n1 = @n
  float Phi = #pi /n1
  float Rm = Rc * sin(Phi)
  float RcSqd = Rm^2
  bool Trapped = false
loop:
  iter = iter + 1
  if iter > @skip
    Xabs = abs(real(#z))
    Yabs = abs(imag(#z))
    Dsgd0 = abs(sqrt((Xabs-Rc*sin(phi))^2 + (Yabs - Rc*cos(phi))^2)-0.09)
    Dsgd1 = abs(sqrt((Xabs-Rc*sin(3*phi))^2 + (Yabs - Rc*cos(3*phi))^2)-0.09)
    Dsgd2 = (Xabs-0)^2 + (Yabs - 0)^2
    if Dsgd0 < RcSqd
      Trapped = true
      ZtoPsqd= Dsgd0
        Circle = 1
    elseif Dsgd1 < RcSqd
      Trapped = true
      ZtoPsqd= Dsgd1
        Circle = 3
    elseif Dsgd2 < RcSqd
      Trapped = true
      ZtoPsqd = Dsgd2
        Circle = 5
   endif
endif
final:
  if !trapped
    #solid = true
  else
    Circle = ((Circle + @off) % num)/(num+1)
    float Ratio = sqrt(ZtoPsqd/Rcsqd)
    float ColorIndex = 100 * Ratio + Circle * 130
    #index = (ColorIndex + 1) % 256 /256
  endif
default:
  title = "7 Circles"
  param r
    caption = "Circle radius"
    default = 0.2
  endparam
  param n
    caption = "Circle numbers"
    default = 6
    min = 4
    max = 9
  endparam
  param skip
    caption = "Iters to skip"
    default = 0
    hint = "Iterations to skip."
  endparam
  param off
    caption = "Hue cycle"
    default = 1
    min = 0
    max = 7
    hint = "This rotates the coloring order of the balls."
  endparam
}
111# lnszdzg
漂亮,美。
New.jpg
1Circles {
init:
  int iter = 0
  float num = 6
  float Xabs = 0
  float Yabs = 0
  float Dsgd0 = 0
  float Dsgd1 = 0
  float argz = 0
  float Circle = 0
  float ZtoPsqd = 0
  float Rc = @r
  float RcSqd = Rc
  bool Trapped = false
loop:
  iter = iter + 1
  if iter > @skip && !trapped
    Xabs = real(#z)
    Yabs = imag(#z)
    argz = atan(Yabs/Xabs)
     ;if argz <0
      ;argz =argz +#pi
     ;endif
    Dsgd0 = Rc*abs(sin(4/2*argz))
    Dsgd1 = sqrt(abs((Xabs-0)^2 + (Yabs - 0)^2- Dsgd0) )
    if Dsgd1 < RcSqd
      Trapped = true
      ZtoPsqd= Dsgd1/RcSqd
        Circle = iter
   endif
endif
final:
  if !trapped
    #solid = true
  else
    Circle = (Circle + @off) % num
    float Ratio = ZtoPsqd
    float ColorIndex = 30 * Ratio + Circle * 40
    #index = (ColorIndex + 1) % 256 /256
  endif
default:
  title = "蝴蝶线"
  param r
    caption = "Circle radius"
    default = 0.2
  endparam
  param skip
    caption = "Iters to skip"
    default = 0
    hint = "Iterations to skip."
  endparam
  param off
    caption = "Hue cycle"
    default = 0
    min = 0
    max = 7
    hint = "This rotates the coloring order of the balls."
  endparam
}
一枝梅
New.jpg

RE: 几何画板分形的mathcad之实现

N集
New.jpg
这个着色采用了HSV,其中H关联iter,S=√dist,V=√1-dist,(√是根号)加了根号似乎比S=dist,1-dist好一些,向老师,常老师,柳老师......哥几位不妨试试。
117# lnszdzg
谢谢传经送宝,空了试试。
New.jpg
119# lnszdzg
这个J集有趣。
返回列表