Helios++
Helios software for LiDAR simulations
SimpleKDTreeBuildChildrenNodesSubTask.h
1 #pragma once
2 
3 #include <SharedSubTask.h>
4 #include <SharedTaskSequencer.h>
5 
6 #include <functional>
7 
18 protected:
19  // *** ATTRIBUTES *** //
20  // ******************** //
29  vector<Primitive *> &primitives;
33  int const depth;
37  int const index;
41  std::function<void(LightKDTreeNode *&child, KDTreeNode *node)> setChild;
45  std::function<KDTreeNode *(
46  KDTreeNode *,
47  bool const,
48  vector<Primitive *> &,
49  int const,
50  int const
52 
53 public:
54  // *** CONSTRUCTION / DESTRUCTION *** //
55  // ************************************ //
60  std::shared_ptr<SharedTaskSequencer> ch,
62  vector<Primitive *> &primitives,
63  int const depth,
64  int const index,
65  std::function<void(LightKDTreeNode *&child, KDTreeNode *node)>setChild,
66  std::function<KDTreeNode *(
67  KDTreeNode *,
68  bool const,
69  vector<Primitive *> &,
70  int const,
71  int const
73  ) :
75  node(node),
77  depth(depth),
78  index(index),
81  {}
83 
84  // *** RUNNABLE SHARED TASK *** //
85  // ****************************** //
90  void run() override{
92  node, false, primitives, depth+1, 2*index+1
93  ));
94  }
95 };
Class representing a KDTree node.
Definition: KDTreeNode.h:9
Class representing a light KDTree node. It is, the basic representation of a KDTree node with uses le...
Definition: LightKDTreeNode.h:28
LightKDTreeNode * right
Definition: LightKDTreeNode.h:70
A shared task is said to be a collection of shared sub-tasks. Each shared sub-task can be computed in...
Definition: SharedSubTask.h:16
std::shared_ptr< SharedSubTaskCompletionHandler > ch
The shared sub-task completion handler that handles what must be done after a shared sub-task executi...
Definition: SharedSubTask.h:28
Shared sub-task to build children nodes when building a Simple KDTree on all geometry-level depths ex...
Definition: SimpleKDTreeBuildChildrenNodesSubTask.h:17
std::function< KDTreeNode *(KDTreeNode *, bool const, vector< Primitive * > &, int const, int const)> buildRecursive
Function to recursively build children nodes.
Definition: SimpleKDTreeBuildChildrenNodesSubTask.h:51
int const index
Index of current node at current depth.
Definition: SimpleKDTreeBuildChildrenNodesSubTask.h:37
std::function< void(LightKDTreeNode *&child, KDTreeNode *node)> setChild
Function to set child node.
Definition: SimpleKDTreeBuildChildrenNodesSubTask.h:41
SimpleKDTreeBuildChildrenNodesSubTask(std::shared_ptr< SharedTaskSequencer > ch, KDTreeNode *node, vector< Primitive * > &primitives, int const depth, int const index, std::function< void(LightKDTreeNode *&child, KDTreeNode *node)>setChild, std::function< KDTreeNode *(KDTreeNode *, bool const, vector< Primitive * > &, int const, int const)> buildRecursive)
Main constructor for Simple KDTree build children nodes sub-task.
Definition: SimpleKDTreeBuildChildrenNodesSubTask.h:59
void run() override
Implementation of the build children nodes method.
Definition: SimpleKDTreeBuildChildrenNodesSubTask.h:90
KDTreeNode * node
Node which children will be built if possible, otherwise it will be made a leaf node.
Definition: SimpleKDTreeBuildChildrenNodesSubTask.h:25
vector< Primitive * > & primitives
Primitives of the node itself.
Definition: SimpleKDTreeBuildChildrenNodesSubTask.h:29
int const depth
Depth of current node.
Definition: SimpleKDTreeBuildChildrenNodesSubTask.h:33