*** empty log message ***
[lsystem3d.git] / src / lindenmayersystem.h
index efadab9a31aa785c94ae1350faec03008159feec..d71fde6b6530225b9fb471a26a40768ffbe400ad 100644 (file)
@@ -28,8 +28,6 @@
 #include "model.h"
 #include "turtle.h"
 
-using namespace std;
-
 
 
 /**
@@ -38,9 +36,10 @@ using namespace std;
 class LindenmayerSystem
 {
 public:
+    
     /**
      * Constructor
-     * @param model the model for generation
+     * @param model empty model
      */
     LindenmayerSystem(Model *model);
 
@@ -49,6 +48,16 @@ public:
      */
     ~LindenmayerSystem();
     
+    /**
+     * Clear all parameters
+     */
+    void clear();
+    
+     /**
+     * Generate L-system data
+     */
+    void generate();
+    
     /**
      * Set the initial rule (the axiom)
      * @param axiom the axiom
@@ -74,6 +83,18 @@ public:
      */
     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
@@ -99,39 +120,40 @@ public:
     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
 };