defdbl a-z
const sw = 640
const sh = 480
dim shared mx,my,mbl,mbr,mw
dim u as double, v as double
dim uu as double, vv as double
dim xx as double, yy as double
dim x0 as double, y0 as double
dim z as double, zz as double
z = 1
zz = 0.1
dim p1 as long
p1 = _newimage(sw, sh, 32)
screen _newimage(sw, sh, 32)
redraw = -1
iter = 500
dim c(100) as long, cc as long
for i=0 to 100
if i < iter/6 then
r = 155
g = (i mod (iter/6))*(255/(iter/6))
b = 0
elseif i < 2*iter/6 then
r = 155 - (i mod (iter/6))*(255/(iter/6))
g = 155
b = 0
elseif i < 3*iter/6 then
r = 0
g = 155
b = (i mod (iter/6))*(255/(iter/6))
elseif i < 4*iter/6 then
r = 0
g = 155 - (i mod (iter/6))*(255/(iter/6))
b = 155
elseif i < 5*iter/6 then
r = (i mod (iter/6))*(255/(iter/6))
g = 0
b = 155
else
r = 155
g = 0
b = 155 - (i mod (iter/6))*(255/(iter/6))
end if
c(i) = _rgb(r, g, b)
next
ppp=28
sss=10
bbb=8/3
zzz=0.456
hh=0.01
do
mw = 0
getmouse
if redraw then
for yy = 0 to sh-1
for xx = 0 to sw-1
u = 0
v = 0
x = (xx - sw/2)*z + x0
y = (yy - sh/2)*z + y0
z2 = zzz
for i = 0 to iter
x = x + hh*sss*(y - x)
y = y + hh*(x*(ppp - z2) - y)
z2=z2 + hh*(x*y - bbb*z2)
if (x*x + y*y) < 2 then exit for
next
if i > iter then
pset(xx, yy), _rgb(0,0,0)
else
pset(xx, yy), c(i mod 100)
end if
next
next
'locate 1,1
'print "iter =";iter
_title str$(iter)
_dest p1
_putimage , 0
_dest 0
_putimage , p1
_autodisplay
redraw = 0
end if
if mw < 0 then
zz = zz + 0.01
elseif mw > 0 then
if zz > 0.01 then zz = zz - 0.01
end if
'draw box
if omx <> mx or omy <> my or mw <> 0 then
_putimage , p1
line (mx - (sw*zz/2), my - (sh*zz/2))-step(sw*zz,sh*zz),_rgb(255,255,255),b
_autodisplay
omx = mx
omy = my
end if
if mbl then
do
getmouse
loop while mbl
x0 = x0 + (mx - sw/2)*z
y0 = y0 - (sh/2 - my)*z
z = z*zz
iter = iter + 50
redraw = -1
elseif mbr then
do
getMouse
loop while mbr
x0 = x0 + (mx - sw/2)*z
y0 = y0 - (sh/2 - my)*z
z = z/zz
redraw = -1
end if
k = _keyhit
if k = 43 then
iter = iter + 50
redraw = -1
elseif k = 45 then
if iter > 50 then iter = iter - 50
redraw = -1
end if
loop until k = 27
system
sub getmouse ()
do
mx = _mousex
my = _mousey
mbl = _mousebutton(1)
mbr = _mousebutton(2)
mw = mw + _mousewheel
loop while _mouseinput
end sub
'u + iv = (x + iy) ^ (a + ib)
sub cexp (u as double, v as double, x as double, y as double, a as double, b as double)
dim mag as double, arg as double
dim lnz as double, argz as double
lnz = 0.5*log((x*x + y*y)+0.00001)
argz = _atan2(y, x)
mag = exp(a*lnz - b*argz)
arg = a*argz + b*lnz
u = mag * cos(arg)
v = mag * sin(arg)
end sub
const sw = 640
const sh = 480
dim shared pi
pi = 4*atn(1)
rr = 500
h = 1200
screen _newimage(sw, sh, 32)
p = 28
s = 10
b = 8/3
h = 0.01
x = 0.3
y = 0.3
z = 0.456
pset (sw/2 + 10*x, sh - 10*z),_rgba(255,255,0,100)
for i=0 to 14000
x = x + h*s*(y - x)
y = y + h*(x*(p - z) - y)
z = z + h*(x*y - b*z)
line -(sw/2 + 10*x, sh - 10*z),_rgba(255,255,0,100)
next
do
loop until _keyhit = 27
rot = 0
do
rot = rot + 0.01
line (0,0)-(sw,sh),_rgb(0,0,0),bf
x = 0.3
y = 0.3
z = 0.456
xx = x*cos(rot) - y*sin(rot)
yy = x*sin(rot) + y*cos(rot)
pset (sw/2 + 35*xx*700/(yy + 2500), sh - 35*z*700/(yy + 2500)),_rgba(255,255,0,100)
for i=0 to 14000
x = x + h*s*(y - x)
y = y + h*(x*(p - z) - y)
z = z + h*(x*y - b*z)
xx = x*cos(rot) - y*sin(rot)
yy = x*sin(rot) + y*cos(rot)
line -(sw/2 + 35*xx*700/(yy + 2500), sh - 35*z*700/(yy + 2500)),_rgba(255,255,0,100)
next
_display
_limit 60
loop until _keyhit=27
rot = 0
do
rot = rot + 0.01
line (0,0)-(sw,sh),_rgb(0,0,0),bf
x = 0.3
y = 0.3
z = 0.456
yy = y*cos(rot) - (z - 35)*sin(rot)
zz = y*sin(rot) + (z - 35)*cos(rot)
pset (sw/2 + 35*x*700/(yy + 2500), sh/2 - 35*zz*700/(yy + 2500)),_rgba(255,255,0,100)
for i=0 to 14000
x = x + h*s*(y - x)
y = y + h*(x*(p - z) - y)
z = z + h*(x*y - b*z)
yy = y*cos(rot) - (z - 35)*sin(rot)
zz = y*sin(rot) + (z - 35)*cos(rot)
line -(sw/2 + 35*x*700/(yy + 2500), sh/2 - 35*zz*700/(yy + 2500)),_rgba(255,255,0,100)
next
_display
_limit 60
loop until _keyhit=27
sleep
system