- 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 && !Trapped
Xabs = abs(real(#z))
Yabs = abs(imag(#z))
Dsgd0 = (Xabs-Rc*sin(phi))^2 + (Yabs - Rc*cos(phi))^2
Dsgd1 = (Xabs-Rc*sin(3*phi))^2 + (Yabs - Rc*cos(3*phi))^2
Dsgd2 = (Xabs-0)^2 + (Yabs - 0)^2
if Dsgd0 < RcSqd
Trapped = true
ZtoPsqd= Dsgd0
Circle = iter
elseif Dsgd1 < RcSqd
Trapped = true
ZtoPsqd= Dsgd1
Circle = iter
elseif Dsgd2 < RcSqd
Trapped = true
ZtoPsqd = Dsgd2
Circle = iter
endif
endif
final:
if !trapped
#solid = true
else
Circle = ((Circle + @off) % num)/(num-1)
float Ratio = sqrt(ZtoPsqd/Rcsqd)
float ColorIndex = 110 * Ratio + Circle * 140
#index = (ColorIndex + 1) % 256 /256
endif
default:
title = "7 Circles"
param r
caption = "Circle radius"
default = 0.18
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
}
|
|