![]() |
Qt 6.x
The Qt SDK
|
Class representing 3D range or axis aligned bounding box. More...
#include <qssgbounds3_p.h>
Public Member Functions | |
Q_DECL_CONSTEXPR Q_ALWAYS_INLINE | QSSGBounds3 () |
Default constructor, using empty bounds. | |
Q_ALWAYS_INLINE | QSSGBounds3 (Qt::Initialization) |
Construct uninitialized. | |
Q_DECL_CONSTEXPR Q_ALWAYS_INLINE | QSSGBounds3 (const QVector3D &minimum, const QVector3D &maximum) |
Construct from two bounding points. | |
Q_ALWAYS_INLINE void | setEmpty () |
Sets empty to true. | |
Q_ALWAYS_INLINE void | setInfinite () |
Sets infinite bounds. | |
void | include (const QVector3D &v) |
expands the volume to include v | |
void | include (const QSSGBounds3 &b) |
expands the volume to include b. | |
Q_ALWAYS_INLINE bool | isEmpty () const |
Q_ALWAYS_INLINE bool | intersects (const QSSGBounds3 &b) const |
indicates whether the intersection of this and b is empty or not. | |
Q_ALWAYS_INLINE bool | intersects1D (const QSSGBounds3 &a, quint32 axis) const |
computes the 1D-intersection between two AABBs, on a given axis. | |
Q_ALWAYS_INLINE bool | contains (const QVector3D &v) const |
indicates if these bounds contain v. | |
Q_ALWAYS_INLINE bool | isInside (const QSSGBounds3 &box) const |
checks a box is inside another box. | |
Q_ALWAYS_INLINE QVector3D | center () const |
returns the center of this axis aligned box. | |
Q_ALWAYS_INLINE float | center (quint32 axis) const |
get component of the box's center along a given axis | |
Q_ALWAYS_INLINE float | extents (quint32 axis) const |
get component of the box's extents along a given axis | |
Q_ALWAYS_INLINE QVector3D | dimensions () const |
returns the dimensions (width/height/depth) of this axis aligned box. | |
Q_ALWAYS_INLINE QVector3D | extents () const |
returns the extents, which are half of the width/height/depth. | |
Q_ALWAYS_INLINE void | scale (float scale) |
scales the AABB. | |
Q_ALWAYS_INLINE void | fatten (double distance) |
bool | isFinite () const |
Q_ALWAYS_INLINE QSSGBoxPoints | toQSSGBoxPointsNoEmptyCheck () const |
Q_ALWAYS_INLINE QSSGBoxPoints | toQSSGBoxPoints () const |
void | transform (const QMatrix4x4 &inMatrix) |
QVector3D | getSupport (const QVector3D &direction) const |
Static Public Member Functions | |
static Q_ALWAYS_INLINE QSSGBounds3 | boundsOfPoints (const QVector3D &v0, const QVector3D &v1) |
returns the AABB containing v0 and v1. | |
static Q_ALWAYS_INLINE QSSGBounds3 | centerExtents (const QVector3D ¢er, const QVector3D &extent) |
returns the AABB from center and extents vectors. | |
static Q_ALWAYS_INLINE QSSGBounds3 | basisExtent (const QVector3D ¢er, const QMatrix3x3 &basis, const QVector3D &extent) |
Construct from center, extent, and (not necessarily orthogonal) basis. | |
static QSSGBounds3 | transform (const QMatrix3x3 &matrix, const QSSGBounds3 &bounds) |
gets the transformed bounds of the passed AABB (resulting in a bigger AABB). | |
Public Attributes | |
QVector3D | minimum |
QVector3D | maximum |
Class representing 3D range or axis aligned bounding box.
Stored as minimum and maximum extent corners. Alternate representation would be center and dimensions. May be empty or nonempty. If not empty, minimum <= maximum has to hold.
Definition at line 40 of file qssgbounds3_p.h.
Q_DECL_CONSTEXPR Q_ALWAYS_INLINE QSSGBounds3::QSSGBounds3 | ( | ) |
Default constructor, using empty bounds.
Definition at line 195 of file qssgbounds3_p.h.
Referenced by basisExtent(), boundsOfPoints(), and centerExtents().
Q_ALWAYS_INLINE QSSGBounds3::QSSGBounds3 | ( | Qt::Initialization | ) |
Construct uninitialized.
Definition at line 201 of file qssgbounds3_p.h.
Q_DECL_CONSTEXPR Q_ALWAYS_INLINE QSSGBounds3::QSSGBounds3 | ( | const QVector3D & | minimum, |
const QVector3D & | maximum | ||
) |
Construct from two bounding points.
Definition at line 204 of file qssgbounds3_p.h.
|
static |
Construct from center, extent, and (not necessarily orthogonal) basis.
Definition at line 32 of file qssgbounds3.cpp.
References QSSGBounds3(), c2, center(), qAbs(), QVector3D::x(), QVector3D::y(), and QVector3D::z().
Referenced by transform().
|
static |
returns the AABB containing v0 and v1.
v0 | first point included in the AABB. |
v1 | second point included in the AABB. |
Definition at line 27 of file qssgbounds3.cpp.
References QSSGBounds3(), vec3::maximum(), and vec3::minimum().
Q_ALWAYS_INLINE QVector3D QSSGBounds3::center | ( | ) | const |
returns the center of this axis aligned box.
Definition at line 274 of file qssgbounds3_p.h.
References isFinite(), maximum, minimum, and Q_ASSERT.
Referenced by basisExtent(), centerExtents(), getSupport(), QSSGLayerRenderData::prepareModelsForRender(), QSSGLayerRenderData::prepareParticlesForRender(), QSSGLayerRenderData::prepareReflectionProbesForRender(), scale(), and transform().
Q_ALWAYS_INLINE float QSSGBounds3::center | ( | quint32 | axis | ) | const |
get component of the box's center along a given axis
Definition at line 280 of file qssgbounds3_p.h.
References isFinite(), maximum, minimum, and Q_ASSERT.
|
static |
returns the AABB from center and extents vectors.
center | Center vector |
extent | Extents vector |
Definition at line 209 of file qssgbounds3_p.h.
References QSSGBounds3(), and center().
Referenced by QSSGLayerRenderData::prepareReflectionProbesForRender(), and scale().
Q_ALWAYS_INLINE bool QSSGBounds3::contains | ( | const QVector3D & | v | ) | const |
indicates if these bounds contain v.
v | Point to test against bounds. |
Definition at line 248 of file qssgbounds3_p.h.
References isFinite(), maximum, minimum, Q_ASSERT, QVector3D::x(), QVector3D::y(), and QVector3D::z().
Q_ALWAYS_INLINE QVector3D QSSGBounds3::dimensions | ( | ) | const |
returns the dimensions (width/height/depth) of this axis aligned box.
Definition at line 292 of file qssgbounds3_p.h.
References isFinite(), maximum, minimum, and Q_ASSERT.
Referenced by extents(), and setupCameraForShadowMap().
Q_ALWAYS_INLINE QVector3D QSSGBounds3::extents | ( | ) | const |
returns the extents, which are half of the width/height/depth.
Definition at line 298 of file qssgbounds3_p.h.
References dimensions(), isFinite(), and Q_ASSERT.
Referenced by getSupport(), and scale().
Q_ALWAYS_INLINE float QSSGBounds3::extents | ( | quint32 | axis | ) | const |
get component of the box's extents along a given axis
Definition at line 286 of file qssgbounds3_p.h.
References isFinite(), maximum, minimum, and Q_ASSERT.
Referenced by setupCameraForShadowMap(), and transform().
Q_ALWAYS_INLINE void QSSGBounds3::fatten | ( | double | distance | ) |
fattens the AABB in all 3 dimensions by the given distance.
Definition at line 310 of file qssgbounds3_p.h.
References isFinite(), maximum, minimum, and Q_ASSERT.
Returns the support point in a given direction
Definition at line 66 of file qssgbounds3.cpp.
References center(), direction, extents(), QVector3D::x(), QVector3D::y(), and QVector3D::z().
Referenced by QSSGLayerRenderData::prepareModelsForRender().
void QSSGBounds3::include | ( | const QSSGBounds3 & | b | ) |
expands the volume to include b.
b | Bounds to perform union with. |
Definition at line 16 of file qssgbounds3.cpp.
References maximum, vec3::maximum(), minimum, and vec3::minimum().
QT_BEGIN_NAMESPACE void QSSGBounds3::include | ( | const QVector3D & | v | ) |
expands the volume to include v
v | Point to expand to. |
Definition at line 10 of file qssgbounds3.cpp.
References maximum, vec3::maximum(), minimum, and vec3::minimum().
Referenced by boxBoundsRecursive(), calculateShadowCameraBoundingBox(), RenderHelpers::calculateSortedObjectBounds(), QSSGRenderNode::getBounds(), QSSGRenderNode::getChildBounds(), QSSGBufferManager::getModelBounds(), QSSGRenderer::intersectRayWithSubsetRenderable(), and transform().
Q_ALWAYS_INLINE bool QSSGBounds3::intersects | ( | const QSSGBounds3 & | b | ) | const |
indicates whether the intersection of this and b is empty or not.
b | Bounds to test for intersection. |
Definition at line 235 of file qssgbounds3_p.h.
References isFinite(), maximum, minimum, Q_ASSERT, QVector3D::x(), QVector3D::y(), and QVector3D::z().
Referenced by QSSGLayerRenderData::prepareReflectionProbesForRender().
Q_ALWAYS_INLINE bool QSSGBounds3::intersects1D | ( | const QSSGBounds3 & | a, |
quint32 | axis | ||
) | const |
computes the 1D-intersection between two AABBs, on a given axis.
a | the other AABB |
axis | the axis (0, 1, 2) |
Definition at line 242 of file qssgbounds3_p.h.
References isFinite(), maximum, minimum, and Q_ASSERT.
Q_ALWAYS_INLINE bool QSSGBounds3::isEmpty | ( | ) | const |
Definition at line 228 of file qssgbounds3_p.h.
References isFinite(), maximum, minimum, Q_ASSERT, QVector3D::x(), QVector3D::y(), and QVector3D::z().
Referenced by boxBoundsRecursive(), QSSGRenderNode::getChildBounds(), QSSGRenderer::intersectRayWithSubsetRenderable(), toQSSGBoxPoints(), transform(), and transform().
bool QSSGBounds3::isFinite | ( | ) | const |
checks that the AABB values are not NaN
Definition at line 22 of file qssgbounds3.cpp.
References vec3::isFinite(), maximum, and minimum.
Referenced by center(), center(), contains(), dimensions(), extents(), extents(), fatten(), intersects(), intersects1D(), isEmpty(), isInside(), scale(), and setupCameraForShadowMap().
Q_ALWAYS_INLINE bool QSSGBounds3::isInside | ( | const QSSGBounds3 & | box | ) | const |
checks a box is inside another box.
box | the other AABB |
Definition at line 256 of file qssgbounds3_p.h.
References isFinite(), maximum, minimum, Q_ASSERT, QVector3D::x(), QVector3D::y(), and QVector3D::z().
Q_ALWAYS_INLINE void QSSGBounds3::scale | ( | float | scale | ) |
scales the AABB.
scale | Factor to scale AABB by. |
Definition at line 304 of file qssgbounds3_p.h.
References center(), centerExtents(), extents(), isFinite(), and Q_ASSERT.
Q_ALWAYS_INLINE void QSSGBounds3::setEmpty | ( | ) |
Sets empty to true.
Definition at line 214 of file qssgbounds3_p.h.
References maximum, and minimum.
Referenced by QSSGRenderGeometry::clear(), QSSGRenderGeometry::clearVertexAndIndex(), and transform().
Q_ALWAYS_INLINE void QSSGBounds3::setInfinite | ( | ) |
Sets infinite bounds.
Definition at line 221 of file qssgbounds3_p.h.
Q_ALWAYS_INLINE QSSGBoxPoints QSSGBounds3::toQSSGBoxPoints | ( | ) | const |
Verifies that the bounds is non-empty.
Definition at line 332 of file qssgbounds3_p.h.
References isEmpty(), and toQSSGBoxPointsNoEmptyCheck().
Q_ALWAYS_INLINE QSSGBoxPoints QSSGBounds3::toQSSGBoxPointsNoEmptyCheck | ( | ) | const |
Use when the bounds is already verified to be non-empty!!!
Definition at line 317 of file qssgbounds3_p.h.
References maximum, and minimum.
Referenced by RenderHelpers::calculateSortedObjectBounds(), toQSSGBoxPoints(), and transform().
|
static |
gets the transformed bounds of the passed AABB (resulting in a bigger AABB).
[in] | matrix | Transform to apply, can contain scaling as well |
[in] | bounds | The bounds to transform. |
Definition at line 49 of file qssgbounds3.cpp.
References basisExtent(), center(), extents(), isEmpty(), and mat33::transform().
Referenced by QSSGParticlesRenderable::QSSGParticlesRenderable(), QSSGSubsetRenderable::QSSGSubsetRenderable(), QSSGRenderNode::getChildBounds(), and QSSGLayerRenderData::prepareModelsForRender().
void QSSGBounds3::transform | ( | const QMatrix4x4 & | inMatrix | ) |
Definition at line 56 of file qssgbounds3.cpp.
References include(), isEmpty(), QMatrix4x4::map(), setEmpty(), and toQSSGBoxPointsNoEmptyCheck().
QVector3D QSSGBounds3::maximum |
Definition at line 192 of file qssgbounds3_p.h.
Referenced by QSSGRenderGeometry::boundsMax(), center(), center(), contains(), QSSGClipPlane::corner(), QSSGRenderRay::createIntersectionResult(), dimensions(), extents(), fatten(), QSSGMesh::Mesh::fromAssetData(), include(), include(), intersects(), intersects1D(), QSSGRenderRay::intersectWithAABBv2(), isEmpty(), isFinite(), isInside(), QSSGLayerRenderData::prepareReflectionProbesForRender(), QSSGRenderRay::relative(), setEmpty(), setInfinite(), toQSSGBoxPointsNoEmptyCheck(), and QQuick3DSceneManager::updateBoundingBoxes().
QVector3D QSSGBounds3::minimum |
Definition at line 191 of file qssgbounds3_p.h.
Referenced by QSSGRenderGeometry::boundsMin(), center(), center(), contains(), QSSGClipPlane::corner(), QSSGRenderRay::createIntersectionResult(), dimensions(), extents(), fatten(), QSSGMesh::Mesh::fromAssetData(), include(), include(), intersects(), intersects1D(), QSSGRenderRay::intersectWithAABBv2(), isEmpty(), isFinite(), isInside(), QSSGLayerRenderData::prepareReflectionProbesForRender(), QSSGRenderRay::relative(), setEmpty(), setInfinite(), toQSSGBoxPointsNoEmptyCheck(), and QQuick3DSceneManager::updateBoundingBoxes().