-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBox.h
55 lines (41 loc) · 839 Bytes
/
Box.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
#ifndef BOX_H
#define BOX_H
#include <vecmath.h>
#include<vector>
#include "HashNode.h"
#ifdef _WIN32
#include "GL/freeglut.h"
#else
#include <GL/glut.h>
#endif
using namespace std;
/*
Box implementation
This is the hollow square box.
@params
float side: length of side
Vector3f c: Center of the box
Vector3f up: Upward direction of the box
bool top: True for closed box, False for box with open top
*/
class Box
{
public:
//Default Constructor
Box();
//Constructor
Box(float side, Vector3f c, Vector3f up, bool covered);
float getSide() {return m_side;}
void draw();
void cal();
bool collide(Vector3f &position);
void getPoints(float x[]);
protected:
vector<Vector3f> m_points;
float m_side;
Vector3f m_c;
Vector3f m_up;
bool m_covered;
void drawQuad(Vector3f a, Vector3f b, Vector3f c, Vector3f d);
};
#endif