This repository was archived by the owner on Jun 27, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCuboid.hpp
More file actions
61 lines (54 loc) · 1.67 KB
/
Cuboid.hpp
File metadata and controls
61 lines (54 loc) · 1.67 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
#ifndef MY_CUBOID
#define MY_CUBOID
#define GLM_FORCE_RADIANS
#include "Util.hpp"
#include <GL/glew.h>
#include <GL/glut.h>
#include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include <glm/gtx/rotate_vector.hpp>
#include <glm/gtc/quaternion.hpp>
#include <glm/gtx/quaternion.hpp>
#include <string>
#include <iostream>
#include <sstream>
#include <math.h>
#include "State.hpp"
// USING RADIANS
class Cuboid {
private:
State state_;
State lastState_;
const v3 scale_;
fv points_; // 108 floats
vv3 actualPoints_; // 24 vertices
vv3 vertices_; // 8 vertices unique
vv3 edges_; // 24 edges, between vertices
vv3 uniqEdges_; // 3 edges
vv3 static calcEdges(const vv3& v);
v3 half_xyz_;
float furthestVertex_;
float calcFurthestVertex();
public:
State rotateRads(const v3& ypr);
State translate(v3 by);
void state(State& s);
State state();
void lastState(State& s);
State lastState();
float furthestVertex();
Cuboid(fv points, v3 topCenter, v3 scale, v3 translationMultiplier, v3 rotationMultiplier);
v3 translationMultiplier; // movement multiplier
v3 rotationMultiplier; // rotation multiplier
const v3 scale() const;
v3 half_xyz();
vv3* actualPoints();
const vv3* uniqueVertices(); // 8
vv3 getUniqueEdges(); // sign insensitive unique edges
void recalcEdges();
vv3 getVertices();
const fv* points();
bool static colliding(const Cuboid& c1, const Cuboid& c2);
friend std::ostream& operator<<(std::ostream&, const Cuboid&);
};
#endif