VoxelBlur
Depth-of-field volume rendering
|
Describes a equilateral cube, centered on the origin. More...
#include <geometry.h>
Public Types | |
enum | Corner { MinMinMin = 0, MaxMinMin, MinMaxMin, MaxMaxMin, MinMinMax, MaxMinMax, MinMaxMax, MaxMaxMax, COUNT } |
Defines the 8 corner points of the cube, in XYZ format. More... | |
Public Member Functions | |
Cube (float sideLength=1.0f) | |
Creates a cube with the specified side length. More... | |
const QVector3D *const | getVertices () const |
Returns the 8 vertices of the cube. More... | |
QVector< QVector4D > | transform (const QMatrix4x4 &mat) const |
Multiplies the vertices with the given matrix and returns the result. More... | |
QVector< QVector4D > | transform (const QMatrix4x4 &mat, QVector4D &minPos, QVector4D &maxPos) const |
Multiplies the vertices with the given matrix and returns the result. More... | |
QVector< QVector3D > | transform3D (const QMatrix4x4 &mat, QVector3D &minPos, QVector3D &maxPos) const |
Same as transform, but with the w components omitted. | |
Static Public Attributes | |
static const ushort | triangleIndices [36] |
6 * 2 * 3 = 36 indices for a triangle representation of the cube, vertices ordered CCW. More... | |
static const ushort | triangleCount = 12 |
Number of triangles in triangleIndices (=12) | |
static const ushort | quadIndices [24] |
6 * 4 = 24 indices for a quad representation of the cube (faces), vertices ordered CCW. More... | |
static const ushort | quadCount = 6 |
Number of quads in quadIndices (=6) | |
static const ushort | lineIndices [24] |
12 * 2 = 24 indices for a line representation of the cube (edges) More... | |
static const ushort | lineCount =12 |
Number of lines in lineIndices (=12) | |
Private Attributes | |
float | m_sidelength |
The side length of the cube. | |
QVector3D * | m_vertices |
The 8 vertices of the cube, in the order defined by Corner. | |
Describes a equilateral cube, centered on the origin.
Note that this is not a QObject. The constructor takes the side length of the cube
enum Cube::Corner |
Defines the 8 corner points of the cube, in XYZ format.
The vertices returned by this class are in exactly the order as specified in this array.
|
explicit |
Creates a cube with the specified side length.
The default side length is 1.0. The resulting vertices have coordinates equivalent to \( \pm \frac{sideLength}{2} \) on each axis.
sideLength | The side length of the cube. |
const QVector3D *const Cube::getVertices | ( | ) | const |
Returns the 8 vertices of the cube.
This array must not be modified.
QVector< QVector4D > Cube::transform | ( | const QMatrix4x4 & | mat | ) | const |
Multiplies the vertices with the given matrix and returns the result.
The returned values can be freely used.
The vectors with indices 0-7 are the transformed vertices corresponding to the original vertices with indices 0-7.
mat | The matrix to multiply with |
QVector
of size 8, can be used as required. QVector< QVector4D > Cube::transform | ( | const QMatrix4x4 & | mat, |
QVector4D & | minPos, | ||
QVector4D & | maxPos | ||
) | const |
Multiplies the vertices with the given matrix and returns the result.
The returned values can be freely used.
The vectors with indices 0-7 are the transformed vertices corresponding to the original vertices with indices 0-7. The other parameters contain the minmal and maximal values on each axis.
mat | The matrix to multiply with |
minPos | contains the minimal value of the transformed points in each axis |
maxPos | contains the maximal value of the transformed points in each axis |
QVector
of size 8, can be used as required.
|
static |
12 * 2 = 24 indices for a line representation of the cube (edges)
|
static |
6 * 4 = 24 indices for a quad representation of the cube (faces), vertices ordered CCW.
|
static |
6 * 2 * 3 = 36 indices for a triangle representation of the cube, vertices ordered CCW.