OgreAxisAlignedBox.h
Go to the documentation of this file.
1/*
2-----------------------------------------------------------------------------
3This source file is part of OGRE
4(Object-oriented Graphics Rendering Engine)
5For the latest info, see http://www.ogre3d.org/
6
7Copyright (c) 2000-2013 Torus Knot Software Ltd
8
9Permission is hereby granted, free of charge, to any person obtaining a copy
10of this software and associated documentation files (the "Software"), to deal
11in the Software without restriction, including without limitation the rights
12to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13copies of the Software, and to permit persons to whom the Software is
14furnished to do so, subject to the following conditions:
15
16The above copyright notice and this permission notice shall be included in
17all copies or substantial portions of the Software.
18
19THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25THE 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
37namespace Ogre {
55 {
56 public:
57 enum Extent
58 {
61 EXTENT_INFINITE
62 };
63 protected:
64
68 mutable Vector3* mCorners;
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), mCorners(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), mCorners(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), mCorners(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), mCorners(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), mCorners(0)
124 {
125 setExtents( mx, my, mz, Mx, My, Mz );
126 }
127
129 {
130 // Specifically override to avoid copying mCorners
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 (mCorners)
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
301 inline const Vector3* getAllCorners(void) const
302 {
303 assert( (mExtent == EXTENT_FINITE) && "Can't get corners of a null or infinite AAB" );
304
305 // The order of these items is, using right-handed co-ordinates:
306 // Minimum Z face, starting with Min(all), then anticlockwise
307 // around face (looking onto the face)
308 // Maximum Z face, starting with Max(all), then anticlockwise
309 // around face (looking onto the face)
310 // Only for optimization/compatibility.
311 if (!mCorners)
313
314 mCorners[0] = mMinimum;
315 mCorners[1].x = mMinimum.x; mCorners[1].y = mMaximum.y; mCorners[1].z = mMinimum.z;
316 mCorners[2].x = mMaximum.x; mCorners[2].y = mMaximum.y; mCorners[2].z = mMinimum.z;
317 mCorners[3].x = mMaximum.x; mCorners[3].y = mMinimum.y; mCorners[3].z = mMinimum.z;
318
319 mCorners[4] = mMaximum;
320 mCorners[5].x = mMinimum.x; mCorners[5].y = mMaximum.y; mCorners[5].z = mMaximum.z;
321 mCorners[6].x = mMinimum.x; mCorners[6].y = mMinimum.y; mCorners[6].z = mMaximum.z;
322 mCorners[7].x = mMaximum.x; mCorners[7].y = mMinimum.y; mCorners[7].z = mMaximum.z;
323
324 return mCorners;
325 }
326
329 Vector3 getCorner(CornerEnum cornerToGet) const
330 {
331 switch(cornerToGet)
332 {
333 case FAR_LEFT_BOTTOM:
334 return mMinimum;
335 case FAR_LEFT_TOP:
336 return Vector3(mMinimum.x, mMaximum.y, mMinimum.z);
337 case FAR_RIGHT_TOP:
338 return Vector3(mMaximum.x, mMaximum.y, mMinimum.z);
339 case FAR_RIGHT_BOTTOM:
340 return Vector3(mMaximum.x, mMinimum.y, mMinimum.z);
341 case NEAR_RIGHT_BOTTOM:
342 return Vector3(mMaximum.x, mMinimum.y, mMaximum.z);
343 case NEAR_LEFT_BOTTOM:
344 return Vector3(mMinimum.x, mMinimum.y, mMaximum.z);
345 case NEAR_LEFT_TOP:
346 return Vector3(mMinimum.x, mMaximum.y, mMaximum.z);
347 case NEAR_RIGHT_TOP:
348 return mMaximum;
349 default:
350 return Vector3();
351 }
352 }
353
354 _OgreExport friend std::ostream& operator<<( std::ostream& o, const AxisAlignedBox &aab )
355 {
356 switch (aab.mExtent)
357 {
358 case EXTENT_NULL:
359 o << "AxisAlignedBox(null)";
360 return o;
361
362 case EXTENT_FINITE:
363 o << "AxisAlignedBox(min=" << aab.mMinimum << ", max=" << aab.mMaximum << ")";
364 return o;
365
366 case EXTENT_INFINITE:
367 o << "AxisAlignedBox(infinite)";
368 return o;
369
370 default: // shut up compiler
371 assert( false && "Never reached" );
372 return o;
373 }
374 }
375
379 void merge( const AxisAlignedBox& rhs )
380 {
381 // Do nothing if rhs null, or this is infinite
382 if ((rhs.mExtent == EXTENT_NULL) || (mExtent == EXTENT_INFINITE))
383 {
384 return;
385 }
386 // Otherwise if rhs is infinite, make this infinite, too
387 else if (rhs.mExtent == EXTENT_INFINITE)
388 {
389 mExtent = EXTENT_INFINITE;
390 }
391 // Otherwise if current null, just take rhs
392 else if (mExtent == EXTENT_NULL)
393 {
394 setExtents(rhs.mMinimum, rhs.mMaximum);
395 }
396 // Otherwise merge
397 else
398 {
399 Vector3 min = mMinimum;
400 Vector3 max = mMaximum;
401 max.makeCeil(rhs.mMaximum);
402 min.makeFloor(rhs.mMinimum);
403
404 setExtents(min, max);
405 }
406
407 }
408
411 inline void merge( const Vector3& point )
412 {
413 switch (mExtent)
414 {
415 case EXTENT_NULL: // if null, use this point
416 setExtents(point, point);
417 return;
418
419 case EXTENT_FINITE:
420 mMaximum.makeCeil(point);
421 mMinimum.makeFloor(point);
422 return;
423
424 case EXTENT_INFINITE: // if infinite, makes no difference
425 return;
426 }
427
428 assert( false && "Never reached" );
429 }
430
440 inline void transform( const Matrix4& matrix )
441 {
442 // Do nothing if current null or infinite
443 if( mExtent != EXTENT_FINITE )
444 return;
445
446 Vector3 oldMin, oldMax, currentCorner;
447
448 // Getting the old values so that we can use the existing merge method.
449 oldMin = mMinimum;
450 oldMax = mMaximum;
451
452 // reset
453 setNull();
454
455 // We sequentially compute the corners in the following order :
456 // 0, 6, 5, 1, 2, 4 ,7 , 3
457 // This sequence allows us to only change one member at a time to get at all corners.
458
459 // For each one, we transform it using the matrix
460 // Which gives the resulting point and merge the resulting point.
461
462 // First corner
463 // min min min
464 currentCorner = oldMin;
465 merge( matrix * currentCorner );
466
467 // min,min,max
468 currentCorner.z = oldMax.z;
469 merge( matrix * currentCorner );
470
471 // min max max
472 currentCorner.y = oldMax.y;
473 merge( matrix * currentCorner );
474
475 // min max min
476 currentCorner.z = oldMin.z;
477 merge( matrix * currentCorner );
478
479 // max max min
480 currentCorner.x = oldMax.x;
481 merge( matrix * currentCorner );
482
483 // max max max
484 currentCorner.z = oldMax.z;
485 merge( matrix * currentCorner );
486
487 // max min max
488 currentCorner.y = oldMin.y;
489 merge( matrix * currentCorner );
490
491 // max min min
492 currentCorner.z = oldMin.z;
493 merge( matrix * currentCorner );
494 }
495
508 {
509 assert(m.isAffine());
510
511 // Do nothing if current null or infinite
512 if ( mExtent != EXTENT_FINITE )
513 return;
514
515 Vector3 centre = getCenter();
516 Vector3 halfSize = getHalfSize();
517
518 Vector3 newCentre = m.transformAffine(centre);
519 Vector3 newHalfSize(
520 Math::Abs(m[0][0]) * halfSize.x + Math::Abs(m[0][1]) * halfSize.y + Math::Abs(m[0][2]) * halfSize.z,
521 Math::Abs(m[1][0]) * halfSize.x + Math::Abs(m[1][1]) * halfSize.y + Math::Abs(m[1][2]) * halfSize.z,
522 Math::Abs(m[2][0]) * halfSize.x + Math::Abs(m[2][1]) * halfSize.y + Math::Abs(m[2][2]) * halfSize.z);
523
524 setExtents(newCentre - newHalfSize, newCentre + newHalfSize);
525 }
526
529 inline void setNull()
530 {
531 mExtent = EXTENT_NULL;
532 }
533
536 inline bool isNull(void) const
537 {
538 return (mExtent == EXTENT_NULL);
539 }
540
543 bool isFinite(void) const
544 {
545 return (mExtent == EXTENT_FINITE);
546 }
547
550 inline void setInfinite()
551 {
552 mExtent = EXTENT_INFINITE;
553 }
554
557 bool isInfinite(void) const
558 {
559 return (mExtent == EXTENT_INFINITE);
560 }
561
563 inline bool intersects(const AxisAlignedBox& b2) const
564 {
565 // Early-fail for nulls
566 if (this->isNull() || b2.isNull())
567 return false;
568
569 // Early-success for infinites
570 if (this->isInfinite() || b2.isInfinite())
571 return true;
572
573 // Use up to 6 separating planes
574 if (mMaximum.x < b2.mMinimum.x)
575 return false;
576 if (mMaximum.y < b2.mMinimum.y)
577 return false;
578 if (mMaximum.z < b2.mMinimum.z)
579 return false;
580
581 if (mMinimum.x > b2.mMaximum.x)
582 return false;
583 if (mMinimum.y > b2.mMaximum.y)
584 return false;
585 if (mMinimum.z > b2.mMaximum.z)
586 return false;
587
588 // otherwise, must be intersecting
589 return true;
590
591 }
592
595 {
596 if (this->isNull() || b2.isNull())
597 {
598 return AxisAlignedBox();
599 }
600 else if (this->isInfinite())
601 {
602 return b2;
603 }
604 else if (b2.isInfinite())
605 {
606 return *this;
607 }
608
609 Vector3 intMin = mMinimum;
610 Vector3 intMax = mMaximum;
611
612 intMin.makeCeil(b2.getMinimum());
613 intMax.makeFloor(b2.getMaximum());
614
615 // Check intersection isn't null
616 if (intMin.x < intMax.x &&
617 intMin.y < intMax.y &&
618 intMin.z < intMax.z)
619 {
620 return AxisAlignedBox(intMin, intMax);
621 }
622
623 return AxisAlignedBox();
624 }
625
627 Real volume(void) const
628 {
629 switch (mExtent)
630 {
631 case EXTENT_NULL:
632 return 0.0f;
633
634 case EXTENT_FINITE:
635 {
636 Vector3 diff = mMaximum - mMinimum;
637 return diff.x * diff.y * diff.z;
638 }
639
640 case EXTENT_INFINITE:
641 return Math::POS_INFINITY;
642
643 default: // shut up compiler
644 assert( false && "Never reached" );
645 return 0.0f;
646 }
647 }
648
650 inline void scale(const Vector3& s)
651 {
652 // Do nothing if current null or infinite
653 if (mExtent != EXTENT_FINITE)
654 return;
655
656 // NB assumes centered on origin
657 Vector3 min = mMinimum * s;
658 Vector3 max = mMaximum * s;
659 setExtents(min, max);
660 }
661
663 bool intersects(const Sphere& s) const
664 {
665 return Math::intersects(s, *this);
666 }
668 bool intersects(const Plane& p) const
669 {
670 return Math::intersects(p, *this);
671 }
673 bool intersects(const Vector3& v) const
674 {
675 switch (mExtent)
676 {
677 case EXTENT_NULL:
678 return false;
679
680 case EXTENT_FINITE:
681 return(v.x >= mMinimum.x && v.x <= mMaximum.x &&
682 v.y >= mMinimum.y && v.y <= mMaximum.y &&
683 v.z >= mMinimum.z && v.z <= mMaximum.z);
684
685 case EXTENT_INFINITE:
686 return true;
687
688 default: // shut up compiler
689 assert( false && "Never reached" );
690 return false;
691 }
692 }
694 Vector3 getCenter(void) const
695 {
696 assert( (mExtent == EXTENT_FINITE) && "Can't get center of a null or infinite AAB" );
697
698 return Vector3(
699 (mMaximum.x + mMinimum.x) * 0.5f,
700 (mMaximum.y + mMinimum.y) * 0.5f,
701 (mMaximum.z + mMinimum.z) * 0.5f);
702 }
704 Vector3 getSize(void) const
705 {
706 switch (mExtent)
707 {
708 case EXTENT_NULL:
709 return Vector3::ZERO;
710
711 case EXTENT_FINITE:
712 return mMaximum - mMinimum;
713
714 case EXTENT_INFINITE:
715 return Vector3(
719
720 default: // shut up compiler
721 assert( false && "Never reached" );
722 return Vector3::ZERO;
723 }
724 }
727 {
728 switch (mExtent)
729 {
730 case EXTENT_NULL:
731 return Vector3::ZERO;
732
733 case EXTENT_FINITE:
734 return (mMaximum - mMinimum) * 0.5;
735
736 case EXTENT_INFINITE:
737 return Vector3(
741
742 default: // shut up compiler
743 assert( false && "Never reached" );
744 return Vector3::ZERO;
745 }
746 }
747
750 bool contains(const Vector3& v) const
751 {
752 if (isNull())
753 return false;
754 if (isInfinite())
755 return true;
756
757 return mMinimum.x <= v.x && v.x <= mMaximum.x &&
758 mMinimum.y <= v.y && v.y <= mMaximum.y &&
759 mMinimum.z <= v.z && v.z <= mMaximum.z;
760 }
761
765 {
766
767 if (this->contains(v))
768 return 0;
769 else
770 {
771 Vector3 maxDist(0,0,0);
772
773 if (v.x < mMinimum.x)
774 maxDist.x = mMinimum.x - v.x;
775 else if (v.x > mMaximum.x)
776 maxDist.x = v.x - mMaximum.x;
777
778 if (v.y < mMinimum.y)
779 maxDist.y = mMinimum.y - v.y;
780 else if (v.y > mMaximum.y)
781 maxDist.y = v.y - mMaximum.y;
782
783 if (v.z < mMinimum.z)
784 maxDist.z = mMinimum.z - v.z;
785 else if (v.z > mMaximum.z)
786 maxDist.z = v.z - mMaximum.z;
787
788 return maxDist.squaredLength();
789 }
790 }
791
793 Real distance (const Vector3& v) const
794 {
795 return Ogre::Math::Sqrt(squaredDistance(v));
796 }
797
800 bool contains(const AxisAlignedBox& other) const
801 {
802 if (other.isNull() || this->isInfinite())
803 return true;
804
805 if (this->isNull() || other.isInfinite())
806 return false;
807
808 return this->mMinimum.x <= other.mMinimum.x &&
809 this->mMinimum.y <= other.mMinimum.y &&
810 this->mMinimum.z <= other.mMinimum.z &&
811 other.mMaximum.x <= this->mMaximum.x &&
812 other.mMaximum.y <= this->mMaximum.y &&
813 other.mMaximum.z <= this->mMaximum.z;
814 }
815
818 bool operator== (const AxisAlignedBox& rhs) const
819 {
820 if (this->mExtent != rhs.mExtent)
821 return false;
822
823 if (!this->isFinite())
824 return true;
825
826 return this->mMinimum == rhs.mMinimum &&
827 this->mMaximum == rhs.mMaximum;
828 }
829
832 bool operator!= (const AxisAlignedBox& rhs) const
833 {
834 return !(*this == rhs);
835 }
836
837 // special values
840
841
842 };
843
846} // namespace Ogre
847
848#endif
#define _OgreExport
Definition: OgrePlatform.h:257
A 3D box aligned with the x/y/z axes.
bool intersects(const Vector3 &v) const
Tests whether the vector point is within this box.
void transformAffine(const Matrix4 &m)
Transforms the box according to the affine matrix supplied.
void setInfinite()
Sets the box to 'infinite'.
Vector3 & getMaximum(void)
Gets a modifiable version of the maximum corner of the box.
void setMaximumX(Real x)
Changes one of the components of the maximum corner of the box used to resize only one dimension of t...
bool isNull(void) const
Returns true if the box is null i.e.
void setExtents(Real mx, Real my, Real mz, Real Mx, Real My, Real Mz)
AxisAlignedBox & operator=(const AxisAlignedBox &rhs)
void setMinimumX(Real x)
Changes one of the components of the minimum corner of the box used to resize only one dimension of t...
AxisAlignedBox(const Vector3 &min, const Vector3 &max)
AxisAlignedBox(const AxisAlignedBox &rkBox)
Vector3 & getMinimum(void)
Gets a modifiable version of the minimum corner of the box.
static const AxisAlignedBox BOX_NULL
Real volume(void) const
Calculate the volume of this box.
void merge(const AxisAlignedBox &rhs)
Merges the passed in box into the current box.
bool intersects(const Sphere &s) const
Tests whether this box intersects a sphere.
void setExtents(const Vector3 &min, const Vector3 &max)
Sets both minimum and maximum extents at once.
Real squaredDistance(const Vector3 &v) const
Returns the squared minimum distance between a given point and any part of the box.
Vector3 getHalfSize(void) const
Gets the half-size of the box.
void setMaximum(const Vector3 &vec)
Sets the maximum corner of the box.
Vector3 getCenter(void) const
Gets the centre of the box.
const Vector3 & getMaximum(void) const
Gets the maximum corner of the box.
bool intersects(const AxisAlignedBox &b2) const
Returns whether or not this box intersects another.
Real distance(const Vector3 &v) const
Returns the minimum distance between a given point and any part of the box.
void setNull()
Sets the box to a 'null' value i.e.
AxisAlignedBox intersection(const AxisAlignedBox &b2) const
Calculate the area of intersection of this box and another.
const Vector3 * getAllCorners(void) const
Returns a pointer to an array of 8 corner points, useful for collision vs.
bool isInfinite(void) const
Returns true if the box is infinite.
const Vector3 & getMinimum(void) const
Gets the minimum corner of the box.
AxisAlignedBox(Real mx, Real my, Real mz, Real Mx, Real My, Real Mz)
bool intersects(const Plane &p) const
Tests whether this box intersects a plane.
void setMinimum(const Vector3 &vec)
Sets the minimum corner of the box.
static const AxisAlignedBox BOX_INFINITE
void scale(const Vector3 &s)
Scales the AABB by the vector given.
bool isFinite(void) const
Returns true if the box is finite.
bool contains(const Vector3 &v) const
Tests whether the given point contained by this box.
void transform(const Matrix4 &matrix)
Transforms the box according to the matrix supplied.
void setMaximum(Real x, Real y, Real z)
Vector3 getCorner(CornerEnum cornerToGet) const
Gets the position of one of the corners.
void setMinimum(Real x, Real y, Real z)
bool contains(const AxisAlignedBox &other) const
Tests whether another box contained by this box.
void merge(const Vector3 &point)
Extends the box to encompass the specified point (if needed).
Vector3 getSize(void) const
Gets the size of the box.
_OgreExport friend std::ostream & operator<<(std::ostream &o, const AxisAlignedBox &aab)
static std::pair< bool, Real > intersects(const Ray &ray, const Plane &plane)
Ray / plane intersection, returns boolean result and distance.
static const Real POS_INFINITY
Definition: OgreMath.h:704
static Real Sqrt(Real fValue)
Square root function.
Definition: OgreMath.h:405
static Real Abs(Real fValue)
Absolute value function.
Definition: OgreMath.h:258
Class encapsulating a standard 4x4 homogeneous matrix.
Definition: OgreMatrix4.h:79
bool isAffine(void) const
Check whether or not the matrix is affine matrix.
Definition: OgreMatrix4.h:572
Vector3 transformAffine(const Vector3 &v) const
3-D Vector transformation specially for an affine matrix.
Definition: OgreMatrix4.h:617
Defines a plane in 3D space.
Definition: OgrePlane.h:62
A sphere primitive, mostly used for bounds checking.
Definition: OgreSphere.h:52
Standard 3-dimensional vector.
Definition: OgreVector3.h:52
Real squaredLength() const
Returns the square of the length(magnitude) of the vector.
Definition: OgreVector3.h:371
static const Vector3 ZERO
Definition: OgreVector3.h:800
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:552
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:538
#define OGRE_ALLOC_T(T, count, category)
Allocate a block of memory for a primitive type, and indicate the category of usage.
bool operator!=(STLAllocator< T, P > const &, STLAllocator< T2, P > const &)
determine equality, can memory from another allocator be released by this allocator,...
bool operator==(STLAllocator< T, P > const &, STLAllocator< T2, P > const &)
determine equality, can memory from another allocator be released by this allocator,...
#define OGRE_FREE(ptr, category)
Free the memory allocated with OGRE_MALLOC or OGRE_ALLOC_T. Category is required to be restated to en...
@ MEMCATEGORY_SCENE_CONTROL
Nodes, control data.
float Real
Software floating point type.

Copyright © 2012 Torus Knot Software Ltd
Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.