- UID
- 7
- 帖子
- 2888
- 精华
- 10
- 积分
- 2836
|
在UF的pwc.ufm中
TbNewtMset1 {
; Paul Carlson
init:
bool first = TRUE
bool done = FALSE
float Phi = #pi * 0.125
float Rc = real(@R)
float Rm = Rc/sin(Phi);
float Py = Rm*sin(Phi+Phi)
float Px = Rm*cos(Phi+Phi)
float RcSqd = Rc*Rc
int iter = 0
complex C = #pixel
W = sqrt((1 - C)/6)
#Z = (250,0)
loop:
complex W2 = W * W
complex W3 = W * W2
complex W4 = W * W3
complex Err = (W4 + (C-1)*W2 - C)/(4*W3 + 2*(C-1)*W)
W = W - Err
IF ((abs(cabs(W) - Rm) < Rc) && first == FALSE)
float X = real(W)
float Y = imag(W)
float Xabs = abs(X)
float Yabs = abs(Y)
float Dsqd0 = Xabs*Xabs+(Yabs-Rm)*(Yabs-Rm)
float Dsqd1 = (Xabs-Px)*(Xabs-Px)+(Yabs-Py)*(Yabs-Py)
float Dsqd2 = (Xabs-Rm)*(Xabs-Rm)+Yabs*Yabs
IF (Dsqd0 < RcSqd)
done = TRUE
float ZtoPsqd = Dsqd0
IF (Y >0 )
float Circle = 0
ELSE
Circle = 4
ENDIF
ELSEIF (Dsqd1 < RcSqd)
done = TRUE
ZtoPsqd = Dsqd1
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 (Dsqd2 < RcSqd)
done = TRUE
ZtoPsqd = Dsqd2
IF (X > 0)
Circle = 2
ELSE
Circle = 6
ENDIF
ENDIF
ENDIF
IF (done == TRUE)
float Ratio = sqrt(ZtoPsqd/Rcsqd)
#Z = 29.0 * Ratio + Circle * 30.0
ELSEIF (|Err| < 0.000001)
done = TRUE
IF (iter % 2 == 0)
#z = 254
ELSE
#z = 253
ENDIF
ENDIF
first = FALSE
iter = iter + 1
bailout:
done == FALSE
default:
title = "Tangent Balls Newton Mset"
maxiter = 3000
param R
caption = "Circle radius"
default = 0.2
hint = "The radius of the trap circles."
endparam
} |
|