UF中的另一特效:
作色程序:
TangentCircles {
; Mark Townsend, 29 Apr 1999
;
; ****** NOTE *******
; Instead of using this coloring method use
; the Tangent Balls mode of the Paul Carlson's
; Orbit Traps method in pwc.ucl.
; *******************
;
; Paul W. Carlson's Tangent Circles oribit trap
; method.
;
init:
int iter = 0
float x = 0
float y = 0
float Xabs = 0
float Yabs = 0
float Dsgd0 = 0
float Dsgd1 = 0
float Dsgd2 = 0
float Circle = 0
float ZtoPsqd = 0
float Rc = @r
float Phi = #pi * 0.125
float Rm = Rc / sin(Phi)
float RcSqd = Rc^2
float Py = Rm * sin(2 * Phi)
float Px = Rm * cos(2 * Phi)
bool Trapped = false
loop:
iter = iter + 1
x = real(#z)
y = imag(#z)
if abs((cabs(#z) - Rm)) < Rc && iter > @skip && !Trapped
Xabs = abs(x)
Yabs = abs(Y)
Dsgd0 = Xabs^2 + (Yabs - Rm)^2
Dsgd1 = (Xabs - Px)^2 + (Yabs - Py)^2
Dsgd2 = (Xabs - Rm)^2 + Yabs^2
if Dsgd0 < RcSqd
Trapped = true
ZtoPsqd= Dsgd0
if y > 0
Circle = 0
else
Circle = 4
endif
elseif Dsgd1 < RcSqd
Trapped = true
ZtoPsqd= Dsgd1
if y > 0&& x > 0
Circle = 1
elseif y < 0 && x > 0
Circle = 3
elseif y < 0 && x < 0
Circle = 5
else
Circle = 7
endif
elseif Dsgd2 < RcSqd
trapped = true
ZtoPsqd = Dsgd2
if x > 0
Circle = 2
else
Circle = 6
endif
endif
endif
final:
if !trapped
#solid = true
else
Circle = (Circle + @off) % 8
float Ratio = sqrt(ZtoPsqd/Rcsqd)
float ColorIndex = 29 * Ratio + Circle * 30
#index = (ColorIndex + 1) % 256 /256
endif
default:
title = "Carlson Tangent Circles"
param r
caption = "Circle radius"
default = 0.2
endparam
param skip
caption = "Iters to skip"
default = 1
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
}
感觉到程序不是太难,从UF的效果来看,类似作过的圆陷阱,我正在用画板整,感觉到可能要失败。大家想想办法。
|