-
Notifications
You must be signed in to change notification settings - Fork 0
/
OCtree.h
108 lines (72 loc) · 1.78 KB
/
OCtree.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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
#ifndef OCTREE_H_INCLUDED
#define OCTREE_H_INCLUDED
//
#include <windows.h>
#include <GL\glut.h>
#include <iostream>
#include <vector>
#include <fstream>
#define MINBOUND 0.01
#define MINNUMBER 5
using namespace std;
typedef struct OCtreePoint {
float x, y, z;
bool isIndex;
//double n;
//unsigned int code;
OCtreePoint() {
isIndex = false;
}
} OCPoint;
typedef struct Bound {
OCPoint center;
float radius; //边长为多少??
} Bounds;
//时空的权衡
typedef struct OCTreeNode {
//OCPoint *points;
OCTreeNode *childNode[8];
int number;
// int level;
Bounds bounds;
bool leaf;
// 存储区间的点云
vector<OCtreePoint> element;
OCTreeNode() {
leaf = false;
number = 0;
}
} OCNode;
class OCTree {
private :
GLuint OCtreeList;
vector<OCPoint> OctreePointSet;
int pointSetSize;
OCNode *root;
vector<Bound> boundSet;
// Bounds bound;
int RootPointId;
void createCubicList();
void drawCubic();
void Cubic(Bounds bounds);
void readPoint();
void countSpaceNumber(int number[], Bounds centerBounds);
void transerver(OCNode *node);
int coutingACubicNumber(Bounds centerBounds);
void fileLeafCubic(Bound bound, OCTreeNode *leafNode);
void doSearchPoint();
void translateTreeCenter();
void findTreeCenter();
int findStartPoint();
public :
OCTree();
~OCTree();
Bounds calCubicBounds(vector<OCPoint> point, int count);
void buildOCtree(OCNode *OCTreeNode);
void CallCubicList();
void CalSplitBounds(Bounds bound, Bounds afterSplit[]);
void OCtreeExecute();
float doSearchPoint(const char * fileName);
bool searchPointInOCtree(OCtreePoint OCPoint, OCTreeNode *branch);
};
#endif // OCTREE_H_INCLUDED