new LSystem(alphabet, axiom, rules)
LSystem Generator
- Source:
Parameters:
Name | Type | Description |
---|---|---|
alphabet |
string
|
the characters recognized by the LSystem |
axiom |
string
|
The starting axiom of The LSystem generator |
rules |
object
|
a dictionary mapping letters to rules of LSystems |
Methods
addRule(key, action)
Add an extra Rule to the LSystem
- Source:
Parameters:
Name | Type | Description |
---|---|---|
key |
string
|
the rule to add |
action |
string
|
the action to perform with this rule |
iterate(nIters)
Iterates the LSystems
- Source:
Parameters:
Name | Type | Description |
---|---|---|
nIters |
number
|
Number of interations to compute |
processString(oldStr) → {string}
Processes the Current String according to the rules in the LSystem
- Source:
Parameters:
Name | Type | Description |
---|---|---|
oldStr |
string
|
the string to be processed |
Returns:
- Type:
-
string
the processede string
removeRule(key)
Removes a rule from the LSystem
- Source:
Parameters:
Name | Type | Description |
---|---|---|
key |
string
|
the rule to remove |