-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathoctree.hpp
51 lines (45 loc) · 967 Bytes
/
octree.hpp
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
#ifndef OCTREE_H
#define OCTREE_H
#include "network.h"
#define MAXOBJECTSPERNODE 8
#define MAXOCTREEDEPTH 10
#define MINBOXSIZE 0.1
typedef Point Vector
class Octree{
private:
Vector m_ABC[3];
Vector m_Normals_ABC[6];
Node* pm_Head;
public:
//Constructors
Octree();
//Destructors
~Octree();
void Print();
};
class Node{
private:
Node* p_Parent;
Node** pm_Children;
vector<Point>* pm_Objects;
Node** pm_Neighbors;
Point m_ABC;
double m_Length;
unsigned int m_Depth;
//Private Methods
void AddChildren();
void OctreeConstruct(vector<Point>& objects);
bool Threshold(vector<Point>& objects);
bool Subset(Sphere object);
bool Subset(Point object);
public:
//Constructors
Node();
//Destructors
~Node();
//Public Methods
void Print();
Node* GetOctant(Point abc); //Travels from Top to Bottom to find node
Node* GetNextNode(unsigned int planeHit, Point abc); //Returns pointer to next node
};
#endif OCTREE_H