00001 /*========================================================================= 00002 UberSim Source Code Release 00003 ------------------------------------------------------------------------- 00004 Copyright (C) 2002 Manuela Veloso, Brett Browning, Mike Bowling, 00005 James Bruce; {mmv, brettb, mhb, jbruce}@cs.cmu.edu 00006 Erick Tryzelaar {erickt}@andrew.cmu.edu 00007 School of Computer Science, Carnegie Mellon University 00008 ------------------------------------------------------------------------- 00009 This software is distributed under the GNU General Public License, 00010 version 2. If you do not have a copy of this licence, visit 00011 www.gnu.org, or write: Free Software Foundation, 59 Temple Place, 00012 Suite 330 Boston, MA 02111-1307 USA. This program is distributed 00013 in the hope that it will be useful, but WITHOUT ANY WARRANTY, 00014 including MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00015 -------------------------------------------------------------------------*/ 00016 00017 #ifndef __SIM_BOUNDINGSPHERE_H__ 00018 #define __SIM_BOUNDINGSPHERE_H__ 00019 00020 #include "Vector3.h" 00021 #include "Matrix33.h" 00027 class BoundingSphere 00028 { 00029 public: 00030 BoundingSphere (); 00031 BoundingSphere (const Vector3& center, const Real radius); 00032 BoundingSphere (const BoundingSphere& bound); 00033 virtual ~BoundingSphere (); 00034 00035 public: 00036 Vector3& getCenter (); 00037 Real& getRadius (); 00038 00039 void setCenter (const Vector3& center); 00040 void setRadius (const Real radius); 00041 00042 public: 00043 void operator += (const BoundingSphere& bound); 00044 00045 public: 00046 bool isCollidingWith (BoundingSphere& bound); 00047 00048 BoundingSphere transformBy (Real scale, Matrix33& rotation, Vector3& translation); 00049 00050 protected: 00051 Vector3 center; 00052 Real radius; 00053 }; 00054 00055 #endif // __BOUNDINGVOLUME_H__