搞了好几遍,尝试了各种情形,仍不能得出结果:
Carr1965 {
; Updated for UF2 by Erik Reckase, March 2000
; Modified Sylvie Gallet frm.
init:
z=c=pixel
int compt=0, int limit=round(real(p1)), float bailout=4
loop:
IF (compt>=limit)
c = (-.743380900000982,.131850030300002)
ELSE
c = z + c/2.125
ENDIF
z=z*z+c
compt=compt+1
bailout:
|real(z)|<=bailout
default:
title = "Carr 1965"
periodicity = 0
maxiter = 500
magn = .9
center = (0,0)
method = multipass
param p1
caption = "Iter Limit"
default = (100,0)
hint = "The real part of this parameter signals a change \
in the value of c. The imaginary part is not used."
endparam
}
UF中效果图如下:
param offset
caption = "Orbit Separation"
default = 0.01
hint = "Defines how far apart the simultaneous orbits are. Smaller \
distances will produce more accurate results."
endparam
param xfer
caption = "Height Transfer"
default = 0
enum = "linear" "log" "sqrt" "cuberoot" "exp" "sqr" "cube" \
"sin" "cos" "tan"
hint = "This function will be applied to the height value \
before a slope is calculated."
endparam
param zscale
caption = "Height Pre-Scale"
default = 1.0
hint = "Specifies the ratio between height and distance. Higher \
values will exaggerate differences between high and low. \
In general, you will want to use smaller numbers here."
endparam
param zscale2
caption = "Height Post-Scale"
default = 0.025
hint = "Specifies the ratio between height and distance; like \
Height Pre-Scale, except that this value is applied after \
the transfer function."
endparam
param everyiter
caption = "Every Iteration"
default = false
hint = "If set, the surface normal will be computed at every \
iteration. If you are using a coloring algorithm which \
processes every iteration, you will need this."
endparam
}
位于sam.ufm系列中的科赫雪花曲线,我看了,扫描法出来的图形,美。我正在造第一个开关项,觉得这开关项可能简单点,单就这开关项的程序还没完全懂,我感觉到此分形能用几何画板做。
KochCurve {
; By Samuel Monnier, 2.1.00
init:
z = #pixel
zz = 0
; Twist
z = 1/sqrt(@r)*real(z) + 1i*sqrt(@r)*imag(z)
x = real(z)
y = imag(z)
sq3 = sqrt(3)
bool bail2 = false
bool bail = false
i = 0
loop:
i = i + 1
;----------------
; First Iteration
;----------------
if i == 2
; Draw the Star of David
if (y + 1/sq3 > 0) && (sq3*x - y + 2/sq3 > 0) \
&& (sq3*x + y - 2/sq3 < 0)
bail = true
endif
if (-y + 1/sq3 > 0) && (sq3*x + y + 2/sq3 > 0) \
&& (sq3*x - y - 2/sq3 < 0)
bail = true
endif
; Deal the case where z needs a rotation
if (arg > 5/6*pi) || (arg < -pi/2)
z = z*exp(1i*4/3*pi)
endif
if (arg < pi/6) && (arg > -pi/2)
z = z*exp(1i*2/3*pi)
endif
z = z - 1i*1/sq3
if @region == 2
zz = z
z = #pixel
endif
endif
; Draw the hexagon
if |x| > 1 || x/sq3 + y - 2*sq3/3 > 0 \
|| x/sq3 + y + 2*sq3/3 < 0 || x/sq3 \
- y + 2*sq3/3 < 0 || x/sq3 - y - \
2*sq3/3 > 0
bail = true
endif
; Deal the case where z needs a rotation
if (abs(arg) < pi/6)
z = z*exp(-1i*pi/2)
elseif (arg > pi/6) && (arg < pi/2)
z = z*exp(-1i*5*pi/6)
elseif (arg > pi/2) && (arg < 5*pi/6)
z = z*exp(1i*5*pi/6)
elseif (abs(arg) > 5*pi/6)
z = z*exp(1i*pi/2)
elseif (arg < -pi/6) && (arg > -pi/2)
z = z*exp(-1i*pi/6)
elseif (arg < -pi/2) && (arg > -5*pi/6)
z = z*exp(1i*pi/6)
endif
z = z + 1i
z = sq3*z
endif
;----------------
;Other Iterations
;----------------
elseif i > 2
; "Undo" the offset parameter's
; action
z = z + @offset
z = 1/sqrt(@r)*real(z) + 1i*sqrt(@r)*imag(z)
if @region == 2
oldz = z
z = zz
zz = oldz
endif
; Magnify z so that a simple formula
; allows to compute...
z = 3*z
x = real(z)
y = imag(z)
; ...the new triangle on the segment
if (y > 0) && (sq3*x - y + sq3 > 0) \
&& (sq3*x + y - sq3 < 0)
bail2 = true
endif
; Restore the original value of z
z = z/3
x = real(z)
y = imag(z)
; Transforms the left segment
if x < -1/3
z = 3*z + 2
; Transforms the right segment
elseif x > 1/3
z = 3*z - 2
else
; Transforms the middle-left segment
if x < 0
z = z + 1/3
z = z*exp(-1i*pi/3)
z = 3*z - 1
; Transforms the middle-right segment
else
z = z - 1/3
z = z*exp(1i*pi/3)
z = 3*z + 1
endif
endif
endif
; A parameter to fool some coloring
; algorythms like final decomposition...
if i >= 2
z = z - @offset
endif