- UID
- 22171
- 帖子
- 418
- 精华
- 1
- 积分
- 1185
|
这个是8切圆陷阱,截得图,清晰一点。
这是8切圆的UF代码
8Circles2 {
init:
int iter = 0
float rangemun = 0
float x = 0
float y = 0
float num = 8
float Xabs = 0
float Yabs = 0
float Dsgd0 = 0
float Dsgd1 = 0
float Circle = 0
float ZtoPsqd = 0
float Rc = @r
float Phi = #pi * 0.125
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(3*phi))^2 + (Yabs - Rc*cos(3*phi))^2
if Dsgd0 < RcSqd
Trapped = true
ZtoPsqd= Dsgd0
if y > 0&& x > 0
Circle = 2
elseif y < 0 && x > 0
Circle = 2
elseif y < 0 && x < 0
Circle = 2
else
Circle = 2
endif
elseif Dsgd1 < RcSqd
Trapped = true
ZtoPsqd= Dsgd1
if y > 0&& x > 0
Circle = 2
elseif y < 0 && x > 0
Circle = 2
elseif y < 0 && x < 0
Circle = 2
else
Circle = 2
endif
endif
endif
;这里 Circle = 2是为了使图形的颜色一致,如果需要多种颜色的话,可以选取不同的值。
final:
if !trapped
#solid = true
else
Circle = ((Circle + @off) % num)
float Ratio = abs(ZtoPsqd/Rcsqd)
float ColorIndex = 55 * Ratio + Circle * 60
#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
} |
|