class Lsystem { String axiom; int rc, rm, rint, rendercount; char[] sa; RuleSet ruleset; float renderindexfloat = 0.0; float startx; float starty; float unitsize; float anglechange; Lsystem(String axiom) { this.startx = random(width);//1024);// + 256; this.starty = random(50) + (height - 50);// 700; this.axiom = axiom; this.rc = 0; this.rendercount = 0; this.renderindexfloat = 0.0; }; void registerRuleSet(RuleSet rs) { this.ruleset = rs; }; String getAxiom() { return axiom; } void addStartF() { this.axiom = "F" + this.axiom; } void setUnitsize(float us) { this.unitsize = us; } void setAnglechange(float ac) { anglechange = ac; } void recurse(int maxi) { this.rm = maxi; this.rc ++; this.sa = this.axiom.toCharArray(); String[] ta = new String[this.sa.length]; for (int n=0; n this.axiom.length()) { this.renderindexfloat = this.axiom.length(); } int renderindex = floor(this.renderindexfloat); for (int i = 0; i < this.axiom.length(); i++) { //renderindex; i++) { if (i < renderindex) { gTurtle.process(this.axiom.charAt(i), true); } else { gTurtle.process(this.axiom.charAt(i), false); } } } if (gState == STATE_GROWN) { this.renderindexfloat = this.axiom.length() ; // draw entire structure for (int i = 0; i < this.axiom.length(); i++) { gTurtle.process(this.axiom.charAt(i), true); } } if (gState == STATE_SHRINKING) { this.renderindexfloat -= random(TREE_GROWTH_RATE * 2); if (this.renderindexfloat < 0.0) { this.renderindexfloat = 0.0; } int renderindex = floor(this.renderindexfloat); for (int i = 0; i < this.axiom.length(); i++) { if (i < renderindex) { gTurtle.process(this.axiom.charAt(i), true); } else { gTurtle.process(this.axiom.charAt(i), false); } } } }; };