Dyna fractal

Post Reply
User avatar
Mr. Kibernetik
Site Admin
Posts: 4411
Joined: Mon Nov 19, 2012 10:16 pm
My devices: iPad, iPhone, MacBook
Location: Russia
Flag: Russia

Dyna fractal

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

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 1085 times

User avatar
rbytes
Posts: 1798
Joined: Sun May 31, 2015 12:11 am
My devices: iPhone X
iPad 4
Dell Inspiron laptop
CHUWI Plus 10 convertible Windows/Android tablet
Location: Calgary, Canada
Flag: Canada
Contact:

Re: Dyna fractal

Post by rbytes » Thu Sep 14, 2017 4:52 am

Beautiful! Do the designs ever repeat exactly?
####### Living the colorful life #######

User avatar
Mr. Kibernetik
Site Admin
Posts: 4411
Joined: Mon Nov 19, 2012 10:16 pm
My devices: iPad, iPhone, MacBook
Location: Russia
Flag: Russia

Re: Dyna fractal

Post by Mr. Kibernetik » Thu Sep 14, 2017 4:54 am

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

User avatar
rbytes
Posts: 1798
Joined: Sun May 31, 2015 12:11 am
My devices: iPhone X
iPad 4
Dell Inspiron laptop
CHUWI Plus 10 convertible Windows/Android tablet
Location: Calgary, Canada
Flag: Canada
Contact:

Re: Dyna fractal

Post by rbytes » Tue Jul 03, 2018 12:14 am

Can you translate this to Smart Basic? I tried today, but somewhere things went wrong! :o
####### Living the colorful life #######

Henko
Posts: 780
Joined: Tue Apr 09, 2013 12:23 pm
Flag: Netherlands

Re: Dyna fractal

Post by Henko » Wed Jul 04, 2018 8:35 pm

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 972 times

User avatar
rbytes
Posts: 1798
Joined: Sun May 31, 2015 12:11 am
My devices: iPhone X
iPad 4
Dell Inspiron laptop
CHUWI Plus 10 convertible Windows/Android tablet
Location: Calgary, Canada
Flag: Canada
Contact:

Re: Dyna fractal

Post by rbytes » Wed Jul 04, 2018 9:29 pm

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.
####### Living the colorful life #######

Post Reply