https://github.com/oelin/l-system
Simple implementation of L-systems in Python.
https://github.com/oelin/l-system
Last synced: 3 months ago
JSON representation
Simple implementation of L-systems in Python.
- Host: GitHub
- URL: https://github.com/oelin/l-system
- Owner: oelin
- License: mit
- Created: 2024-03-11T21:41:35.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-03-11T22:01:29.000Z (over 1 year ago)
- Last Synced: 2024-03-11T23:22:32.432Z (over 1 year ago)
- Language: Python
- Size: 4.88 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# L-system
Lindenmayer Systems, or L-systems, are a mathematical formalism introduced by biologist Aristid Lindenmayer in 1968 to describe the growth processes of plant development. They have since found applications in computer graphics, art, and linguistics. This repository provides a simple implementation in Python.
## Usage
Define an L-system. The example below [represents a binary tree](https://www.youtube.com/watch?v=puwhf-404Xc).
```python
system = LSystem({
'X': 'XX',
'Y': 'X[-Y][+Y]',
})
```Grow the system for some number of steps.
```python
system.grow('Y', steps=3) # Returns 'XX[-X[-Y][+Y]][+X[-Y][+Y]]'
```