- UID
- 22171
- 帖子
- 418
- 精华
- 1
- 积分
- 1185
|
上图是利用Mathcad做的,
UF代码
mt-beads { ; Mark Townsend, 13 July 1999
init:
trapped_z = 0
int iter = 0
int trapped_iter = 0
float distance = 0
bool trapped = false
if @no_of_iters == 0
int max_iter = #maxiter - @skip
else
int max_iter = @skip + @no_of_iters
endif
loop:
if !trapped || !@trapping && iter >= @skip && iter < max_iter
if (abs(real(#z)) < abs(cos(imag(#z))))
trapped = true
trapped_iter = iter
trapped_z = #z
distance = real(abs((abs(real(#z)) - abs(cos(imag(#z))))))
elseif (abs(imag(#z)) < abs(sin(real(#z))))
trapped = true
trapped_iter = iter
trapped_z = #z
distance = real(abs((abs(imag(#z)) - abs(sin(real(#z))))))
endif
endif
iter = iter + 1
final:
if trapped
if @color == 0
#index = distance
elseif @color == 1
#index = cabs(trapped_z)
elseif @color == 2
#index = abs(real(trapped_z))
elseif @color == 3
#index = abs(imag(trapped_z))
elseif @color == 4
float angle = atan2(trapped_z)
if angle < 0
angle = angle + 2 * #pi
endif
angle = 1 / (2 * #pi) * angle
#index = angle
elseif @color == 5
#index = 0.01 * trapped_iter
endif
else
#solid = true
endif
default:
title = "Beads"
param @color
caption = "Color mode"
enum = "Distance" "Magnitude" "Real" "Imag" "Angle" "Iteration"
endparam
param skip
caption = "Iterations to skip"
default = 0
endparam
param no_of_iters
caption = "No. of iterations"
hint = "This is the number of iterations to monitor the orbit."
default = 0
min = 0
endparam
param trapping
caption = "Bailout on first"
default = false
endparam
}
Mathcad代码只能用图片,太长了上传很不便啊 |
|