2010-09-09 19:41:14 +00:00
/********************************************************************************
* ReactPhysics3D physics library , http : //code.google.com/p/reactphysics3d/ *
* Copyright ( c ) 2010 Daniel Chappuis *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* *
* Permission is hereby granted , free of charge , to any person obtaining a copy *
* of this software and associated documentation files ( the " Software " ) , to deal *
* in the Software without restriction , including without limitation the rights *
* to use , copy , modify , merge , publish , distribute , sublicense , and / or sell *
* copies of the Software , and to permit persons to whom the Software is *
* furnished to do so , subject to the following conditions : *
* *
* The above copyright notice and this permission notice shall be included in *
* all copies or substantial portions of the Software . *
* *
* THE SOFTWARE IS PROVIDED " AS IS " , WITHOUT WARRANTY OF ANY KIND , EXPRESS OR *
* IMPLIED , INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY , *
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT . IN NO EVENT SHALL THE *
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM , DAMAGES OR OTHER *
* LIABILITY , WHETHER IN AN ACTION OF CONTRACT , TORT OR OTHERWISE , ARISING FROM , *
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN *
* THE SOFTWARE . *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2009-07-02 20:43:55 +00:00
# ifndef BOUNDING_VOLUME_H
# define BOUNDING_VOLUME_H
2009-07-21 20:29:03 +00:00
// Libraries
# include "Body.h"
2010-08-05 15:06:34 +00:00
# include "../mathematics/mathematics.h"
2009-11-22 13:46:23 +00:00
# include <cassert>
2009-07-21 20:29:03 +00:00
2010-08-05 15:06:34 +00:00
2009-07-02 20:43:55 +00:00
// ReactPhysics3D namespace
namespace reactphysics3d {
/* -------------------------------------------------------------------
Class BoundingVolume :
This class represents the volume that contains a rigid body .
This volume will be used to compute the collisions with others
bodies .
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
*/
class BoundingVolume {
2009-11-22 13:46:23 +00:00
protected :
2010-09-01 16:37:13 +00:00
Body * body ; // Pointer to the body
2009-07-02 20:43:55 +00:00
public :
2010-02-05 14:39:15 +00:00
BoundingVolume ( ) ; // Constructor
virtual ~ BoundingVolume ( ) ; // Destructor
2009-07-21 20:29:03 +00:00
2010-02-05 14:39:15 +00:00
Body * getBodyPointer ( ) const ; // Return the body pointer
void setBodyPointer ( Body * body ) ; // Set the body pointer
2009-07-21 20:29:03 +00:00
2010-08-05 15:06:34 +00:00
virtual void update ( const Vector3D & newCenter , const Quaternion & rotationQuaternion ) = 0 ; // Update the orientation of the bounding volume according to the new orientation of the body
virtual void draw ( ) const = 0 ; // Display the bounding volume (only for testing purpose)
2009-07-02 20:43:55 +00:00
} ;
2009-07-21 20:29:03 +00:00
// Return the body pointer
inline Body * BoundingVolume : : getBodyPointer ( ) const {
2009-11-22 13:46:23 +00:00
assert ( body ! = 0 ) ;
2009-07-21 20:29:03 +00:00
return body ;
}
// Set the body pointer
2010-02-05 14:39:15 +00:00
inline void BoundingVolume : : setBodyPointer ( Body * bodyPointer ) {
this - > body = bodyPointer ;
2009-07-21 20:29:03 +00:00
}
2009-07-02 20:43:55 +00:00
} // End of the ReactPhysics3D namespace
# endif