- UID
- 7
- 帖子
- 2888
- 精华
- 10
- 积分
- 2836
|
48# 柳烟
上图中我只用了et判断M集内部着黑色,其它地方与et无关。可以参考一下UF中
mt-sierpinski-trap {
; Mark Townsend, 15 Oct 1999
;
; iteration trap inserted by red williams 17 November 1999
;
init:
trap_z = 0
int iter = 0
int frm_iter = 0
int trap_iter = 0
float dist = 0
float min_dist = 1e30
int res = 0
int lowtrap = abs(round(real(@itrap) * #maxiter))
int hightrap = abs(round(imag(@itrap) * #maxiter))
if lowtrap > hightrap
res = lowtrap
lowtrap = hightrap
hightrap = res
endif
loop:
w = (#z + @start) / (@scale + flip(@scale))
; Iterate the Sierpinski formula
frm_iter = 0
while frm_iter < @max_iterations
if (imag(w) > 0.5)
w = @a * real(w) + flip(@a * imag(w) -1)
elseif (real(w) > 0.5)
w = @a * real(w) -1 + flip(@a * imag(w))
else
w = @a * real(w) + flip(@a * imag(w))
endif
frm_iter = frm_iter + 1
endwhile
dist = cabs(@fn1(w))
if dist < min_dist
min_dist = dist
trap_z = #z
trap_iter = iter
endif
iter = iter + 1
final:
if @coloring == 0
#index = 0.001 * min_dist
elseif @coloring == 1
#index = cabs(trap_z)
elseif @coloring == 2
#index = 0.01 * trap_iter
elseif @coloring == 3
#index = abs(real(trap_z))
elseif @coloring == 4
#index = abs(imag(trap_z))
elseif @coloring == 5
float a = atan2(trap_z)
if a < 0
a = a + 2 * #pi
endif
a = 1 / (2 * #pi) * a
#index = a
endif
if !((#numiter >= lowtrap) && (#numiter <= hightrap))
if @opt == 1
#solid = true
endif
elseif (#numiter >= lowtrap) && (#numiter <= hightrap)
if @opt == 0
#solid = true
endif
endif
default:
title = "Sierpinski Trap"
param coloring
caption = "Coloring"
enum = "Distance" "Magnitude" "Iteration" "Real" "Imag" "Angle"
endparam
param a
caption = "Parameter"
default = 2.0
endparam
param max_iterations
caption = "Iterations"
default = 10
endparam
param start
caption = "Offset"
default = (0,0)
endparam
param @scale
caption = "Scale"
default = 1.0
endparam
param itrap
caption = "Iter. trap limits"
hint = "Between 0.0 and 1.0 (fraction of Maximum Iterations).\
Real part is lower boundary of trap and Imaginary \
part, the upper boundary. Pixels between these limits \
are colored according to Solid/Normal Choice."
default = (0.0,1.0)
endparam
param opt
caption = "Iter. trap mode"
enum = "Solid" "Normal"
default = 1
endparam
func fn1
caption = "Function"
default = ident()
endfunc
}
用 dist着色 |
|