X-Git-Url: https://git.piment-noir.org/?p=lsystem3d.git;a=blobdiff_plain;f=src%2Flindenmayersystem.h;h=d71fde6b6530225b9fb471a26a40768ffbe400ad;hp=efadab9a31aa785c94ae1350faec03008159feec;hb=526db67540bf69a4c09ed0d0f4d62bad0a37ee70;hpb=3025996ba17bf59f5bc64def5d55b95c4d732a8a diff --git a/src/lindenmayersystem.h b/src/lindenmayersystem.h index efadab9..d71fde6 100644 --- a/src/lindenmayersystem.h +++ b/src/lindenmayersystem.h @@ -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 _rules; // TODO: use unsorted container? + map _rules; // TODO: use unsorted container? int _numIterations; - Model *_model; // The model for generation + Model *_model; // The active model Turtle *_turtle; // The rendering turtle };