VoxelBlur
Depth-of-field volume rendering
 All Classes Files Functions Variables Enumerations Enumerator
geometry.h
Go to the documentation of this file.
1 #ifndef GEOMETRY_H
2 #define GEOMETRY_H
3 
4 #include <QtGui\qmatrix4x4.h>
5 
15 class Cube final
16 {
17 public:
22  enum Corner
23  {
24  MinMinMin = 0,
25  MaxMinMin,
26  MinMaxMin,
27  MaxMaxMin,
28  MinMinMax,
29  MaxMinMax,
30  MinMaxMax,
31  MaxMaxMax,
32  COUNT // = 8
33  };
34 
42  explicit Cube(float sideLength = 1.0f);
43  ~Cube();
44 
49  const QVector3D * const getVertices() const;
50 
54  static const ushort triangleIndices[36];
58  static const ushort triangleCount = 12;
59 
63  static const ushort quadIndices[24];
67  static const ushort quadCount = 6;
68 
72  static const ushort lineIndices[24];
76  static const ushort lineCount=12;
77 
78 
87  QVector<QVector4D> transform(const QMatrix4x4& mat) const;
88 
100  QVector<QVector4D> transform(const QMatrix4x4& mat,QVector4D& minPos,QVector4D& maxPos) const;
101 
105  QVector<QVector3D> transform3D(const QMatrix4x4& mat,QVector3D& minPos,QVector3D& maxPos) const;
106 
107 private:
115  QVector3D* m_vertices;
116  //const unsigned short triIndices[],lineIndices[];
117 };
118 
119 
135 bool LineIntersectPlane(const QVector3D& lineStart, const QVector3D& lineVec, const QVector3D& planePoint,const QVector3D& planeNormal, float& d);
136 
137 
138 #endif
const QVector3D *const getVertices() const
Returns the 8 vertices of the cube.
Definition: geometry.cpp:52
QVector< QVector4D > transform(const QMatrix4x4 &mat) const
Multiplies the vertices with the given matrix and returns the result.
Definition: geometry.cpp:57
static const ushort triangleIndices[36]
6 * 2 * 3 = 36 indices for a triangle representation of the cube, vertices ordered CCW...
Definition: geometry.h:54
QVector3D * m_vertices
The 8 vertices of the cube, in the order defined by Corner.
Definition: geometry.h:115
static const ushort lineIndices[24]
12 * 2 = 24 indices for a line representation of the cube (edges)
Definition: geometry.h:72
Corner
Defines the 8 corner points of the cube, in XYZ format.
Definition: geometry.h:22
Describes a equilateral cube, centered on the origin.
Definition: geometry.h:15
static const ushort quadIndices[24]
6 * 4 = 24 indices for a quad representation of the cube (faces), vertices ordered CCW...
Definition: geometry.h:63
static const ushort triangleCount
Number of triangles in triangleIndices (=12)
Definition: geometry.h:58
static const ushort quadCount
Number of quads in quadIndices (=6)
Definition: geometry.h:67
Cube(float sideLength=1.0f)
Creates a cube with the specified side length.
Definition: geometry.cpp:32
float m_sidelength
The side length of the cube.
Definition: geometry.h:111
static const ushort lineCount
Number of lines in lineIndices (=12)
Definition: geometry.h:76
QVector< QVector3D > transform3D(const QMatrix4x4 &mat, QVector3D &minPos, QVector3D &maxPos) const
Same as transform, but with the w components omitted.
Definition: geometry.cpp:100