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