OGRE  1.7
Object-Oriented Graphics Rendering Engine
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
OgreAxisAlignedBox.h
Go to the documentation of this file.
1 /*
2 -----------------------------------------------------------------------------
3 This source file is part of OGRE
4 (Object-oriented Graphics Rendering Engine)
5 For the latest info, see http://www.ogre3d.org/
6 
7 Copyright (c) 2000-2011 Torus Knot Software Ltd
8 
9 Permission is hereby granted, free of charge, to any person obtaining a copy
10 of this software and associated documentation files (the "Software"), to deal
11 in the Software without restriction, including without limitation the rights
12 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 copies of the Software, and to permit persons to whom the Software is
14 furnished to do so, subject to the following conditions:
15 
16 The above copyright notice and this permission notice shall be included in
17 all copies or substantial portions of the Software.
18 
19 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25 THE SOFTWARE.
26 -----------------------------------------------------------------------------
27 */
28 #ifndef __AxisAlignedBox_H_
29 #define __AxisAlignedBox_H_
30 
31 // Precompiler options
32 #include "OgrePrerequisites.h"
33 
34 #include "OgreVector3.h"
35 #include "OgreMatrix4.h"
36 
37 namespace Ogre {
55  {
56  public:
57  enum Extent
58  {
61  EXTENT_INFINITE
62  };
63  protected:
64 
68  mutable Vector3* mpCorners;
69 
70  public:
71  /*
72  1-----2
73  /| /|
74  / | / |
75  5-----4 |
76  | 0--|--3
77  | / | /
78  |/ |/
79  6-----7
80  */
81  typedef enum {
82  FAR_LEFT_BOTTOM = 0,
83  FAR_LEFT_TOP = 1,
84  FAR_RIGHT_TOP = 2,
85  FAR_RIGHT_BOTTOM = 3,
86  NEAR_RIGHT_BOTTOM = 7,
87  NEAR_LEFT_BOTTOM = 6,
88  NEAR_LEFT_TOP = 5,
89  NEAR_RIGHT_TOP = 4
90  } CornerEnum;
91  inline AxisAlignedBox() : mMinimum(Vector3::ZERO), mMaximum(Vector3::UNIT_SCALE), mpCorners(0)
92  {
93  // Default to a null box
94  setMinimum( -0.5, -0.5, -0.5 );
95  setMaximum( 0.5, 0.5, 0.5 );
96  mExtent = EXTENT_NULL;
97  }
98  inline AxisAlignedBox(Extent e) : mMinimum(Vector3::ZERO), mMaximum(Vector3::UNIT_SCALE), mpCorners(0)
99  {
100  setMinimum( -0.5, -0.5, -0.5 );
101  setMaximum( 0.5, 0.5, 0.5 );
102  mExtent = e;
103  }
104 
105  inline AxisAlignedBox(const AxisAlignedBox & rkBox) : mMinimum(Vector3::ZERO), mMaximum(Vector3::UNIT_SCALE), mpCorners(0)
106 
107  {
108  if (rkBox.isNull())
109  setNull();
110  else if (rkBox.isInfinite())
111  setInfinite();
112  else
113  setExtents( rkBox.mMinimum, rkBox.mMaximum );
114  }
115 
116  inline AxisAlignedBox( const Vector3& min, const Vector3& max ) : mMinimum(Vector3::ZERO), mMaximum(Vector3::UNIT_SCALE), mpCorners(0)
117  {
118  setExtents( min, max );
119  }
120 
122  Real mx, Real my, Real mz,
123  Real Mx, Real My, Real Mz ) : mMinimum(Vector3::ZERO), mMaximum(Vector3::UNIT_SCALE), mpCorners(0)
124  {
125  setExtents( mx, my, mz, Mx, My, Mz );
126  }
127 
129  {
130  // Specifically override to avoid copying mpCorners
131  if (rhs.isNull())
132  setNull();
133  else if (rhs.isInfinite())
134  setInfinite();
135  else
136  setExtents(rhs.mMinimum, rhs.mMaximum);
137 
138  return *this;
139  }
140 
142  {
143  if (mpCorners)
145  }
146 
147 
150  inline const Vector3& getMinimum(void) const
151  {
152  return mMinimum;
153  }
154 
158  inline Vector3& getMinimum(void)
159  {
160  return mMinimum;
161  }
162 
165  inline const Vector3& getMaximum(void) const
166  {
167  return mMaximum;
168  }
169 
173  inline Vector3& getMaximum(void)
174  {
175  return mMaximum;
176  }
177 
178 
181  inline void setMinimum( const Vector3& vec )
182  {
183  mExtent = EXTENT_FINITE;
184  mMinimum = vec;
185  }
186 
187  inline void setMinimum( Real x, Real y, Real z )
188  {
189  mExtent = EXTENT_FINITE;
190  mMinimum.x = x;
191  mMinimum.y = y;
192  mMinimum.z = z;
193  }
194 
198  inline void setMinimumX(Real x)
199  {
200  mMinimum.x = x;
201  }
202 
203  inline void setMinimumY(Real y)
204  {
205  mMinimum.y = y;
206  }
207 
208  inline void setMinimumZ(Real z)
209  {
210  mMinimum.z = z;
211  }
212 
215  inline void setMaximum( const Vector3& vec )
216  {
217  mExtent = EXTENT_FINITE;
218  mMaximum = vec;
219  }
220 
221  inline void setMaximum( Real x, Real y, Real z )
222  {
223  mExtent = EXTENT_FINITE;
224  mMaximum.x = x;
225  mMaximum.y = y;
226  mMaximum.z = z;
227  }
228 
232  inline void setMaximumX( Real x )
233  {
234  mMaximum.x = x;
235  }
236 
237  inline void setMaximumY( Real y )
238  {
239  mMaximum.y = y;
240  }
241 
242  inline void setMaximumZ( Real z )
243  {
244  mMaximum.z = z;
245  }
246 
249  inline void setExtents( const Vector3& min, const Vector3& max )
250  {
251  assert( (min.x <= max.x && min.y <= max.y && min.z <= max.z) &&
252  "The minimum corner of the box must be less than or equal to maximum corner" );
253 
254  mExtent = EXTENT_FINITE;
255  mMinimum = min;
256  mMaximum = max;
257  }
258 
259  inline void setExtents(
260  Real mx, Real my, Real mz,
261  Real Mx, Real My, Real Mz )
262  {
263  assert( (mx <= Mx && my <= My && mz <= Mz) &&
264  "The minimum corner of the box must be less than or equal to maximum corner" );
265 
266  mExtent = EXTENT_FINITE;
267 
268  mMinimum.x = mx;
269  mMinimum.y = my;
270  mMinimum.z = mz;
271 
272  mMaximum.x = Mx;
273  mMaximum.y = My;
274  mMaximum.z = Mz;
275 
276  }
277 
302  inline const Vector3* getAllCorners(void) const
303  {
304  assert( (mExtent == EXTENT_FINITE) && "Can't get corners of a null or infinite AAB" );
305 
306  // The order of these items is, using right-handed co-ordinates:
307  // Minimum Z face, starting with Min(all), then anticlockwise
308  // around face (looking onto the face)
309  // Maximum Z face, starting with Max(all), then anticlockwise
310  // around face (looking onto the face)
311  // Only for optimization/compatibility.
312  if (!mpCorners)
314 
315  mpCorners[0] = mMinimum;
316  mpCorners[1].x = mMinimum.x; mpCorners[1].y = mMaximum.y; mpCorners[1].z = mMinimum.z;
317  mpCorners[2].x = mMaximum.x; mpCorners[2].y = mMaximum.y; mpCorners[2].z = mMinimum.z;
318  mpCorners[3].x = mMaximum.x; mpCorners[3].y = mMinimum.y; mpCorners[3].z = mMinimum.z;
319 
320  mpCorners[4] = mMaximum;
321  mpCorners[5].x = mMinimum.x; mpCorners[5].y = mMaximum.y; mpCorners[5].z = mMaximum.z;
322  mpCorners[6].x = mMinimum.x; mpCorners[6].y = mMinimum.y; mpCorners[6].z = mMaximum.z;
323  mpCorners[7].x = mMaximum.x; mpCorners[7].y = mMinimum.y; mpCorners[7].z = mMaximum.z;
324 
325  return mpCorners;
326  }
327 
330  Vector3 getCorner(CornerEnum cornerToGet) const
331  {
332  switch(cornerToGet)
333  {
334  case FAR_LEFT_BOTTOM:
335  return mMinimum;
336  case FAR_LEFT_TOP:
337  return Vector3(mMinimum.x, mMaximum.y, mMinimum.z);
338  case FAR_RIGHT_TOP:
339  return Vector3(mMaximum.x, mMaximum.y, mMinimum.z);
340  case FAR_RIGHT_BOTTOM:
341  return Vector3(mMaximum.x, mMinimum.y, mMinimum.z);
342  case NEAR_RIGHT_BOTTOM:
343  return Vector3(mMaximum.x, mMinimum.y, mMaximum.z);
344  case NEAR_LEFT_BOTTOM:
345  return Vector3(mMinimum.x, mMinimum.y, mMaximum.z);
346  case NEAR_LEFT_TOP:
347  return Vector3(mMinimum.x, mMaximum.y, mMaximum.z);
348  case NEAR_RIGHT_TOP:
349  return mMaximum;
350  default:
351  return Vector3();
352  }
353  }
354 
355  _OgreExport friend std::ostream& operator<<( std::ostream& o, const AxisAlignedBox aab )
356  {
357  switch (aab.mExtent)
358  {
359  case EXTENT_NULL:
360  o << "AxisAlignedBox(null)";
361  return o;
362 
363  case EXTENT_FINITE:
364  o << "AxisAlignedBox(min=" << aab.mMinimum << ", max=" << aab.mMaximum << ")";
365  return o;
366 
367  case EXTENT_INFINITE:
368  o << "AxisAlignedBox(infinite)";
369  return o;
370 
371  default: // shut up compiler
372  assert( false && "Never reached" );
373  return o;
374  }
375  }
376 
380  void merge( const AxisAlignedBox& rhs )
381  {
382  // Do nothing if rhs null, or this is infinite
383  if ((rhs.mExtent == EXTENT_NULL) || (mExtent == EXTENT_INFINITE))
384  {
385  return;
386  }
387  // Otherwise if rhs is infinite, make this infinite, too
388  else if (rhs.mExtent == EXTENT_INFINITE)
389  {
390  mExtent = EXTENT_INFINITE;
391  }
392  // Otherwise if current null, just take rhs
393  else if (mExtent == EXTENT_NULL)
394  {
395  setExtents(rhs.mMinimum, rhs.mMaximum);
396  }
397  // Otherwise merge
398  else
399  {
400  Vector3 min = mMinimum;
401  Vector3 max = mMaximum;
402  max.makeCeil(rhs.mMaximum);
403  min.makeFloor(rhs.mMinimum);
404 
405  setExtents(min, max);
406  }
407 
408  }
409 
412  inline void merge( const Vector3& point )
413  {
414  switch (mExtent)
415  {
416  case EXTENT_NULL: // if null, use this point
417  setExtents(point, point);
418  return;
419 
420  case EXTENT_FINITE:
421  mMaximum.makeCeil(point);
422  mMinimum.makeFloor(point);
423  return;
424 
425  case EXTENT_INFINITE: // if infinite, makes no difference
426  return;
427  }
428 
429  assert( false && "Never reached" );
430  }
431 
441  inline void transform( const Matrix4& matrix )
442  {
443  // Do nothing if current null or infinite
444  if( mExtent != EXTENT_FINITE )
445  return;
446 
447  Vector3 oldMin, oldMax, currentCorner;
448 
449  // Getting the old values so that we can use the existing merge method.
450  oldMin = mMinimum;
451  oldMax = mMaximum;
452 
453  // reset
454  setNull();
455 
456  // We sequentially compute the corners in the following order :
457  // 0, 6, 5, 1, 2, 4 ,7 , 3
458  // This sequence allows us to only change one member at a time to get at all corners.
459 
460  // For each one, we transform it using the matrix
461  // Which gives the resulting point and merge the resulting point.
462 
463  // First corner
464  // min min min
465  currentCorner = oldMin;
466  merge( matrix * currentCorner );
467 
468  // min,min,max
469  currentCorner.z = oldMax.z;
470  merge( matrix * currentCorner );
471 
472  // min max max
473  currentCorner.y = oldMax.y;
474  merge( matrix * currentCorner );
475 
476  // min max min
477  currentCorner.z = oldMin.z;
478  merge( matrix * currentCorner );
479 
480  // max max min
481  currentCorner.x = oldMax.x;
482  merge( matrix * currentCorner );
483 
484  // max max max
485  currentCorner.z = oldMax.z;
486  merge( matrix * currentCorner );
487 
488  // max min max
489  currentCorner.y = oldMin.y;
490  merge( matrix * currentCorner );
491 
492  // max min min
493  currentCorner.z = oldMin.z;
494  merge( matrix * currentCorner );
495  }
496 
508  void transformAffine(const Matrix4& m)
509  {
510  assert(m.isAffine());
511 
512  // Do nothing if current null or infinite
513  if ( mExtent != EXTENT_FINITE )
514  return;
515 
516  Vector3 centre = getCenter();
517  Vector3 halfSize = getHalfSize();
518 
519  Vector3 newCentre = m.transformAffine(centre);
520  Vector3 newHalfSize(
521  Math::Abs(m[0][0]) * halfSize.x + Math::Abs(m[0][1]) * halfSize.y + Math::Abs(m[0][2]) * halfSize.z,
522  Math::Abs(m[1][0]) * halfSize.x + Math::Abs(m[1][1]) * halfSize.y + Math::Abs(m[1][2]) * halfSize.z,
523  Math::Abs(m[2][0]) * halfSize.x + Math::Abs(m[2][1]) * halfSize.y + Math::Abs(m[2][2]) * halfSize.z);
524 
525  setExtents(newCentre - newHalfSize, newCentre + newHalfSize);
526  }
527 
530  inline void setNull()
531  {
532  mExtent = EXTENT_NULL;
533  }
534 
537  inline bool isNull(void) const
538  {
539  return (mExtent == EXTENT_NULL);
540  }
541 
544  bool isFinite(void) const
545  {
546  return (mExtent == EXTENT_FINITE);
547  }
548 
551  inline void setInfinite()
552  {
553  mExtent = EXTENT_INFINITE;
554  }
555 
558  bool isInfinite(void) const
559  {
560  return (mExtent == EXTENT_INFINITE);
561  }
562 
564  inline bool intersects(const AxisAlignedBox& b2) const
565  {
566  // Early-fail for nulls
567  if (this->isNull() || b2.isNull())
568  return false;
569 
570  // Early-success for infinites
571  if (this->isInfinite() || b2.isInfinite())
572  return true;
573 
574  // Use up to 6 separating planes
575  if (mMaximum.x < b2.mMinimum.x)
576  return false;
577  if (mMaximum.y < b2.mMinimum.y)
578  return false;
579  if (mMaximum.z < b2.mMinimum.z)
580  return false;
581 
582  if (mMinimum.x > b2.mMaximum.x)
583  return false;
584  if (mMinimum.y > b2.mMaximum.y)
585  return false;
586  if (mMinimum.z > b2.mMaximum.z)
587  return false;
588 
589  // otherwise, must be intersecting
590  return true;
591 
592  }
593 
596  {
597  if (this->isNull() || b2.isNull())
598  {
599  return AxisAlignedBox();
600  }
601  else if (this->isInfinite())
602  {
603  return b2;
604  }
605  else if (b2.isInfinite())
606  {
607  return *this;
608  }
609 
610  Vector3 intMin = mMinimum;
611  Vector3 intMax = mMaximum;
612 
613  intMin.makeCeil(b2.getMinimum());
614  intMax.makeFloor(b2.getMaximum());
615 
616  // Check intersection isn't null
617  if (intMin.x < intMax.x &&
618  intMin.y < intMax.y &&
619  intMin.z < intMax.z)
620  {
621  return AxisAlignedBox(intMin, intMax);
622  }
623 
624  return AxisAlignedBox();
625  }
626 
628  Real volume(void) const
629  {
630  switch (mExtent)
631  {
632  case EXTENT_NULL:
633  return 0.0f;
634 
635  case EXTENT_FINITE:
636  {
637  Vector3 diff = mMaximum - mMinimum;
638  return diff.x * diff.y * diff.z;
639  }
640 
641  case EXTENT_INFINITE:
642  return Math::POS_INFINITY;
643 
644  default: // shut up compiler
645  assert( false && "Never reached" );
646  return 0.0f;
647  }
648  }
649 
651  inline void scale(const Vector3& s)
652  {
653  // Do nothing if current null or infinite
654  if (mExtent != EXTENT_FINITE)
655  return;
656 
657  // NB assumes centered on origin
658  Vector3 min = mMinimum * s;
659  Vector3 max = mMaximum * s;
660  setExtents(min, max);
661  }
662 
664  bool intersects(const Sphere& s) const
665  {
666  return Math::intersects(s, *this);
667  }
669  bool intersects(const Plane& p) const
670  {
671  return Math::intersects(p, *this);
672  }
674  bool intersects(const Vector3& v) const
675  {
676  switch (mExtent)
677  {
678  case EXTENT_NULL:
679  return false;
680 
681  case EXTENT_FINITE:
682  return(v.x >= mMinimum.x && v.x <= mMaximum.x &&
683  v.y >= mMinimum.y && v.y <= mMaximum.y &&
684  v.z >= mMinimum.z && v.z <= mMaximum.z);
685 
686  case EXTENT_INFINITE:
687  return true;
688 
689  default: // shut up compiler
690  assert( false && "Never reached" );
691  return false;
692  }
693  }
695  Vector3 getCenter(void) const
696  {
697  assert( (mExtent == EXTENT_FINITE) && "Can't get center of a null or infinite AAB" );
698 
699  return Vector3(
700  (mMaximum.x + mMinimum.x) * 0.5f,
701  (mMaximum.y + mMinimum.y) * 0.5f,
702  (mMaximum.z + mMinimum.z) * 0.5f);
703  }
705  Vector3 getSize(void) const
706  {
707  switch (mExtent)
708  {
709  case EXTENT_NULL:
710  return Vector3::ZERO;
711 
712  case EXTENT_FINITE:
713  return mMaximum - mMinimum;
714 
715  case EXTENT_INFINITE:
716  return Vector3(
720 
721  default: // shut up compiler
722  assert( false && "Never reached" );
723  return Vector3::ZERO;
724  }
725  }
727  Vector3 getHalfSize(void) const
728  {
729  switch (mExtent)
730  {
731  case EXTENT_NULL:
732  return Vector3::ZERO;
733 
734  case EXTENT_FINITE:
735  return (mMaximum - mMinimum) * 0.5;
736 
737  case EXTENT_INFINITE:
738  return Vector3(
742 
743  default: // shut up compiler
744  assert( false && "Never reached" );
745  return Vector3::ZERO;
746  }
747  }
748 
751  bool contains(const Vector3& v) const
752  {
753  if (isNull())
754  return false;
755  if (isInfinite())
756  return true;
757 
758  return mMinimum.x <= v.x && v.x <= mMaximum.x &&
759  mMinimum.y <= v.y && v.y <= mMaximum.y &&
760  mMinimum.z <= v.z && v.z <= mMaximum.z;
761  }
762 
765  bool contains(const AxisAlignedBox& other) const
766  {
767  if (other.isNull() || this->isInfinite())
768  return true;
769 
770  if (this->isNull() || other.isInfinite())
771  return false;
772 
773  return this->mMinimum.x <= other.mMinimum.x &&
774  this->mMinimum.y <= other.mMinimum.y &&
775  this->mMinimum.z <= other.mMinimum.z &&
776  other.mMaximum.x <= this->mMaximum.x &&
777  other.mMaximum.y <= this->mMaximum.y &&
778  other.mMaximum.z <= this->mMaximum.z;
779  }
780 
783  bool operator== (const AxisAlignedBox& rhs) const
784  {
785  if (this->mExtent != rhs.mExtent)
786  return false;
787 
788  if (!this->isFinite())
789  return true;
790 
791  return this->mMinimum == rhs.mMinimum &&
792  this->mMaximum == rhs.mMaximum;
793  }
794 
797  bool operator!= (const AxisAlignedBox& rhs) const
798  {
799  return !(*this == rhs);
800  }
801 
802  // special values
803  static const AxisAlignedBox BOX_NULL;
805 
806 
807  };
808 
811 } // namespace Ogre
812 
813 #endif
#define OGRE_ALLOC_T(T, count, category)
Allocate a block of memory for a primitive type, and indicate the category of usage.
Class encapsulating a standard 4x4 homogeneous matrix.
Definition: OgreMatrix4.h:78
AxisAlignedBox(const AxisAlignedBox &rkBox)
float Real
Software floating point type.
#define _OgreExport
Definition: OgrePlatform.h:203
void merge(const Vector3 &point)
Extends the box to encompass the specified point (if needed).
void setExtents(Real mx, Real my, Real mz, Real Mx, Real My, Real Mz)
Real volume(void) const
Calculate the volume of this box.
Defines a plane in 3D space.
Definition: OgrePlane.h:61
static const AxisAlignedBox BOX_NULL
Vector3 getCenter(void) const
Gets the centre of the box.
static const Vector3 ZERO
Definition: OgreVector3.h:774
void transformAffine(const Matrix4 &m)
Transforms the box according to the affine matrix supplied.
A 3D box aligned with the x/y/z axes.
static std::pair< bool, Real > intersects(const Ray &ray, const Plane &plane)
Ray / plane intersection, returns boolean result and distance.
void makeFloor(const Vector3 &cmp)
Sets this vector's components to the minimum of its own and the ones of the passed in vector...
Definition: OgreVector3.h:532
AxisAlignedBox(const Vector3 &min, const Vector3 &max)
void transform(const Matrix4 &matrix)
Transforms the box according to the matrix supplied.
AxisAlignedBox intersection(const AxisAlignedBox &b2) const
Calculate the area of intersection of this box and another.
_OgreExport friend std::ostream & operator<<(std::ostream &o, const AxisAlignedBox aab)
void setMaximumX(Real x)
Changes one of the components of the maximum corner of the box used to resize only one dimension of t...
const Vector3 & getMaximum(void) const
Gets the maximum corner of the box.
Vector3 getCorner(CornerEnum cornerToGet) const
gets the position of one of the corners
bool isAffine(void) const
Check whether or not the matrix is affine matrix.
Definition: OgreMatrix4.h:571
static const Real POS_INFINITY
Definition: OgreMath.h:590
bool intersects(const Vector3 &v) const
Tests whether the vector point is within this box.
Vector3 & getMaximum(void)
Gets a modifiable version of the maximum corner of the box.
static Real Abs(Real fValue)
Definition: OgreMath.h:239
void merge(const AxisAlignedBox &rhs)
Merges the passed in box into the current box.
static const AxisAlignedBox BOX_INFINITE
Vector3 transformAffine(const Vector3 &v) const
3-D Vector transformation specially for an affine matrix.
Definition: OgreMatrix4.h:616
void setExtents(const Vector3 &min, const Vector3 &max)
Sets both minimum and maximum extents at once.
A sphere primitive, mostly used for bounds checking.
Definition: OgreSphere.h:51
bool intersects(const AxisAlignedBox &b2) const
Returns whether or not this box intersects another.
Vector3 & getMinimum(void)
Gets a modifiable version of the minimum corner of the box.
void setMaximum(Real x, Real y, Real z)
void scale(const Vector3 &s)
Scales the AABB by the vector given.
bool isNull(void) const
Returns true if the box is null i.e.
Standard 3-dimensional vector.
Definition: OgreVector3.h:51
const Vector3 * getAllCorners(void) const
Returns a pointer to an array of 8 corner points, useful for collision vs.
void setNull()
Sets the box to a 'null' value i.e.
Vector3 getSize(void) const
Gets the size of the box.
bool isFinite(void) const
Returns true if the box is finite.
void setMaximum(const Vector3 &vec)
Sets the maximum corner of the box.
void setMinimum(const Vector3 &vec)
Sets the minimum corner of the box.
bool isInfinite(void) const
Returns true if the box is infinite.
bool intersects(const Sphere &s) const
Tests whether this box intersects a sphere.
void setInfinite()
Sets the box to 'infinite'.
const Vector3 & getMinimum(void) const
Gets the minimum corner of the box.
void makeCeil(const Vector3 &cmp)
Sets this vector's components to the maximum of its own and the ones of the passed in vector...
Definition: OgreVector3.h:546
#define OGRE_FREE(ptr, category)
Free the memory allocated with OGRE_MALLOC or OGRE_ALLOC_T. Category is required to be restated to en...
bool contains(const Vector3 &v) const
Tests whether the given point contained by this box.
AxisAlignedBox & operator=(const AxisAlignedBox &rhs)
AxisAlignedBox(Real mx, Real my, Real mz, Real Mx, Real My, Real Mz)
void setMinimumX(Real x)
Changes one of the components of the minimum corner of the box used to resize only one dimension of t...
bool contains(const AxisAlignedBox &other) const
Tests whether another box contained by this box.
bool intersects(const Plane &p) const
Tests whether this box intersects a plane.
void setMinimum(Real x, Real y, Real z)
Vector3 getHalfSize(void) const
Gets the half-size of the box.
bool operator==(STLAllocator< T, P > const &, STLAllocator< T2, P > const &)
determine equality, can memory from another allocator be released by this allocator, (ISO C++)
bool operator!=(STLAllocator< T, P > const &, STLAllocator< T2, P > const &)
determine equality, can memory from another allocator be released by this allocator, (ISO C++)