Helios++
Helios software for LiDAR simulations
KDTreeNode.h
1 #pragma once
2 
3 #include <LightKDTreeNode.h>
4 
5 
9 class KDTreeNode : public LightKDTreeNode{
10 private:
11  // *** SERIALIZATION *** //
12  // *********************** //
13  friend class boost::serialization::access;
20  template<class Archive>
21  void serialize(Archive & ar, const unsigned int version) {
22  /*
23  * Code below is commented because it is no longer needed as it is now
24  * done in LightKDTreeNode. However, in case problems arise or
25  * KDTreeNode should become the basis for KDTree node implementation,
26  * it must be uncommented or serialization will not work
27  */
28  // Register classes derived from Primitive
29  /*ar.template register_type<Vertex>();
30  ar.template register_type<AABB>();
31  ar.template register_type<Triangle>();
32  ar.template register_type<Voxel>();
33  ar.template register_type<DetailedVoxel>();*/
34 
35  // Serialization itself
36  boost::serialization::void_cast_register<
38  >();
39  ar & boost::serialization::base_object<LightKDTreeNode>(*this);
40  ar & bound;
41  ar & surfaceArea;
42  }
43 
44 public:
45  // *** ATTRIBUTES *** //
46  // ******************** //
54  double surfaceArea = std::numeric_limits<double>::quiet_NaN();
55 
56  // *** CONSTRUCTION / DESTRUCTION *** //
57  // ************************************ //
61  KDTreeNode() {};
66  KDTreeNode(KDTreeNode const &kdtn);
71  KDTreeNode(KDTreeNode &&kdtn);
75  virtual ~KDTreeNode() = default;
76 
77  // *** ASSIGNMENT OPERATORS *** //
78  // ****************************** //
84  KDTreeNode& operator=(KDTreeNode const &kdtn);
91 
92  // *** S W A P *** //
93  // ******************* //
98  void swap(KDTreeNode &kdtn);
99 
100  // *** OBJECT METHODS *** //
101  // ************************ //
106  void writeObject(std::string path);
112  static KDTreeNode* readObject(std::string path);
113 };
Class representing an Axis Aligned Bounding Box (AABB)
Definition: AABB.h:10
Class representing a KDTree node.
Definition: KDTreeNode.h:9
virtual ~KDTreeNode()=default
Destructor for KDTreeNode.
void serialize(Archive &ar, const unsigned int version)
Serialize a KDTreeNode to a stream of bytes.
Definition: KDTreeNode.h:21
static KDTreeNode * readObject(std::string path)
Import a serialized KDTree from file.
Definition: KDTreeNode.cpp:54
KDTreeNode()
Default constructor for KDTreeNode.
Definition: KDTreeNode.h:61
KDTreeNode & operator=(KDTreeNode const &kdtn)
Copy assignment operator for KDTreeNode.
Definition: KDTreeNode.cpp:25
void writeObject(std::string path)
Serialize KDTree.
Definition: KDTreeNode.cpp:47
AABB bound
The axis-aligned boundary of the node.
Definition: KDTreeNode.h:50
void swap(KDTreeNode &kdtn)
Swap attributes of given KDTreeNode and current KDTreeNode.
Definition: KDTreeNode.cpp:39
double surfaceArea
The summation of areas for all faces at node boundaries.
Definition: KDTreeNode.h:54
Class representing a light KDTree node. It is, the basic representation of a KDTree node with uses le...
Definition: LightKDTreeNode.h:28