Page 1 of 1

Dyna fractal

Posted: Wed Sep 13, 2017 4:40 pm
by Mr. Kibernetik

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
dyna.PNG (1.22 MiB) Viewed 50785 times

Re: Dyna fractal

Posted: Thu Sep 14, 2017 4:52 am
by rbytes
Beautiful! Do the designs ever repeat exactly?

Re: Dyna fractal

Posted: Thu Sep 14, 2017 4:54 am
by Mr. Kibernetik
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 :D

Re: Dyna fractal

Posted: Tue Jul 03, 2018 12:14 am
by rbytes
Can you translate this to Smart Basic? I tried today, but somewhere things went wrong! :o

Re: Dyna fractal

Posted: Wed Jul 04, 2018 8:35 pm
by Henko
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
IMG_1524.PNG (1.21 MiB) Viewed 50672 times

Re: Dyna fractal

Posted: Wed Jul 04, 2018 9:29 pm
by rbytes
This looks great. Fantastic shapes emerge when the parameters are changed.
You should post this in the Smart Basic Programs section so more users will see it.