CKDTree.h
Go to the documentation of this file.
1 
2 #pragma once
3 
4 #include <ionMath.h>
5 
6 
7 namespace ion
8 {
9 
11  {
12  int const K;
13  vec3f const Goal;
14 
15  std::vector<std::pair<vec3f, float> > Set;
16 
17  CKDTreeNeighborSet(int const k, vec3f const & goal);
18 
19  void ConsiderPoint(vec3f const & Point);
20  float GetWorstDistance() const;
21  bool Filled() const;
22  };
23 
25  {
26 
27  public:
28 
29  CKDTreeNode * LeftSide = nullptr;
30  CKDTreeNode * RightSide = nullptr;
31 
32  int SplitAxis = -1;
34 
35  void Split(vec3f * Elements, int const Count, int const Axis);
36  vec3f NearestNeighbor(vec3f const & Point) const;
37  void NearestKNeighbors(CKDTreeNeighborSet & Set) const;
38 
39  };
40 
41  class CKDTree
42  {
43 
44  public:
45 
46  void Build(vec3f * Elements, int const Count);
47  vec3f NearestNeighbor(vec3f const & Point) const;
48  CKDTreeNeighborSet NearestKNeighbors(vec3f const & Point, int const K) const;
49 
50  CKDTreeNode * Root = nullptr;
51 
52  };
53 
54 }
vec3f Position
Definition: CKDTree.h:33
void ConsiderPoint(vec3f const &Point)
Definition: CKDTree.cpp:19
int const K
Definition: CKDTree.h:12
CKDTreeNeighborSet(int const k, vec3f const &goal)
Definition: CKDTree.cpp:15
std::vector< std::pair< vec3f, float > > Set
Definition: CKDTree.h:15
Definition: CKDTree.h:41
Definition: CKDTree.h:10
vec3f const Goal
Definition: CKDTree.h:13
Definition: CKDTree.h:24
Definition: CCatmullRomAdvancedSplineInterpolator.h:7
float GetWorstDistance() const
Definition: CKDTree.cpp:44
bool Filled() const
Definition: CKDTree.cpp:49