06-03-2022, 05:59 PM
Nice mods, B+. A couple of old fractalesque demos of mine:
alternate Kock snowflake
Flower of justice
Logistic map or the '1-dimensional Mandelbrot'
alternate Kock snowflake
Code: (Select All)
dim shared pi
dim shared c
dim shared cc
pi = 4*atn(1)
c = 2*sqr(3)/9
cc = sqr(12) / 6
sw = 1024
sh = 768
screen _newimage(sw, sh, 12)
tri sw/2, sh/2, 600, 0
tri sw/2, sh/2, 600, pi
cock sw/2, sh/2, 600, 3
sleep
system
sub cock(x, y, s, i)
if i = 0 then exit sub
for a = pi/6 to 2*pi + pi/6 step pi/3
xx = s*c*cos(a) + x
yy = s*c*sin(a) + y
tri xx, yy, s/3, a+pi/6
tri xx, yy, s/3, a+pi/6+pi
cock xx, yy, s/3, i - 1
next
end sub
sub tri(x, y, s, a)
line (x,y)-(x+s*cc*cos(pi/6 + a),y+s*cc*sin(pi/6 + a)),8
line (x,y)-(x+s*cc*cos(5*pi/6 + a),y+s*cc*sin(5*pi/6 + a)),8
line (x,y)-(x-s*cc*cos(pi/2 + a),y-s*cc*sin(pi/2 + a)),8
line (x+s*cc*cos(pi/6 + a),y+s*cc*sin(pi/6 + a))-(x+s*cc*cos(5*pi/6 + a),y+s*cc*sin(5*pi/6 + a))
line-(x-s*cc*cos(pi/2 + a),y-s*cc*sin(pi/2 + a))
line-(x+s*cc*cos(pi/6 + a),y+s*cc*sin(pi/6 + a))
end sub
Flower of justice
Code: (Select All)
const sw = 800
const sh = 600
dim shared pi as double
pi = 4*atn(1)
screen _newimage(sw, sh, 32)
r = 100
do
for a = 0.1 to 1 step 0.01
cls
fcirc sw/2, sh/2, a*r + (1-a)*150, a, 3
_display
_limit 5
next
_delay 2
loop
sleep
system
sub fcirc (x, y, r, a, n)
if n > 0 then
for t=0 to 2*pi step 2*pi/6
xx = x + r*cos(t)
yy = y + r*sin(t)
circle (xx, yy), r
fcirc xx, yy, a*r, a, n - 1
next
end if
end sub
Logistic map or the '1-dimensional Mandelbrot'
Code: (Select All)
deflng a-z
dim xx as double, uu as double
screen 12
for u=0 to 640
uu=2.8 + 1.2*u/640
for x=0 to 480
xx = x/480
for i=0 to 500
xx = uu*xx*(1-xx)
next
pset(u,480*(1-xx))
next
next
sleep
system