OGRE  2.0
Object-Oriented Graphics Rendering Engine
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
C/OgreAabb.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-2014 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 __C_Aabb_H__
29 #define __C_Aabb_H__
30 
31 #ifndef __Aabb_H__
32  #error "Don't include this file directly. include Math/Simple/OgreAabb.h"
33 #endif
34 
35 #include "OgreVector3.h"
36 #include "OgreMatrix4.h"
37 
38 namespace Ogre
39 {
79  {
82 
83  Aabb() :
84  mCenter( Vector3::ZERO ),
85  mHalfSize( Vector3::ZERO )
86  {
87  }
88  /*Aabb( const AxisAlignedBox &aab ) :
89  mCenter( aab.getCenter() ),
90  m_index( aab.getHalfSize() )
91  {
92  }*/
93  Aabb( const Vector3 &center, const Vector3 &halfSize ) :
94  mCenter( center ),
95  mHalfSize( halfSize )
96  {
97  }
98 
100  inline void setExtents( const Vector3& min, const Vector3& max );
101 
103  inline static Aabb newFromExtents( const Vector3& min, const Vector3& max );
104 
106  inline Vector3 getMinimum() const;
107 
109  inline Vector3 getMaximum() const;
110 
112  inline Vector3 getSize(void) const;
113 
117  inline void merge( const Aabb& rhs );
118 
120  inline void merge( const Vector3& points );
121 
133  inline void transformAffine( const Matrix4 &matrix );
134 
136  inline bool intersects( const Aabb& b2 ) const;
137 
139  inline Aabb intersection( const Aabb& b2 ) const;
140 
142  inline Real volume(void) const;
143 
145  inline bool contains( const Aabb &other ) const;
146 
148  inline bool contains( const Vector3 &v ) const;
149 
151  inline Real distance( const Vector3 &v ) const;
152 
154  inline Real getRadius() const;
155 
157  inline Real getRadiusOrigin() const;
158 
159  static const Aabb BOX_INFINITE;
160  static const Aabb BOX_NULL;
161 
162  //Contains all zeroes. Used for inactive objects to avoid causing unnecessary NaNs
163  static const Aabb BOX_ZERO;
164  };
168 }
169 
170 #include "OgreAabb.inl"
171 
172 #endif
static const Aabb BOX_ZERO
Definition: C/OgreAabb.h:163
Class encapsulating a standard 4x4 homogeneous matrix.
Definition: OgreMatrix4.h:79
float Real
Software floating point type.
#define _OgreExport
Definition: OgrePlatform.h:255
Ogre::Vector3 mHalfSize
Definition: C/OgreAabb.h:81
const float & max(const float &a, const float &b)
Definition: OgreCommon.h:851
static const Aabb BOX_INFINITE
Definition: C/OgreAabb.h:159
Aabb(const Vector3 &center, const Vector3 &halfSize)
Definition: C/OgreAabb.h:93
AoS (array of structures) version of ArrayAabb.
Definition: C/OgreAabb.h:78
const float & min(const float &a, const float &b)
Definition: OgreCommon.h:846
Ogre::Vector3 mCenter
Definition: C/OgreAabb.h:80
Standard 3-dimensional vector.
Definition: OgreVector3.h:50
static const Aabb BOX_NULL
Definition: C/OgreAabb.h:160