-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUtilityClasses.h
More file actions
138 lines (112 loc) · 1.77 KB
/
UtilityClasses.h
File metadata and controls
138 lines (112 loc) · 1.77 KB
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
/*
* UtilityClasses.h
* 3d Ink
*
* Created by David Roberts on 23/07/2009.
* Durham University
*/
#include <vector>
#include <GLUT/glut.h>
using namespace std;
#if !defined(UtilityClasses_H)
#define UtilityClasses_H
/* Struct for storing colour information */
typedef struct Colour {
float red;
float green;
float blue;
};
/* A struct just to store point data, used in DataStructures */
typedef struct Point {
GLfloat x;
GLfloat y;
GLfloat z;
GLfloat pointSize;
// if this point marks the start of a new line
bool blankPoint;
Colour colour;
int pixelX;
int pixelY;
};
/* For use with the PR Quadtree */
class PRNode {
public:
Point p;
PRNode *NW, *NE, *SW, *SE;
// Stores a refernce to the parent of the node
PRNode *parent;
vector<Point*> zList;
bool isLeaf;
bool isValid;
PRNode() {
isValid = false;
}
PRNode(bool valid) {
isValid = valid;
}
PRNode(Point p) {
this->p = p;
}
~PRNode() {
}
};
class ONode {
public:
Point p;
// Near
ONode *N_NW, *N_NE, *N_SW, *N_SE;
// Far
ONode *F_NW, *F_NE, *F_SW, *F_SE;
// Stores a refernce to the parent of the node
ONode *parent;
bool isLeaf;
bool isValid;
ONode() {
isValid = false;
}
ONode(bool valid) {
isValid = valid;
}
ONode(Point p) {
this->p = p;
}
~ONode() {
}
};
/* Node struct for Quadtree */
typedef struct Node {
GLfloat x;
GLfloat y;
GLfloat z;
GLfloat pointSize;
Colour colour;
int type;
Node *NW;
Node *NE;
Node *SW;
Node *SE;
};
typedef struct Co {
GLfloat x;
GLfloat y;
};
typedef struct Co3D {
GLfloat x;
GLfloat y;
GLfloat z;
};
typedef struct Area {
Co tL;
Co bR;
};
typedef struct Area3D {
Co3D topLeftForward;
Co3D bottomRightBackward;
};
/* Uses when making shapes */
enum Shape {
Rectangle,
Circle,
Undefined
};
#endif