4 #include <QtCore\qmath.h> 5 #include <QtGui\qopenglshaderprogram.h> 19 Edge(QVector3D*
a, QVector3D*
b) : a(a), b(b) {};
29 Cube(QVector3D sizes) : sizes(sizes){
34 points.push_back(QVector3D(sizes.x() / 2.0f, sizes.y() / 2.0f, sizes.z() / 2.0f));
35 points.push_back(QVector3D(-sizes.x() / 2.0f, sizes.y() / 2.0f, sizes.z() / 2.0f));
36 points.push_back(QVector3D(sizes.x() / 2.0f, -sizes.y() / 2.0f, sizes.z() / 2.0f));
37 points.push_back(QVector3D(sizes.x() / 2.0f, sizes.y() / 2.0f, -sizes.z() / 2.0f));
38 points.push_back(QVector3D(-sizes.x() / 2.0f, sizes.y() / 2.0f, -sizes.z() / 2.0f));
39 points.push_back(QVector3D(-sizes.x() / 2.0f, -sizes.y() / 2.0f, sizes.z() / 2.0f));
40 points.push_back(QVector3D(sizes.x() / 2.0f, -sizes.y() / 2.0f, -sizes.z() / 2.0f));
41 points.push_back(QVector3D(-sizes.x() / 2.0f, -sizes.y() / 2.0f, -sizes.z() / 2.0f));
46 edges.push_back(
Edge(&points[7], &points[4]));
47 edges.push_back(
Edge(&points[4], &points[1]));
48 edges.push_back(
Edge(&points[1], &points[0]));
50 edges.push_back(
Edge(&points[1], &points[5]));
52 edges.push_back(
Edge(&points[7], &points[5]));
53 edges.push_back(
Edge(&points[5], &points[2]));
54 edges.push_back(
Edge(&points[2], &points[0]));
56 edges.push_back(
Edge(&points[6], &points[2]));
58 edges.push_back(
Edge(&points[7], &points[6]));
59 edges.push_back(
Edge(&points[6], &points[3]));
60 edges.push_back(
Edge(&points[3], &points[0]));
62 edges.push_back(
Edge(&points[3], &points[4]));
66 edgeOrder[0] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 };
67 edgeOrder[1] = { 1, 11, 9, 0, 3, 4, 8, 5, 2, 6, 7, 10 };
68 edgeOrder[2] = { 7, 8, 0, 9, 6, 10, 11, 2, 5, 3, 1, 4 };
69 edgeOrder[3] = { 10, 2, 3, 6, 9, 7, 5, 8, 11, 0, 4, 1 };
70 edgeOrder[4] = { 11, 10, 6, 9, 0, 8, 7, 4, 1, 3, 5, 2 };
71 edgeOrder[5] = { 5, 7, 9, 6, 3, 2, 10, 1, 4, 0, 11, 8 };
72 edgeOrder[6] = { 7, 6, 2, 5, 8, 4, 3, 0, 9, 11, 1, 10 };
73 edgeOrder[7] = { 4, 5, 6, 3, 0, 1, 2, 11, 8, 9, 10, 7 };
101 for (
unsigned int i = 0; i < points.size(); i++) {
102 points[i] = matrix * origPoints[i];
114 std::vector<QVector3D>
calcPolygon(QVector4D normal,
Cube& cube,
int index);
122 bool inside(QVector3D vertex, QVector4D normal);
131 bool cross(QVector3D
a, QVector3D
b, QVector4D normal);
141 QVector3D
intersect(QVector3D a, QVector3D b, QVector4D normal);
150 QVector3D
interpolate(QVector3D a, QVector3D b,
float t);
164 void updateProxyGeometry(QMatrix4x4 modelMatrix,
int samples);
170 std::vector < std::vector<QVector3D>>& getPlaneVertices();
177 std::vector < std::vector<QVector3D>>& getTexCoords();
183 float getSliceDistance();
187 std::vector<std::vector<QVector3D>> planeVertices;
190 std::vector<std::vector<QVector3D>> texCoords;
std::vector< Edge > edges
Definition: ProxyGeometry.h:77
Definition: ProxyGeometry.h:7
std::vector< std::vector< int > > edgeOrder
Definition: ProxyGeometry.h:91
std::vector< QVector3D > origPoints
Definition: ProxyGeometry.h:83
std::vector< QVector3D > points
Definition: ProxyGeometry.h:80
bool inside(QVector3D vertex, QVector4D normal)
Definition: ProxyGeometry.cpp:79
QVector3D * b
Definition: ProxyGeometry.h:21
Definition: ProxyGeometry.h:27
std::vector< QVector3D > calcPolygon(QVector4D normal, Cube &cube, int index)
Definition: ProxyGeometry.cpp:66
QVector3D sizes
Definition: ProxyGeometry.h:94
Cube()
Definition: ProxyGeometry.h:28
Definition: ProxyGeometry.h:154
bool cross(QVector3D a, QVector3D b, QVector4D normal)
Definition: ProxyGeometry.cpp:83
Definition: ProxyGeometry.h:11
Edge(QVector3D *a, QVector3D *b)
Definition: ProxyGeometry.h:19
void transform(QMatrix4x4 matrix)
Definition: ProxyGeometry.h:100
QVector3D interpolate(QVector3D a, QVector3D b, float t)
Definition: ProxyGeometry.cpp:109
QVector3D intersect(QVector3D a, QVector3D b, QVector4D normal)
Definition: ProxyGeometry.cpp:90
Edge()
Definition: ProxyGeometry.h:13
QVector3D * a
Definition: ProxyGeometry.h:19
Cube(QVector3D sizes)
Definition: ProxyGeometry.h:29