Helios++
Helios software for LiDAR simulations
FastSAHKDTreeFactory.h
1 #pragma once
2 
3 #include <SAHKDTreeFactory.h>
4 
47 private:
48  // *** SERIALIZATION *** //
49  // *********************** //
50  friend class boost::serialization::access;
59  template <typename Archive>
60  void serialize(Archive &ar, unsigned int const version){
61  boost::serialization::void_cast_register<
64  >();
65  ar &boost::serialization::base_object<SAHKDTreeFactory>(*this);
66  }
67 public:
68  // *** CONSTRUCTION / DESTRUCTION *** //
69  // ************************************ //
78  size_t const lossNodes=32,
79  double const ci=1,
80  double const cl=1,
81  double const co=1
82  );
83  virtual ~FastSAHKDTreeFactory () = default;
84 
85  // *** CLONE *** //
86  // *************** //
90  KDTreeFactory * clone() const override;
94  void _clone(KDTreeFactory *kdtf) const override;
95 
96  // *** SAH UTILS *** //
97  // ******************* //
106  double findSplitPositionBySAH(
107  KDTreeNode *node,
108  vector<Primitive *> &primitives
109  ) const override;
110 
128  virtual double findSplitPositionByFastSAHRecipe(
129  KDTreeNode *node,
130  vector<Primitive *> &primitives,
131  std::function<void(
132  vector<Primitive *> &primitives,
133  int const splitAxis,
134  double const minp,
135  double const deltap,
136  size_t const lossNodes,
137  size_t const lossCases,
138  vector<size_t> &cForward,
139  vector<size_t> &cBackward
140  )> f_recount
141  ) const;
142 };
Class providing building methods for k-dimensional trees with a fast strategy to approximate Surface ...
Definition: FastSAHKDTreeFactory.h:42
void _clone(KDTreeFactory *kdtf) const override
Assign attributes from FastSAHKDTreeFactory to its clone.
Definition: FastSAHKDTreeFactory.cpp:23
double co
Cost-weight for testing an object for intersection.
Definition: SAHKDTreeFactory.h:181
virtual double findSplitPositionByFastSAHRecipe(KDTreeNode *node, vector< Primitive * > &primitives, std::function< void(vector< Primitive * > &primitives, int const splitAxis, double const minp, double const deltap, size_t const lossNodes, size_t const lossCases, vector< size_t > &cForward, vector< size_t > &cBackward)> f_recount) const
The recipe for finding split position by Fast-SAH algorithm. It is meant to be used by the FastSAHKDT...
Definition: FastSAHKDTreeFactory.cpp:77
void serialize(Archive &ar, unsigned int const version)
Serialize a fast surface area heuristic KDTree factory to a stream of bytes.
Definition: FastSAHKDTreeFactory.h:60
double ci
Cost-weight for traversing interior nodes.
Definition: SAHKDTreeFactory.h:171
size_t lossNodes
How many loss nodes must be computed when optimizing the loss function to determine the best split p...
Definition: SAHKDTreeFactory.h:166
KDTreeFactory * clone() const override
Definition: FastSAHKDTreeFactory.cpp:15
FastSAHKDTreeFactory(size_t const lossNodes=32, double const ci=1, double const cl=1, double const co=1)
Fast surface area heuristic KDTree factory default constructor.
Definition: FastSAHKDTreeFactory.cpp:5
double findSplitPositionBySAH(KDTreeNode *node, vector< Primitive * > &primitives) const override
Find the best split position using an min-max like approximation for the loss function of Surface Are...
Definition: FastSAHKDTreeFactory.cpp:29
double cl
Cost-weight for traversing leaf nodes.
Definition: SAHKDTreeFactory.h:176
Class that must be extended by any class which provides factory methods for k-dimensional trees....
Definition: KDTreeFactory.h:22
Class representing a KDTree node.
Definition: KDTreeNode.h:9
Class providing building methods for k-dimensional trees with surface area heuristic (SAH)
Definition: SAHKDTreeFactory.h:126
double co
Cost-weight for testing an object for intersection.
Definition: SAHKDTreeFactory.h:181
double ci
Cost-weight for traversing interior nodes.
Definition: SAHKDTreeFactory.h:171
size_t lossNodes
How many loss nodes must be computed when optimizing the loss function to determine the best split p...
Definition: SAHKDTreeFactory.h:166
double cl
Cost-weight for traversing leaf nodes.
Definition: SAHKDTreeFactory.h:176