Skip to content

oneearedrabbit/l-sys-playground

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

L-system Playground

An L-system, or Lindenmayer system, is a parallel rewriting system and a type of formal grammar used to model the growth of biological organisms. L-systems can also be used to generate space-filling curves and to describe mathematical processes, such as fractals, through the iteration of production rules.

Here are some L-system rules I gathered from various sources. I apologize for missing attributions; some original sources are lost and I need to recover them. Each curve is interactive and can be modified as needed.

    F: Move forward by line length drawing a line
    -: Turn left by turning angle
    +: Turn right by turning angle
    A: An axiom
    A => B: A rule
    setting = value: A configuration setting

The intentional decision has been made not to support branching, usually represented by [ and ] symbols. I acknowledge that these are powerful operations, yet I prefer to implement them as a fork operation, and I didn't explore this space.

How to

This is a single-file static website that implements an L-system fractal as a web component. CodeMirror is used as an external dependency for a code editor. To use the website, open index.html in a browser.

Web Component example:

    <web-fractal
        data-name="H-indexing"
        data-creator="oneearedrabbit"
        data-creation-date="2024-02-12"
        data-description="A new two-dimensional (2-D) indexing scheme called H-indexing, which has superior (possibly optimal) locality in comparison with the well-known Hilbert indexings. H-indexings form a Hamiltonian cycle and we prove that they are optimally locality-preserving among all cyclic indexings."
    >
        order = 4
        angle = 90

        A => BF-F-BFFFC-F-FC+F+BF-F-BFFFC-F-FC
        B => BFFFC-F-FC+F+B
        C => C+F+BF-F-BFFFC
    </web-fractal>

Contribute

Found a typo or have an L-system to suggest? Noticed an attribution mistake or want to clarify something? Please file a ticket: https://github.com/oneearedrabbit/l-sys-playground/issues

Screenshot

image

Releases

No releases published

Packages

No packages published

Languages