- UID
- 22171
- 帖子
- 418
- 精华
- 1
- 积分
- 1185
|
将上文件稍作修改,可以得到:
代码:
8Circles2 {
init:
int iter = 0
float rangemun = 0
float x = 0
float y = 0
float num = 10
float Xabs = 0
float Yabs = 0
float Dsgd0 = 0
float Dsgd1 = 0
float Dsgd2 = 0
float Ratio = 0
float Circle = 0
float ZtoPsqd = 0
float Rc = @r
float Phi = #pi /12
float Rm = Rc * sin(Phi)
float RcSqd = Rm^2
bool Trapped = false
loop:
iter = iter + 1
x = real(#z)
y = imag(#z)
if iter > @skip && !Trapped
Xabs = abs(real(#z))
Yabs = abs(imag(#z))
Dsgd0 = (Xabs-Rc*sin(phi))^2 + (Yabs - Rc*cos(phi))^2
Dsgd1 = (Xabs-Rc*sin(5*phi))^2 + (Yabs - Rc*cos(5*phi))^2
Dsgd2 = abs(abs(x)-abs(y))
if Dsgd0 < RcSqd
Trapped = true
ZtoPsqd= Dsgd0
if Y > 0&& x > 0
Circle = 1
elseif y < 0 && x > 0
Circle = 0
elseif y < 0 && x < 0
Circle = 5
else
Circle = 4
endif
Ratio = sqrt(ZtoPsqd/Rcsqd)
elseif Dsgd1 < RcSqd
Trapped = true
ZtoPsqd= Dsgd1
if Y > 0&& x > 0
Circle = 2
elseif y < 0 && x > 0
Circle = 3
elseif y < 0 && x < 0
Circle = 6
else
Circle = 7
endif
Ratio = sqrt(ZtoPsqd/Rcsqd)
elseif Dsgd2 < 4*RcSqd
trapped = true
ZtoPsqd = 4*Dsgd2
if x > 0
Circle = 9
else
Circle = 8
endif
Ratio = sqrt(0.15*ZtoPsqd/Rcsqd)
endif
endif
final:
if !trapped
#solid = true
else
Circle = ((Circle + @off) % num)/(num-0)
float ColorIndex = 120 * Ratio + Circle * 100
#index = (ColorIndex + 1) % 256 /256
endif
default:
title = "8 Circles2"
param r
caption = "Circle radius"
default = 0.4
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
} |
|