- UID
- 22171
- 帖子
- 418
- 精华
- 1
- 积分
- 1185
|
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
} |
|