太极陷阱UF代码更新:
Taijitu20140612 {
init:
int iter = 0
float x = 0
float y = 0
float d1 = 0
float d2 = 0
float d3 = 0
float L1 = 0
float L2 = 0
float ID = 0
float Circle = 0
float ZtoPsqd = 0
float Rc1 = @r
float Rc2 = 0.45*Rc1
float Rc4= 1/6*Rc1
float Phi = #pi * @angle/180
float xx= Rc2*cos(Phi)
float yy= Rc2*sin(Phi)
float Ty =0
bool Trapped = false
loop:
iter = iter + 1
x = real(#z)
y = imag(#z)
if iter > @skip
if (@rangevar==0&&!Trapped) ||(@rangevar==1)
d1 = sqrt((x-@ox)^2 + (y - @oy)^2)
d2 = sqrt((x - xx-@ox)^2 + (y - yy-@oy)^2)
d3 = sqrt((x + xx-@ox)^2 + (y +yy-@oy)^2)
L1=(x-@ox)*sin(Phi)-(y-@oy)*cos(Phi)
L2=(x-@ox)*cos(Phi)+(y-@oy)*sin(Phi)
Ty=((x-@ox)*cos(-Phi)-(y-@oy)*sin(-Phi))^2/(2*Rc2)^2+ ((x-@ox)*sin(-Phi)+(y-@oy)*cos(-Phi))^2/Rc1^2
if (d2< Rc2 && L1<=0 && L2>=0 && d2>Rc4)||(Ty<1 && L1>=0 && L2>=0 && d2>=Rc4)||(d3>=Rc2 && L1>=0 && d1<Rc1 && L2<=0)||(Ty>=1 && L1<=0 && d1<Rc1 && L2<=0)
Trapped = true
ZtoPsqd= d1/Rc1
Circle = 1
ID=iter
elseif (d3<Rc2 && L1>=0 && L2<=0 && d3>=Rc4)||(Ty<1 && L1<=0 && L2<=0 && d3>=Rc4)||(d2>=Rc2 && L1<=0 && d1<Rc1 && L2>=0)||(Ty>=1 && L1>=0 && d1<Rc1 && L2>=0 )
Trapped = true
ZtoPsqd= d1/Rc1
Circle = 2
ID=iter
elseif d2 < Rc4
trapped = true
ZtoPsqd = d2/Rc4
Circle = 2
ID=iter
elseif d3 < Rc4
trapped = true
ZtoPsqd = d3/Rc4
Circle = 1
ID=iter
endif
endif
endif
final:
if !trapped
#solid = true
else
Circle = (Circle +ID+ @off) % 8
float Ratio =ZtoPsqd
float ColorIndex = 29 * Ratio + Circle * 30
#index = (ColorIndex + 1) % 256 /256
endif
default:
title = "Taijitu20140612"
param r
caption = "Circle radius"
default = 0.2
endparam
param ox
caption = "ox"
default = 0.0
endparam
param oy
caption = "oy"
default = 0.0
endparam
param angle
caption = "angle"
default = 45.0
endparam
param skip
caption = "Iters to skip"
default = 1
hint = "Iterations to skip."
endparam
param rangevar
caption="range variable"
default=0
enum="先上后下" "后来居上"
endparam
param off
caption = "Hue cycle"
default = 0
min = 0
max = 4
hint = "This rotates the coloring order of the balls."
endparam
}
不知怎的,还纠正了前面代码反映的图形中鱼眼缺失的毛病。 |