#include "model.h"
#include "turtle.h"
-using namespace std;
-
/**
class LindenmayerSystem
{
public:
+
/**
* Constructor
- * @param model the model for generation
+ * @param model empty model
*/
LindenmayerSystem(Model *model);
*/
~LindenmayerSystem();
+ /**
+ * Clear all parameters
+ */
+ void clear();
+
+ /**
+ * Generate L-system data
+ */
+ void generate();
+
/**
* Set the initial rule (the axiom)
* @param axiom the axiom
*/
void setNumIterations(int numIterations);
+ /**
+ * Set diameter of segment
+ * @param diameter the diameter
+ */
+ void setDiameter(double diameter);
+
+ /**
+ * Set diameter factor
+ * @param diameterFactor the diameter factor
+ */
+ void setDiameterFactor(double diameterFactor);
+
/**
* Get the initial rule (the axiom)
* @return the axiom
int getNumIterations();
/**
- * Generate l-system data
+ * Get the generated model
+ * @return generated model
*/
- void generate();
+ Model *getModel();
protected:
/**
- * Walk through the rule string for specified number of levels
- * @param rule the rule
- * @param level current iteration level
+ * Recursively apply the replacement rules
+ * @param rule rule
+ * @param level recursion level
*/
void recursiveWalk(string rule, int level);
/**
* Verify and preprocess one rule string
- * @param ruleOrAxiom the rule
+ * @param rule the rule
* @return the preprocessed rule
*/
- string verifyAndPreprocessRule(string ruleOrAxiom);
+ string verifyAndPreprocessRule(string rule);
/**
* Unpreprocess one rule string
- * @param ruleOrAxiom the rule
+ * @param rule the rule
* @return the unpreprocessed rule
*/
- string unpreprocessRule(string ruleOrAxiom);
+ string unpreprocessRule(string rule);
// Parameters
string _axiom;
- map<string,string> _rules; // TODO: use unsorted container?
+ map<string,string> _rules; // TODO: use unsorted container?
int _numIterations;
- Model *_model; // The model for generation
+ Model *_model; // The active model
Turtle *_turtle; // The rendering turtle
};