00001 /*---------------------------------------------------------------------------*\ 00002 * OpenSG * 00003 * * 00004 * * 00005 * Copyright (C) 2000-2002 by the OpenSG Forum * 00006 * * 00007 * www.opensg.org * 00008 * * 00009 * contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de * 00010 * * 00011 \*---------------------------------------------------------------------------*/ 00012 /*---------------------------------------------------------------------------*\ 00013 * License * 00014 * * 00015 * This library is free software; you can redistribute it and/or modify it * 00016 * under the terms of the GNU Library General Public License as published * 00017 * by the Free Software Foundation, version 2. * 00018 * * 00019 * This library is distributed in the hope that it will be useful, but * 00020 * WITHOUT ANY WARRANTY; without even the implied warranty of * 00021 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 00022 * Library General Public License for more details. * 00023 * * 00024 * You should have received a copy of the GNU Library General Public * 00025 * License along with this library; if not, write to the Free Software * 00026 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * 00027 * * 00028 \*---------------------------------------------------------------------------*/ 00029 /*---------------------------------------------------------------------------*\ 00030 * Changes * 00031 * * 00032 * * 00033 * * 00034 * * 00035 * * 00036 * * 00037 \*---------------------------------------------------------------------------*/ 00038 00039 #ifndef _OSGSPHEREVOLUME_H_ 00040 #define _OSGSPHEREVOLUME_H_ 00041 00042 #include <OSGVolume.h> 00043 00044 OSG_BEGIN_NAMESPACE 00045 00046 class Line; 00047 00053 class OSG_BASE_DLLMAPPING SphereVolume : public Volume 00054 { 00055 00056 /*========================== PUBLIC =================================*/ 00057 00058 public: 00059 00060 /*---------------------------------------------------------------------*/ 00064 SphereVolume(void); 00065 00066 SphereVolume(const SphereVolume &obj); 00067 SphereVolume(const Pnt3f &c, 00068 Real32 r ); 00069 00071 /*---------------------------------------------------------------------*/ 00075 ~SphereVolume(void); 00076 00078 /*---------------------------------------------------------------------*/ 00082 void setValue (const Pnt3f &c, 00083 Real32 r); 00084 void setCenter(const Pnt3f &c); 00085 void setRadius( Real32 r); 00086 00088 /*---------------------------------------------------------------------*/ 00092 const Pnt3f& getCenter (void ) const; 00093 Real32 getRadius (void ) const; 00094 00095 virtual void getCenter (Pnt3f ¢er) const; 00096 virtual Real32 getScalarVolume(void ) const; 00097 virtual void getBounds (Pnt3f &min, 00098 Pnt3f &max ) const; 00099 00101 /*---------------------------------------------------------------------*/ 00105 virtual void extendBy(const Pnt3f &pt ); 00106 virtual void extendBy(const Volume &volume); 00107 void extendBy(const SphereVolume &bb ); 00108 00110 /*---------------------------------------------------------------------*/ 00114 virtual bool intersect (const Pnt3f &point ) const; 00115 virtual bool intersect (const Line &line ) const; 00116 virtual bool intersect (const Line &line, 00117 Real32 &enter, 00118 Real32 &exit ) const; 00119 00120 virtual bool intersect (const Volume &volume) const; 00121 bool intersect (const SphereVolume &sphere) const; 00122 00123 virtual bool isOnSurface(const Pnt3f &point ) const; 00124 00126 /*---------------------------------------------------------------------*/ 00130 virtual void transform(const Matrix &mat); 00131 00133 /*---------------------------------------------------------------------*/ 00137 virtual void dump( UInt32 uiIndent = 0, 00138 const BitVector bvFlags = 0) const; 00140 /*========================== PRIVATE ================================*/ 00141 00142 private: 00143 00144 Pnt3f _center; 00145 Real32 _radius; 00146 00147 }; 00148 00149 OSG_END_NAMESPACE 00150 00151 #include <OSGSphereVolume.inl> 00152 00153 #endif // _OSGSPHEREVOLUME_H_
1.4.3