-
Notifications
You must be signed in to change notification settings - Fork 2
/
kdTreeNode.h
77 lines (51 loc) · 1.65 KB
/
kdTreeNode.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
/*
* File: kdTreeNode.h
* Author: Koray Gocmen
*
* Created on March 25, 2016, 1:30 PM
*/
#ifndef KDTREENODE_H
#define KDTREENODE_H
using namespace std;
class kdTreeNode {
public:
kdTreeNode();
kdTreeNode(float _x, float _y);
kdTreeNode(const kdTreeNode& orig);
virtual ~kdTreeNode();
kdTreeNode& operator=(const kdTreeNode &R);
float getX() const;
float getY() const;
bool getLevel() const;
bool getBeenHere() const;
kdTreeNode* getLeft() const;
kdTreeNode* getRight() const;
kdTreeNode* getParent() const;
void setX(float _x);
void setY(float _y);
void setLevel(bool _lev);
void setBeenHere(bool _here);
void setLeft(kdTreeNode* newLeft);
void setRight(kdTreeNode* newRight);
void setParent(kdTreeNode* newParent);
void printNodes();
void clearFlags();
void findPath(kdTreeNode *entry);
void removeNode(kdTreeNode* entry, kdTreeNode* root);
void insertNode(kdTreeNode* newNode, kdTreeNode* &root);
void distributeSubtree(kdTreeNode* entry, kdTreeNode* root);
void distributeTreeWithNewRoot(kdTreeNode* root, bool rootWasSet);
double findDistanceBetweenTwoPoints(kdTreeNode* node1, kdTreeNode* node2);
kdTreeNode* findNewRoot(kdTreeNode* root);
kdTreeNode* findClosestNode(kdTreeNode* entry);
kdTreeNode* closestNodeInPath(kdTreeNode* entry, kdTreeNode* root);
private:
float x;
float y;
bool level;
bool beenHere;
kdTreeNode* left;
kdTreeNode* right;
kdTreeNode* parent;
};
#endif /* KDTREENODE_H */