1 // Copyright (C) 2006 Erik Dahlberg
3 // This file is part of LSystem3D.
5 // LSystem3D is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU General Public License
7 // as published by the Free Software Foundation; either version 2
8 // of the License, or (at your option) any later version.
10 // LSystem3D is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with LSystem3D; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 #ifndef LINDENMAYERSYSTEM_H
23 #define LINDENMAYERSYSTEM_H
37 * Lindenmayer system generator
39 class LindenmayerSystem
45 * @param model empty model
47 LindenmayerSystem(Model
*model
);
56 * Clear all parameters
61 * Generate L-system data
66 * Render L-system data
72 * Set the initial rule (the axiom)
73 * @param axiom the axiom
75 void setAxiom(Rule axiom
);
79 * @param rule the rule
81 void setRule(Rule rule
);
84 * Set the turn/pitch/roll angle
85 * @param degrees the angle, in degrees
87 void setAngle(double degrees
);
91 * @param depth depth of recursion
93 void setDepth(int depth
);
96 * Set initial segment diameter
97 * @param diameter the diameter
99 void setDiameter(double diameter
);
102 * Set segment diameter factor
103 * @param diameterFactor the diameter factor
105 void setDiameterFactor(double diameterFactor
);
109 * Get the initial rule (the axiom)
121 * Get the turn/pitch/roll angle
122 * @return the angle, in degrees
127 * Get recursion depth
128 * @return depth of recursion
133 * Get initial segment diameter
134 * @return the diameter
136 double getDiameter();
139 * Get segment diameter factor
140 * @return the diameter factor
142 double getDiameterFactor();
147 * Recursively apply the replacement rules
148 * @param rule the rule
149 * @param level recursion level
151 void recursiveWalk(string rule
, int level
);
158 double _segmentDiameter
;
160 Model
*_model
; // The active model
161 Turtle
*_turtle
; // The rendering turtle