Dyna fractal

Mr. Kibernetik
Posts: 4540
Joined: Mon Nov 19, 2012 10:16 pm
My devices: iPad, iPhone, MacBook Pro
Location: Russia
Flag:

Dyna fractal

Code: Select all

``````a = 1 ; b = 3 ; dt = 0.1 'change me
w,h = #.scrsize()
n = 0
> i, 0..h/10
> j, 0..w/10
x = j ; y = i
> k, 1..100
x,y = f(x,y)
#.drawpoint(x*10,y*10, #.hsv2rgb(n,1,1):3)
n += 0.001*w
<
<
<
f(x,y) <= x-#.sin(y+.a*#.sin(.b*y))*.dt, y+#.sin(x+.a*#.sin(.b*x))*.dt
``````
dyna.PNG (1.22 MiB) Viewed 6682 times

rbytes
Posts: 1329
Joined: Sun May 31, 2015 12:11 am
My devices: iPhone X
MacBook
Dell Inspiron laptop
CHUWI Plus 10 convertible Windows/Android tablet
Flag:
Contact:

Re: Dyna fractal

Beautiful! Do the designs ever repeat exactly?
Zzzzz

Mr. Kibernetik
Posts: 4540
Joined: Mon Nov 19, 2012 10:16 pm
My devices: iPad, iPhone, MacBook Pro
Location: Russia
Flag:

Re: Dyna fractal

rbytes wrote:
Thu Sep 14, 2017 4:52 am
Beautiful! Do the designs ever repeat exactly?
This depends on fractal parameters in the beginning of the program. I am not sure how it works actually

rbytes
Posts: 1329
Joined: Sun May 31, 2015 12:11 am
My devices: iPhone X
MacBook
Dell Inspiron laptop
CHUWI Plus 10 convertible Windows/Android tablet
Flag:
Contact:

Re: Dyna fractal

Can you translate this to Smart Basic? I tried today, but somewhere things went wrong!
Zzzzz

Henko
Posts: 790
Joined: Tue Apr 09, 2013 12:23 pm
Windows
Location: Groningen, Netherlands
Flag:

Re: Dyna fractal

Here you are

Code: Select all

``````graphics ! graphics clear 1,1,1
a=1 ! b=3 ! dt=0.1
get screen size w,h
n=0
for i=0 to h/10
for j=0 to w/10
x=j ! y=i
for k=1 to 100
xn=x-sin(y+a*sin(b*y))*dt
yn=y+sin(x+a*sin(b*x))*dt
x=xn ! y=yn
pal(n%360)
draw pixel 10*x,10*y color pal.r, pal.g, pal.b
n+=0.001*w
next k
next j
next i
end

def pal(t)
r=0 ! g=0 ! b=0
if t<120 or t>240 then r=palsub(abs(t-360*floor(t/240)))
if t<240 then g=palsub(abs(t-120))
if t>120 then b=palsub(abs(t-240))
end def
def palsub(e)
f=.5   ' 0<=f<=1 better balance between prim. and sec. colors
if e<60 then c=1 else ! x=(120-e)/60 ! c=x*(1+f-f*x) ! end if
return c
end def
``````
IMG_1524.PNG (1.21 MiB) Viewed 6569 times

rbytes
Posts: 1329
Joined: Sun May 31, 2015 12:11 am
My devices: iPhone X