Tree template class
The Tree
template class is used to represent a tree in the 3D environment. It contains the necessary attributes to describe a tree, such as its id, latitude, longitude, genus, species, height, circumference, and diameter of the crown. It also contains the meshes of the tree (trunk and foliage) and methods to compute the x and y coordinates of the tree from the known latitude and longitude, as well as to generate the mesh of the tree.
template <typename Mesh_type, typename Kernel_type> class Tree {
using K = Kernel_type;
using Point = typename K::Point_3;
using Vector = typename K::Vector_3;
using Mesh = Mesh_type;
using Plane = typename K::Plane_3;
private:
long M_id; ///< Id of the tree
double M_lat, M_lon, M_x, M_y; ///< Latitude, Longitude, x and y coordinates
double M_height, M_altitude; ///< Height and altitude of the tree
double M_circumference, M_diameter_crown;
std::string M_genus, M_species, M_season;
Mesh M_trunk, M_foliage; ///< Wrapped mesh of the tree
std::vector<Point> M_points_trunk, M_points_foliage;
std::vector<std::array<int, 3>> M_faces_trunk, M_faces_foliage;
void make_mesh();
public:
// Default constructor
Tree();
// Constructor that takes arguments
Tree(long id, double lat, double lon, std::string genus,
std::string species, double height, double circumference,
double diameter_crown);
// Getters
....
// Setters
....
// Methods
void computeXY(double ref_lat, double ref_lon);
void mesh(int lod, std::string rep = environment()->dataDir().string());
};