Snowflake fractal

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

Snowflake fractal

Post by Mr. Kibernetik »

Code: Select all

levels = 5
w,h = #.scrsize()
flake(w/2,h/2,#.min(w,h)/4,0)
flake(x,y,r,n)=
  > i, 1..12,2
    a = #.pi/6*i
    x1 = x+r*#.cos(a)
    y1 = y-r*#.sin(a)
    #.drawline(x,y,x1,y1)
    ? n<.levels, flake(x1,y1,r/3,n+1)
  <
.
Снимок.JPG
Снимок.JPG (65.91 KiB) Viewed 2290 times

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

Re: Snowflake fractal

Post by rbytes »

Fractals are amazing. I see so many of them in nature.
The only thing that gets me down is gravity...

Post Reply