Axis-aligned bounding box (AABB). A helper class for working with boxes. It runs at F32 precision. @see Box3D
| 47 | /// |
| 48 | /// @see Box3D |
| 49 | class Box3F : public BoxBase |
| 50 | { |
| 51 | public: |
| 52 | |
| 53 | Point3F minExtents; ///< Minimum extents of box |
| 54 | Point3F maxExtents; ///< Maximum extents of box |
| 55 | |
| 56 | Box3F() { } |
| 57 | |
| 58 | /// Create a box from two points. |
| 59 | /// |
| 60 | /// Normally, this function will compensate for mismatched |
| 61 | /// min/max values. If you know your values are valid, you |
| 62 | /// can set in_overrideCheck to true and skip this. |
| 63 | /// |
| 64 | /// @param in_rMin Minimum extents of box. |
| 65 | /// @param in_rMax Maximum extents of box. |
| 66 | /// @param in_overrideCheck Pass true to skip check of extents. |
| 67 | Box3F( const Point3F& in_rMin, const Point3F& in_rMax, const bool in_overrideCheck = false ); |
| 68 | |
| 69 | /// Create a box from six extent values. |
| 70 | /// |
| 71 | /// No checking is performed as to the validity of these |
| 72 | /// extents, unlike the other constructor. |
| 73 | Box3F( const F32 &xMin, const F32 &yMin, const F32 &zMin, |
| 74 | const F32 &xMax, const F32 &yMax, const F32 &zMax ); |
| 75 | |
| 76 | Box3F(F32 cubeSize); |
| 77 | |
| 78 | void set( const Point3F& in_rMin, const Point3F& in_rMax ); |
| 79 | |
| 80 | void set( const F32 &xMin, const F32 &yMin, const F32 &zMin, |
| 81 | const F32 &xMax, const F32 &yMax, const F32 &zMax ); |
| 82 | |
| 83 | /// Create box around origin given lengths |
| 84 | void set( const Point3F& in_Length ); |
| 85 | |
| 86 | /// Recenter the box |
| 87 | void setCenter( const Point3F& center ); |
| 88 | |
| 89 | /// Check to see if a point is contained in this box. |
| 90 | bool isContained( const Point3F& in_rContained ) const; |
| 91 | |
| 92 | /// Check if the Point2F is within the box xy extents. |
| 93 | bool isContained( const Point2F &pt ) const; |
| 94 | |
| 95 | /// Check to see if another box overlaps this box. |
| 96 | bool isOverlapped( const Box3F& in_rOverlap ) const; |
| 97 | |
| 98 | /// Check if the given sphere overlaps with the box. |
| 99 | bool isOverlapped( const SphereF& sphere ) const; |
| 100 | |
| 101 | /// Check to see if another box is contained in this box. |
| 102 | bool isContained( const Box3F& in_rContained ) const; |
| 103 | |
| 104 | /// Returns the length of the x extent. |
| 105 | F32 len_x() const { return maxExtents.x - minExtents.x; } |
| 106 |