46
47
48 Q_DECL_CONSTEXPR Q_ALWAYS_INLINE QSSGBounds3();
51
52
53 Q_ALWAYS_INLINE QSSGBounds3(Qt::Initialization);
56
57
58 Q_DECL_CONSTEXPR Q_ALWAYS_INLINE QSSGBounds3(
const QVector3D &minimum,
const QVector3D &maximum);
61
62
63 Q_DECL_CONSTEXPR Q_ALWAYS_INLINE QSSGBounds3(
const QSSGBoxPoints &points);
66
67
68
69
70 static Q_ALWAYS_INLINE QSSGBounds3 boundsOfPoints(
const QVector3D &v0,
const QVector3D &v1);
73
74
75
76
77 static Q_ALWAYS_INLINE QSSGBounds3 centerExtents(
const QVector3D ¢er,
const QVector3D &extent);
80
81
82 static Q_ALWAYS_INLINE QSSGBounds3 basisExtent(
const QVector3D ¢er,
const QMatrix3x3 &basis,
const QVector3D &extent);
85
86
87
88
89 static QSSGBounds3 transform(
const QMatrix3x3 &matrix,
const QSSGBounds3 &bounds);
92
93
94 Q_ALWAYS_INLINE
void setEmpty();
97
98
99 Q_ALWAYS_INLINE
void setInfinite();
102
103
104
105 void include(
const QVector3D &v);
108
109
110
111 void include(
const QSSGBounds3 &b);
113 Q_ALWAYS_INLINE
bool isEmpty()
const;
116
117
118
119 Q_ALWAYS_INLINE
bool intersects(
const QSSGBounds3 &b)
const;
122
123
124
125
126 Q_ALWAYS_INLINE
bool intersects1D(
const QSSGBounds3 &a, quint32 axis)
const;
129
130
131
132 Q_ALWAYS_INLINE
bool contains(
const QVector3D &v)
const;
135
136
137
138 Q_ALWAYS_INLINE
bool isInside(
const QSSGBounds3 &box)
const;
141
142
143 Q_ALWAYS_INLINE QVector3D center()
const;
146
147
148 Q_ALWAYS_INLINE
float center(quint32 axis)
const;
151
152
153 Q_ALWAYS_INLINE
float extents(quint32 axis)
const;
156
157
158 Q_ALWAYS_INLINE QVector3D dimensions()
const;
161
162
163 Q_ALWAYS_INLINE QVector3D extents()
const;
166
167
168
169 Q_ALWAYS_INLINE
void scale(
float scale);
172
173
174 Q_ALWAYS_INLINE
void fatten(
double distance);
177
178
180 bool isFinite()
const;
183
184
185 Q_ALWAYS_INLINE QSSGBoxPoints toQSSGBoxPointsNoEmptyCheck()
const;
187
188
189 Q_ALWAYS_INLINE QSSGBoxPoints toQSSGBoxPoints()
const;
191 void transform(
const QMatrix4x4 &inMatrix);
194
195
196 QVector3D getSupport(
const QVector3D &direction)
const;
202Q_DECL_CONSTEXPR Q_ALWAYS_INLINE QSSGBounds3::QSSGBounds3()
203 : minimum(QVector3D(std::numeric_limits<
float>::max(), std::numeric_limits<
float>::max(), std::numeric_limits<
float>::max()))
204 , maximum(-std::numeric_limits<
float>::max(), -std::numeric_limits<
float>::max(), -std::numeric_limits<
float>::max())
216Q_DECL_CONSTEXPR Q_ALWAYS_INLINE QSSGBounds3::QSSGBounds3(
const QSSGBoxPoints &points)
217 : minimum(QVector3D(std::numeric_limits<
float>::max(), std::numeric_limits<
float>::max(), std::numeric_limits<
float>::max()))
218 , maximum(-std::numeric_limits<
float>::max(), -std::numeric_limits<
float>::max(), -std::numeric_limits<
float>::max())
220 for (
const QVector3D &v : points)
229Q_ALWAYS_INLINE
void QSSGBounds3::setEmpty()
231 constexpr float maxFloat = std::numeric_limits<
float>::max();
232 minimum = QVector3D(maxFloat, maxFloat, maxFloat);
233 maximum = QVector3D(-maxFloat, -maxFloat, -maxFloat);
236Q_ALWAYS_INLINE
void QSSGBounds3::setInfinite()
238 constexpr float maxFloat = std::numeric_limits<
float>::max();
239 minimum = QVector3D(-maxFloat, -maxFloat, -maxFloat);
240 maximum = QVector3D(maxFloat, maxFloat, maxFloat);
257Q_ALWAYS_INLINE
bool QSSGBounds3::intersects1D(
const QSSGBounds3 &a, quint32 axis)
const
259 Q_ASSERT(isFinite() && a.isFinite());
260 return maximum[
int(axis)] >= a.minimum[axis] && a.maximum[axis] >= minimum[axis];
271Q_ALWAYS_INLINE
bool QSSGBounds3::isInside(
const QSSGBounds3 &box)
const
273 Q_ASSERT(isFinite() && box.isFinite());
274 if (box.minimum.x() > minimum.x())
276 if (box.minimum.y() > minimum.y())
278 if (box.minimum.z() > minimum.z())
280 if (box.maximum.x() < maximum.x())
282 if (box.maximum.y() < maximum.y())
284 if (box.maximum.z() < maximum.z())
332Q_ALWAYS_INLINE QSSGBoxPoints QSSGBounds3::toQSSGBoxPointsNoEmptyCheck()
const
335 QVector3D(minimum[0], minimum[1], minimum[2]),
336 QVector3D(maximum[0], minimum[1], minimum[2]),
337 QVector3D(maximum[0], maximum[1], minimum[2]),
338 QVector3D(minimum[0], maximum[1], minimum[2]),
340 QVector3D(minimum[0], minimum[1], maximum[2]),
341 QVector3D(maximum[0], minimum[1], maximum[2]),
342 QVector3D(maximum[0], maximum[1], maximum[2]),
343 QVector3D(minimum[0], maximum[1], maximum[2])
347Q_ALWAYS_INLINE QSSGBoxPoints QSSGBounds3::toQSSGBoxPoints()
const
350 return { QVector3D(0, 0, 0), QVector3D(0, 0, 0), QVector3D(0, 0, 0), QVector3D(0, 0, 0),
351 QVector3D(0, 0, 0), QVector3D(0, 0, 0), QVector3D(0, 0, 0), QVector3D(0, 0, 0) };
352 return toQSSGBoxPointsNoEmptyCheck();