private void initRules(LSystemType type) { rules.Clear(); axiom = ""; switch (type) { case LSystemType.Algae: rules.Add('A', "AB"); rules.Add('B', "A"); this.axiom = "A"; break; case LSystemType.FracatalTree: rules.Add('1', "11"); rules.Add('0', "1[0]0"); this.axiom = "0"; this.angle = 45; break; case LSystemType.Parametric: this.axiom = "L"; rules.Add('L', "F[-L0][+L0]"); parametricChar.Add('-'); parametricChar.Add('0'); parametricChar.Add('+'); parametricChar.Add('F'); this.angle = 10; break; case LSystemType.Plant: rules.Add('F', "FF+[+F-F-F]-[-F+F+F]"); this.axiom = "F"; this.angle = 25; break; case LSystemType.FractalPlant: rules.Add('F', "FF"); rules.Add('X', "F+[[X]-X]-F[-FX]+X"); this.axiom = "X"; this.angle = 25; break; case LSystemType.FractalBush: rules.Add('F', " F[+FF][-FF]F[-F][+F]F"); //rules.Add('F', "FF[-F][+F]F + F"); this.axiom = "F"; this.angle = 35; break; case LSystemType.Weed: rules.Add('F', "FF-[XY]+[XY]"); rules.Add('X', "+FY"); rules.Add('Y', "-FX"); this.axiom = "F"; this.angle = 22.5f; break; case LSystemType.Leaf: rules.Add('F', ">F<"); rules.Add('a', "F[+x]Fb"); rules.Add('b', "F[-y]Fa"); rules.Add('x', "a"); rules.Add('y', "b"); this.axiom = "a"; this.angle = 45f; break; case LSystemType.Sticks: rules.Add('F', "FF"); rules.Add('X', "F[+X]F[-X]+X"); this.axiom = "X"; this.angle = 20f; break; } }
public LSystemRuleSet(LSystemType type) { initRules(type); }