Godot Nature of Code  1.2.0
Nature of Code implemented in Godot Engine
Protected Member Functions | List of all members
Fractals.StochasticLSystem Class Reference

Stochastic L-System. More...

Inheritance diagram for Fractals.StochasticLSystem:
Fractals.LSystem

Protected Member Functions

override string ApplyRules (char letter)
 Apply rules on a letter. More...
 
- Protected Member Functions inherited from Fractals.LSystem
List< LSystemRuleGetMatchingRules (char letter)
 Get matching rules for a letter. More...
 

Additional Inherited Members

- Public Member Functions inherited from Fractals.LSystem
void GenerateOne ()
 Generate one generation. More...
 
- Public Attributes inherited from Fractals.LSystem
string Current
 Current string. More...
 
List< LSystemRuleRules
 Rules. More...
 
- Properties inherited from Fractals.LSystem
int Generation [get]
 Generation count. More...
 

Detailed Description

Stochastic L-System.

Definition at line 78 of file LSystem.cs.

Member Function Documentation

◆ ApplyRules()

override string Fractals.StochasticLSystem.ApplyRules ( char  letter)
inlineprotectedvirtual

Apply rules on a letter.

Parameters
letterLetter
Returns
Output text.

Reimplemented from Fractals.LSystem.

Definition at line 85 of file LSystem.cs.

86  {
87  var matchingRules = GetMatchingRules(letter);
88  if (matchingRules.Count > 0)
89  {
90  var index = MathUtils.RandRangei(0, matchingRules.Count - 1);
91  return matchingRules[index].Output;
92  }
93 
94  return letter.ToString();
95  }
List< LSystemRule > GetMatchingRules(char letter)
Get matching rules for a letter.
Definition: LSystem.cs:43
Math utility functions
Definition: MathUtils.cs:7
static int RandRangei(int min, int max)
Return an int RandRange.
Definition: MathUtils.cs:37

The documentation for this class was generated from the following file: