-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathTreeGenerator.h
42 lines (31 loc) · 898 Bytes
/
TreeGenerator.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#pragma once
#include "TreeCrown.h"
#include "TreeBranch.h"
#include "TreeVector.h"
#include <vector>
#include <math.h>
namespace Tree {
class Generator
{
public:
Crown& crown;
private:
float MaxDistance;
float MinDistance;
float branchLength;
float MaxDistanceSQ;
float MinDistanceSQ;
public:
std::vector<Branch> branches;
std::vector<unsigned> trunks;
public:
Generator(Crown& crown, const float MaxDistance, const float MinDistance, const float branchLength);
~Generator();
unsigned int process();
void processAll(const unsigned& maxIter = 0); // 0 = infinity
void inline SetMaxDistance(float v) { MaxDistance = v; MaxDistanceSQ = v * v; }
void inline SetMinDistance(float v) { MinDistance = v; MinDistanceSQ = v * v; }
void inline SetBranchLength(float v) { branchLength = v; }
void add_trunk(const vec3f& base); //base is the start point
};
}