36#include "foundation/PxTransform.h"
37#include "foundation/PxMat33.h"
45#define PX_MAX_BOUNDS_EXTENTS (PX_MAX_REAL * 0.25f)
75 minimum = other.minimum;
76 maximum = other.maximum;
276 PxVec3 minimum, maximum;
280: minimum(minimum_), maximum(maximum_)
301 return PxBounds3(center - extent, center + extent);
308 const PxVec3 c0 = basis.column0 * extent.x;
309 const PxVec3 c1 = basis.column1 * extent.y;
310 const PxVec3 c2 = basis.column2 * extent.z;
317 return PxBounds3(center - w, center + w);
327 minimum =
PxVec3(PX_MAX_BOUNDS_EXTENTS);
328 maximum =
PxVec3(-PX_MAX_BOUNDS_EXTENTS);
333 minimum =
PxVec3(-PX_MAX_BOUNDS_EXTENTS);
334 maximum =
PxVec3(PX_MAX_BOUNDS_EXTENTS);
347 minimum = minimum.
minimum(b.minimum);
348 maximum = maximum.
maximum(b.maximum);
354 return minimum.x > maximum.x;
359 PX_ASSERT(
isValid() && b.isValid());
360 return !(b.minimum.x > maximum.x || minimum.x > b.maximum.x || b.minimum.y > maximum.y || minimum.y > b.maximum.y ||
361 b.minimum.z > maximum.z || minimum.z > b.maximum.z);
366 PX_ASSERT(
isValid() && a.isValid());
367 return maximum[axis] >= a.minimum[axis] && a.maximum[axis] >= minimum[axis];
374 return !(v.x < minimum.x || v.x > maximum.x || v.y < minimum.y || v.y > maximum.y || v.z < minimum.z ||
380 PX_ASSERT(
isValid() && box.isValid());
381 if(box.minimum.x > minimum.x)
383 if(box.minimum.y > minimum.y)
385 if(box.minimum.z > minimum.z)
387 if(box.maximum.x < maximum.x)
389 if(box.maximum.y < maximum.y)
391 if(box.maximum.z < maximum.z)
399 return (minimum + maximum) * 0.5f;
405 return (minimum[axis] + maximum[axis]) * 0.5f;
411 return (maximum[axis] - minimum[axis]) * 0.5f;
417 return maximum - minimum;
449 minimum.x -= distance;
450 minimum.y -= distance;
451 minimum.z -= distance;
453 maximum.x += distance;
454 maximum.y += distance;
455 maximum.z += distance;
461 return !bounds.isEmpty() ?
transformFast(matrix, bounds) : bounds;
473 return !bounds.isEmpty() ?
transformFast(transform, bounds) : bounds;
484 return (
isFinite() && (((minimum.x <= maximum.x) && (minimum.y <= maximum.y) && (minimum.z <= maximum.z)) ||
485 ((minimum.x == PX_MAX_BOUNDS_EXTENTS) && (minimum.y == PX_MAX_BOUNDS_EXTENTS) &&
486 (minimum.z == PX_MAX_BOUNDS_EXTENTS) && (maximum.x == -PX_MAX_BOUNDS_EXTENTS) &&
487 (maximum.y == -PX_MAX_BOUNDS_EXTENTS) && (maximum.z == -PX_MAX_BOUNDS_EXTENTS))));
Class representing 3D range or axis aligned bounding box.
Definition PxBounds3.h:58
static PX_CUDA_CALLABLE PX_INLINE PxBounds3 basisExtent(const PxVec3 ¢er, const PxMat33 &basis, const PxVec3 &extent)
Construct from center, extent, and (not necessarily orthogonal) basis.
Definition PxBounds3.h:305
PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3 closestPoint(const PxVec3 &p) const
Definition PxBounds3.h:490
PX_CUDA_CALLABLE PX_FORCE_INLINE void fattenSafe(float distance)
Definition PxBounds3.h:439
PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3 getExtents() const
returns the extents, which are half of the width/height/depth.
Definition PxBounds3.h:420
PX_CUDA_CALLABLE PX_FORCE_INLINE void include(const PxVec3 &v)
expands the volume to include v
Definition PxBounds3.h:337
PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3 getDimensions() const
returns the dimensions (width/height/depth) of this axis aligned box.
Definition PxBounds3.h:414
PX_CUDA_CALLABLE PX_FORCE_INLINE bool isValid() const
Definition PxBounds3.h:482
PX_CUDA_CALLABLE PX_FORCE_INLINE void scaleSafe(float scale)
scales the AABB.
Definition PxBounds3.h:426
static PX_CUDA_CALLABLE PX_INLINE PxBounds3 transformSafe(const PxMat33 &matrix, const PxBounds3 &bounds)
gets the transformed bounds of the passed AABB (resulting in a bigger AABB).
Definition PxBounds3.h:458
PX_CUDA_CALLABLE PX_FORCE_INLINE void setMaximal()
Sets the bounds to maximum size [-PX_MAX_BOUNDS_EXTENTS, PX_MAX_BOUNDS_EXTENTS].
Definition PxBounds3.h:331
PX_CUDA_CALLABLE PX_FORCE_INLINE bool intersects(const PxBounds3 &b) const
indicates whether the intersection of this and b is empty or not.
Definition PxBounds3.h:357
static PX_CUDA_CALLABLE PX_FORCE_INLINE PxBounds3 empty()
Return empty bounds.
Definition PxBounds3.h:284
PX_CUDA_CALLABLE PX_FORCE_INLINE void fattenFast(float distance)
Definition PxBounds3.h:446
PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3 getCenter() const
returns the center of this axis aligned box.
Definition PxBounds3.h:396
PX_CUDA_CALLABLE PX_FORCE_INLINE bool intersects1D(const PxBounds3 &a, uint32_t axis) const
computes the 1D-intersection between two AABBs, on a given axis.
Definition PxBounds3.h:364
static PX_CUDA_CALLABLE PX_INLINE PxBounds3 transformFast(const PxMat33 &matrix, const PxBounds3 &bounds)
gets the transformed bounds of the passed AABB (resulting in a bigger AABB).
Definition PxBounds3.h:464
PX_CUDA_CALLABLE PX_FORCE_INLINE void scaleFast(float scale)
scales the AABB.
Definition PxBounds3.h:433
PX_CUDA_CALLABLE PX_FORCE_INLINE bool isInside(const PxBounds3 &box) const
checks a box is inside another box.
Definition PxBounds3.h:378
static PX_CUDA_CALLABLE PX_FORCE_INLINE PxBounds3 centerExtents(const PxVec3 ¢er, const PxVec3 &extent)
returns the AABB from center and extents vectors.
Definition PxBounds3.h:299
PX_CUDA_CALLABLE PX_FORCE_INLINE bool contains(const PxVec3 &v) const
indicates if these bounds contain v.
Definition PxBounds3.h:370
PX_CUDA_CALLABLE PX_FORCE_INLINE float getExtents(uint32_t axis) const
get component of the box's extents along a given axis
Definition PxBounds3.h:408
static PX_CUDA_CALLABLE PX_INLINE PxBounds3 poseExtent(const PxTransform &pose, const PxVec3 &extent)
Construct from pose and extent.
Definition PxBounds3.h:320
PX_CUDA_CALLABLE PX_FORCE_INLINE bool isFinite() const
Definition PxBounds3.h:289
PX_CUDA_CALLABLE PX_FORCE_INLINE PxBounds3()
Default constructor, not performing any initialization for performance reason.
Definition PxBounds3.h:64
static PX_CUDA_CALLABLE PX_FORCE_INLINE PxBounds3 boundsOfPoints(const PxVec3 &v0, const PxVec3 &v1)
returns the AABB containing v0 and v1.
Definition PxBounds3.h:294
PX_CUDA_CALLABLE PX_FORCE_INLINE void setEmpty()
Sets empty to true.
Definition PxBounds3.h:325
3x3 matrix class
Definition PxMat33.h:91
3 Element vector class.
Definition PxVec3.h:50
PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3 maximum(const PxVec3 &v) const
element-wise maximum
Definition PxVec3.h:360
PX_CUDA_CALLABLE PX_INLINE bool isFinite() const
returns true if all 3 elems of the vector are finite (not NAN or INF, etc.)
Definition PxVec3.h:156
PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3 minimum(const PxVec3 &v) const
element-wise minimum
Definition PxVec3.h:344
#define PX_FORCE_INLINE
Definition PxPreprocessor.h:335
#define PX_INLINE
Definition PxPreprocessor.h:320
Sorts an array of objects in ascending order, assuming that the predicate implements the < operator:
Definition PxBoxController.h:39
PX_CUDA_CALLABLE PX_FORCE_INLINE float PxAbs(float a)
abs returns the absolute value of its argument.
Definition PxMath.h:109