Home | nevrax.com |
|
bounding_sphere.hGo to the documentation of this file.00001 00007 /* Copyright, 2000, 2001 Nevrax Ltd. 00008 * 00009 * This file is part of NEVRAX NEL. 00010 * NEVRAX NEL is free software; you can redistribute it and/or modify 00011 * it under the terms of the GNU General Public License as published by 00012 * the Free Software Foundation; either version 2, or (at your option) 00013 * any later version. 00014 00015 * NEVRAX NEL is distributed in the hope that it will be useful, but 00016 * WITHOUT ANY WARRANTY; without even the implied warranty of 00017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00018 * General Public License for more details. 00019 00020 * You should have received a copy of the GNU General Public License 00021 * along with NEVRAX NEL; see the file COPYING. If not, write to the 00022 * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, 00023 * MA 02111-1307, USA. 00024 */ 00025 00026 #ifndef NL_BOUNDING_SPHERE_H 00027 #define NL_BOUNDING_SPHERE_H 00028 00029 #include "nel/misc/types_nl.h" 00030 #include "nel/misc/bsphere.h" 00031 #include "bounding_shape.h" 00032 00033 00034 namespace NLSOUND { 00035 00036 00044 class CBoundingSphere : public IBoundingShape 00045 { 00046 public: 00047 00049 static void init() 00050 { 00051 NLMISC_REGISTER_CLASS(CBoundingSphere); 00052 } 00053 00054 00056 virtual bool include( const NLMISC::CVector& pos ) const; 00058 virtual float getDiameter() const { return _BSphere.Radius*2.0f; } 00060 virtual float getRadiusAtIntersect( const NLMISC::CVector& ) const { return _BSphere.Radius; } 00062 virtual const NLMISC::CVector& getCenter() const { return _BSphere.Center; } 00064 virtual void setCenter( const NLMISC::CVector& pos ) { _BSphere.Center = pos; } 00071 virtual float getRatio( const NLMISC::CVector& pos, IBoundingShape *inner ) const; 00073 virtual void serial( NLMISC::IStream& s ) { s.serial( _BSphere.Center ); s.serial( _BSphere.Radius ); } 00074 NLMISC_DECLARE_CLASS(CBoundingSphere); 00075 00076 00078 void setProperties( const NLMISC::CVector& center, float radius ); 00080 NLMISC::CBSphere *getSphere() { return &_BSphere; } 00081 00082 private: 00083 00084 NLMISC::CBSphere _BSphere; 00085 }; 00086 00087 00088 } // NLSOUND 00089 00090 00091 #endif // NL_BOUNDING_SPHERE_H 00092 00093 /* End of bounding_sphere.h */ |