sync on : sync rate 60
randomize timer()
bw = bitmap width() - 1
bh = bitmap height() - 1
for i = 0 to 3
v = make vector2(i)
next i
rem --- set corners of triangle fractal
set vector2 0, 0, 0
set vector2 1, bw, 0
set vector2 2, bw/2, bh
rem --- pick a random starting point on screen
set vector2 3, rnd(bw), rnd(bh)
count = 0
repeat
rem --- pick a corner and set a color
corner = rnd(2)
if corner = 0 then col = rgb(255,0,0)
if corner = 1 then col = rgb(0,255,0)
if corner = 2 then col = rgb(0,0,255)
rem --- get new screen co-ords between corner and current point
linear interpolate vector2 3, corner, 3, 0.5
dot x vector2(3), y vector2(3), col
rem --- update display every 1000 dots drawn
inc count,1
if count = 1000
sync
count = 0
endif
until spacekey()
for i = 0 to 3
v = delete vector2(i)
next i
end
Q
QuothTheRavenJoined: 2nd Oct 2002 Location: United States
Posted: 13th Dec 2002 5:54
Any way you could make it db 1.x compatible? I've been messing with fractals on my calculator and seeing what a computer could do would be great...
E
Easily ConfusedJoined: 22nd Oct 2002 Location: U.K. Earth. (turn right at Venus)
sync on : sync rate 60
randomize timer()
bw = bitmap width() - 1
bh = bitmap height() - 1
dim x(2)
dim y(2)
rem --- set corners of triangle fractal
x(0) = 0 : y(0) = 0
x(1) = bw : y(1) = 0
x(2) = bw/2 : y(2) = bh
rem --- pick a random starting point on screen
px = rnd(bw)
py = rnd(bh)
count = 0
repeat
rem --- pick a corner and set a color
corner = rnd(2)
if corner = 0 then col = rgb(255,0,0)
if corner = 1 then col = rgb(0,255,0)
if corner = 2 then col = rgb(0,0,255)
rem --- calculate new screen co-ords between corner and current point
x = (x(corner) - px) / 2
y = (y(corner) - py) / 2
px = px + x
py = py + y
dot px, py, col
rem --- update display every 1000 dots drawn
inc count,1
if count = 1000
sync
count = 0
endif
until spacekey()
end
E
Easily ConfusedJoined: 22nd Oct 2002 Location: U.K. Earth. (turn right at Venus)
Posted: 13th Dec 2002 8:00
...oops sorry, at the bottom of the loop you may have to change:
Inc count, 1
to
count = count + 1
S
spookyJoined: 30th Aug 2002 Location: United Kingdom