summaryrefslogtreecommitdiff
path: root/README.md
blob: c1d61bd28d463df2752d154980af9c60d7c7b0ed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
L-Systems.JS
============

A full, 3D L-Systems implementation in JavaScript

Syntax
------

 - `F`: move one unit vector forward
 - `+` / `-`: turn right / left by angle `alpha`
 - `&` / `^`: pitch up / down by angle `alpha`
 - `<` / `>`: roll right / left by angle `alpha`
 - `|`: reverse vector direction
 - `[` / `]`: push / pop current tree state

Usage
-----

```js
var lsys = new LSystem('F', { 'F' : 'F-F+FF' });
var tree = lsys.iterate(2);
console.log(tree)  // F-F+FF-F-F+FF+F-F+FFF-F+FF
```