Monday, June 03, 2013

Binary fractal images

Interesting graphics, but also very cool the way L-Systems are defined [ref].
Like this one for example:







Which means:

  1. start with a gray square
  2. after that:
    1. black square simply stay the same, but with finer grain/resolution
    2. white square: the same
    3. a gray square is rewritten as (at 2 times the "resolution") as black+white and 2 gray squares below.

So here the evolution of this 2D grammar:




Cool stuff! :)


Very cool also this way of defining L-systems using also rotation:





In this way the rule is applied recursively but also rotated.
And the result is:





With a normal Context-Free Grammar this would be something like:
   S -> B
   B -> [ B W , B90 B120 ]

And here is a bit more theory: 2x2 symmetric L-systems

/\_/\_/\_/\_/\_/\_/\_/\_/\_/\_/\_/\_/\_/\_/\_/\_/\_/\_/\_/\_/\_/\_/\_/\_/\_/\_/\_/\_

Finally, the following rules

can be expressed as a CFG, like this:

S -> G
B -> [ B B , B B ]
W -> [ W W , W W ]
G -> [ B W , G G ]
B ->  [#]
W -> [ ]
G ->  [/]

where "#", " " and "/" are terminals, and [ a b , c d ] is printed as:
    a b
    c d
and S is the start symbol.
Derivations would be:

S => G => [ B W , G G ] => [ [ B B , B B ] W , G G ]  ...

No comments:

Post a Comment