61 void setAxiom(
const std::string& axiom);
63 void addRule(
char symbol,
const std::string& production);
65 void addRules(
char symbol,
const std::vector<std::string>& productions,
const std::vector<float>&
weights);
72 void setStep(
float step);
76 void setSeed(uint32_t
seed);
78 void setInitialHeading(
float x,
float y,
float z);
80 void setBranchRadius(
float radius);
82 void setBranchRadiusFalloff(
float factor);
84 void setLeafSize(
float size);
86 void setLeafSymbols(
const std::string& symbols);
88 void setTropism(
float x,
float y,
float z);
91 uint32_t getSeed()
const;
93 int getIterations()
const;
96 std::string derive()
const;
100 void toPointSet(
PointSet& out)
const;
104 float x = 0.f,
y = 0.f,
z = 0.f;
110 using Rule = std::pair<std::string, float>;
112 Vec3 rotate(
const Vec3&
v,
const Vec3& axis,
float angle)
const;
113 void orthonormalize(Vec3&
heading, Vec3&
up)
const;
117 std::vector<Rule> rules_[256];
118 float angleDeg_ = 25.f;
122 Vec3 heading0_ = {0.f, 1.f, 0.f};
123 float branchRadius_ = 0.1f;
124 float radiusFalloff_ = 0.6f;
125 float leafSize_ = 0.4f;
126 bool leafChars_[256] = {};
127 Vec3 tropism_ = {0.f, 0.f, 0.f};