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 /*---------------------------------------------------------------------------*\ 00031 * Changes * 00032 * * 00033 * * 00034 * * 00035 * * 00036 * * 00037 * * 00038 \*---------------------------------------------------------------------------*/ 00039 00040 #ifndef _OSGCYLINDERVOLUME_H_ 00041 #define _OSGCYLINDERVOLUME_H_ 00042 00043 #include "OSGLine.h" 00044 #include "OSGVolume.h" 00045 #include "OSGVector.h" 00046 00047 OSG_BEGIN_NAMESPACE 00048 00054 class OSG_BASE_DLLMAPPING CylinderVolume : public Volume 00055 { 00056 /*========================== PUBLIC =================================*/ 00057 00058 public: 00059 00060 /*---------------------------------------------------------------------*/ 00064 CylinderVolume(void); 00065 00066 CylinderVolume(const Pnt3f &p, 00067 const Vec3f &d, 00068 Real32 r); 00069 CylinderVolume(const CylinderVolume &c); 00070 00072 /*---------------------------------------------------------------------*/ 00076 ~CylinderVolume(void); 00077 00079 /*---------------------------------------------------------------------*/ 00083 void getAxis (Pnt3f &apos, Vec3f &adir) const; 00084 Real32 getRadius (void ) const; 00085 00086 virtual void getCenter (Pnt3f ¢er ) const; 00087 virtual Real32 getScalarVolume(void ) const; 00088 virtual void getBounds (Pnt3f &min, Pnt3f &max ) const; 00089 00091 /*---------------------------------------------------------------------*/ 00095 void setValue (const Pnt3f &p, const Vec3f &d, Real32 r); 00096 void setAxis (const Pnt3f &p, const Vec3f &d ); 00097 void setRadius( Real32 r ); 00098 00100 /*---------------------------------------------------------------------*/ 00104 virtual void extendBy(const Pnt3f &pt ); 00105 virtual void extendBy(const Volume &volume); 00106 00107 void extendBy(const CylinderVolume &obj ); 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 CylinderVolume &volume) const; 00122 virtual bool isOnSurface(const Pnt3f &point ) const; 00123 00125 /*---------------------------------------------------------------------*/ 00129 virtual void transform(const Matrix &mat); 00130 00132 /*---------------------------------------------------------------------*/ 00136 virtual void dump( UInt32 uiIndent = 0, 00137 const BitVector bvFlags = 0) const; 00138 00140 /*========================= PROTECTED ===============================*/ 00141 00142 protected: 00143 00144 /*========================== PRIVATE ================================*/ 00145 00146 private: 00147 00148 Pnt3f _axisPos; 00149 Vec3f _axisDir; 00150 Real32 _radius; 00151 00152 }; 00153 00154 OSG_END_NAMESPACE 00155 00156 #include <OSGCylinderVolume.inl> 00157 00158 #endif // _OSGCYLINDERVOLUME_H_
1.4.3