9 std::vector<uint> UUID_trunk_plant, UUID_branch_plant;
10 std::vector<std::vector<uint>> UUID_leaf_plant;
12 std::uniform_real_distribution<float> unif_distribution;
16 std::vector<float> rad_main;
17 std::vector<vec3> pos_main;
20 for (
int i = 0; i < 10; i++) {
22 pos_main.push_back(
make_vec3(0., 0., i * dz));
25 for (
uint i = 0; i < rad_main.size(); i++) {
26 pos_main.at(i) = pos_main.at(i) + origin;
35 for (
int i = 0; i < Nlevels - 1; i++) {
37 float vfrac = float(Nlevels - i - 1) / float(Nlevels - 1);
51 for (
int j = 0; j < Nbranches; j++) {
53 float phi = float(j) / float(Nbranches) * 2.f *
PI_F * (1 +
getVariation(0.1f, generator));
55 float theta = -0.15 *
PI_F;
58 std::vector<float> rad_branch;
59 std::vector<vec3> pos_branch;
63 float r = rcrown +
getVariation(0.1f * rcrown, generator);
65 pos_branch.push_back(origin +
make_vec3(0, 0, z));
66 pos_branch.push_back(origin +
make_vec3(r * sinf(phi) * cosf(theta), r * cosf(phi) * cosf(theta), z + r * sinf(theta)));
76 UUID_branch_plant.insert(UUID_branch_plant.end(), U.begin(), U.end());
78 for (
int k = 0; k < 2 * Nbranches; k++) {
80 float bfrac = float(k + 1) / float(2 * Nbranches);
85 std::vector<float> rad_subbranch;
86 std::vector<vec3> pos_subbranch;
91 pos_subbranch.push_back(base);
93 float l = fmax(0.1, 0.6 * rcrown);
96 float bangle = 0.2 *
PI_F;
102 pos_subbranch.push_back(base + bdir);
104 rad_subbranch.push_back(rbase);
105 rad_subbranch.push_back(0.1 * rbase);
111 int Nneedles = round(50 * l / (0.4 * params.
crown_radius));
112 for (
int n = 0; n < Nneedles; n++) {
114 float nfrac = float(n + 1) / float(Nneedles);
120 vec3 norm = nbase - nbase_p;
127 float downangle = 0.2 *
PI_F;
138 UUID_trunk.push_back(UUID_trunk_plant);
139 UUID_branch.push_back(UUID_branch_plant);
140 UUID_leaf.push_back(UUID_leaf_plant);
141 std::vector<std::vector<std::vector<uint>>> UUID_fruit_plant;
142 UUID_fruit.push_back(UUID_fruit_plant);
144 return UUID_leaf.size() - 1;