Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/profan/lovely-systems
L-Systems in Lua with accompanying LÖVE2D example.
https://github.com/profan/lovely-systems
l-systems love2d lua
Last synced: 29 days ago
JSON representation
L-Systems in Lua with accompanying LÖVE2D example.
- Host: GitHub
- URL: https://github.com/profan/lovely-systems
- Owner: profan
- License: other
- Created: 2014-12-25T18:52:38.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2015-01-03T12:49:38.000Z (almost 10 years ago)
- Last Synced: 2024-04-24T04:43:16.683Z (8 months ago)
- Topics: l-systems, love2d, lua
- Language: Lua
- Size: 238 KB
- Stars: 4
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
![Tree](http://i.imgur.com/PZCJuuA.png)
lovely-systems
=================================Simple implementation of [L-Systems](http://en.wikipedia.org/wiki/L-system) in Lua, with examples in LÖVE2D.
Requirements
------------* Lua >= 5.1 (?)
* LÖVE2D (for the example project)Running the example project
love example
Downloading the source
------------
Either with git clone as below or by downloading a zipball of the [latest...](https://github.com/Profan/lovely-systems/archive/master.zip)
git clone https://github.com/Profan/lovely-systems.gitUsage
------------
When testing the example, use your arrow keys to change scale and segment size.Example of defining a sierpinski triangle, example also already present in example code.
```lua
local lsystem = require "l-system"
initial_state = {state = {'F'}, rules = {['F'] = 'G-F-G', ['G'] = 'F+G+F'} }
fractal = lsystem.nthstep(initial_state, 2) -- recurses twice
-- fractal.state now holds: F+G+F-G-F-G-F+G+F, in table form.
```
which in turn can be used to produce: ![Fractal](http://i.imgur.com/iPqtXre.png)or by increasing the iterations to 8, you can produce: ![BetterFractal](http://i.imgur.com/wR1noEP.png)
another example, a christmas tree! (sort of)
![Gran](http://i.imgur.com/KolwM5G.png)TODO
------------- [ ] ... write tests?
Credits
------------
Credits for the libraries which are used in the example!* Matthias Richter - [HUMP.](https://github.com/vrld/hump)
License
------------
See attached LICENSE file.