Dyna fractal

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

Dyna fractal

Post 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 7061 times

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

Re: Dyna fractal

Post by rbytes »

Beautiful! Do the designs ever repeat exactly?
The only thing that gets me down is gravity...

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

Re: Dyna fractal

Post 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

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

Re: Dyna fractal

Post by rbytes »

Can you translate this to Smart Basic? I tried today, but somewhere things went wrong! :o
The only thing that gets me down is gravity...

Henko
Posts: 792
Joined: Tue Apr 09, 2013 12:23 pm
My devices: iPhone,iPad
Windows
Location: Groningen, Netherlands
Flag: Netherlands

Re: Dyna fractal

Post 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 6948 times

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

Re: Dyna fractal

Post 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.
The only thing that gets me down is gravity...

Post Reply