44
45
46 Q_DECL_CONSTEXPR Q_ALWAYS_INLINE QSSGBounds3();
49
50
51 Q_ALWAYS_INLINE QSSGBounds3(Qt::Initialization);
54
55
56 Q_DECL_CONSTEXPR Q_ALWAYS_INLINE QSSGBounds3(
const QVector3D &minimum,
const QVector3D &maximum);
59
60
61 Q_DECL_CONSTEXPR Q_ALWAYS_INLINE QSSGBounds3(
const QSSGBoxPoints &points);
64
65
66
67
68 static Q_ALWAYS_INLINE QSSGBounds3 boundsOfPoints(
const QVector3D &v0,
const QVector3D &v1);
71
72
73
74
75 static Q_ALWAYS_INLINE QSSGBounds3 centerExtents(
const QVector3D ¢er,
const QVector3D &extent);
78
79
80 static Q_ALWAYS_INLINE QSSGBounds3 basisExtent(
const QVector3D ¢er,
const QMatrix3x3 &basis,
const QVector3D &extent);
83
84
85
86
87 static QSSGBounds3 transform(
const QMatrix3x3 &matrix,
const QSSGBounds3 &bounds);
90
91
92 Q_ALWAYS_INLINE
void setEmpty();
95
96
97 Q_ALWAYS_INLINE
void setInfinite();
100
101
102
103 void include(
const QVector3D &v);
106
107
108
109 void include(
const QSSGBounds3 &b);
111 Q_ALWAYS_INLINE
bool isEmpty()
const;
114
115
116
117 Q_ALWAYS_INLINE
bool intersects(
const QSSGBounds3 &b)
const;
120
121
122
123
124 Q_ALWAYS_INLINE
bool intersects1D(
const QSSGBounds3 &a, quint32 axis)
const;
127
128
129
130 Q_ALWAYS_INLINE
bool contains(
const QVector3D &v)
const;
133
134
135
136 Q_ALWAYS_INLINE
bool isInside(
const QSSGBounds3 &box)
const;
139
140
141 Q_ALWAYS_INLINE QVector3D center()
const;
144
145
146 Q_ALWAYS_INLINE
float center(quint32 axis)
const;
149
150
151 Q_ALWAYS_INLINE
float extents(quint32 axis)
const;
154
155
156 Q_ALWAYS_INLINE QVector3D dimensions()
const;
159
160
161 Q_ALWAYS_INLINE QVector3D extents()
const;
164
165
166
167 Q_ALWAYS_INLINE
void scale(
float scale);
170
171
172 Q_ALWAYS_INLINE
void fatten(
double distance);
175
176
178 bool isFinite()
const;
181
182
183 Q_ALWAYS_INLINE QSSGBoxPoints toQSSGBoxPointsNoEmptyCheck()
const;
185
186
187 Q_ALWAYS_INLINE QSSGBoxPoints toQSSGBoxPoints()
const;
189 void transform(
const QMatrix4x4 &inMatrix);
192
193
194 QVector3D getSupport(
const QVector3D &direction)
const;
200Q_DECL_CONSTEXPR Q_ALWAYS_INLINE QSSGBounds3::QSSGBounds3()
201 : minimum(QVector3D(std::numeric_limits<
float>::max(), std::numeric_limits<
float>::max(), std::numeric_limits<
float>::max()))
202 , maximum(-std::numeric_limits<
float>::max(), -std::numeric_limits<
float>::max(), -std::numeric_limits<
float>::max())
214Q_DECL_CONSTEXPR Q_ALWAYS_INLINE QSSGBounds3::QSSGBounds3(
const QSSGBoxPoints &points)
215 : minimum(QVector3D(std::numeric_limits<
float>::max(), std::numeric_limits<
float>::max(), std::numeric_limits<
float>::max()))
216 , maximum(-std::numeric_limits<
float>::max(), -std::numeric_limits<
float>::max(), -std::numeric_limits<
float>::max())
218 for (
const QVector3D &v : points)
227Q_ALWAYS_INLINE
void QSSGBounds3::setEmpty()
229 constexpr float maxFloat = std::numeric_limits<
float>::max();
230 minimum = QVector3D(maxFloat, maxFloat, maxFloat);
231 maximum = QVector3D(-maxFloat, -maxFloat, -maxFloat);
234Q_ALWAYS_INLINE
void QSSGBounds3::setInfinite()
236 constexpr float maxFloat = std::numeric_limits<
float>::max();
237 minimum = QVector3D(-maxFloat, -maxFloat, -maxFloat);
238 maximum = QVector3D(maxFloat, maxFloat, maxFloat);
255Q_ALWAYS_INLINE
bool QSSGBounds3::intersects1D(
const QSSGBounds3 &a, quint32 axis)
const
257 Q_ASSERT(isFinite() && a.isFinite());
258 return maximum[
int(axis)] >= a.minimum[axis] && a.maximum[axis] >= minimum[axis];
269Q_ALWAYS_INLINE
bool QSSGBounds3::isInside(
const QSSGBounds3 &box)
const
271 Q_ASSERT(isFinite() && box.isFinite());
272 if (box.minimum.x() > minimum.x())
274 if (box.minimum.y() > minimum.y())
276 if (box.minimum.z() > minimum.z())
278 if (box.maximum.x() < maximum.x())
280 if (box.maximum.y() < maximum.y())
282 if (box.maximum.z() < maximum.z())
330Q_ALWAYS_INLINE QSSGBoxPoints QSSGBounds3::toQSSGBoxPointsNoEmptyCheck()
const
333 QVector3D(minimum[0], minimum[1], minimum[2]),
334 QVector3D(maximum[0], minimum[1], minimum[2]),
335 QVector3D(maximum[0], maximum[1], minimum[2]),
336 QVector3D(minimum[0], maximum[1], minimum[2]),
338 QVector3D(minimum[0], minimum[1], maximum[2]),
339 QVector3D(maximum[0], minimum[1], maximum[2]),
340 QVector3D(maximum[0], maximum[1], maximum[2]),
341 QVector3D(minimum[0], maximum[1], maximum[2])
345Q_ALWAYS_INLINE QSSGBoxPoints QSSGBounds3::toQSSGBoxPoints()
const
348 return { QVector3D(0, 0, 0), QVector3D(0, 0, 0), QVector3D(0, 0, 0), QVector3D(0, 0, 0),
349 QVector3D(0, 0, 0), QVector3D(0, 0, 0), QVector3D(0, 0, 0), QVector3D(0, 0, 0) };
350 return toQSSGBoxPointsNoEmptyCheck();