00001 /*---------------------------------------------------------------------------*\ 00002 * OpenSG * 00003 * * 00004 * * 00005 * Copyright (C) 2000 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 _OSG_POLYTOPEVOLUME_H_ 00041 #define _OSG_POLYTOPEVOLUME_H_ 00042 00043 #include <OSGConfig.h> 00044 #include <OSGBase.h> 00045 #include <OSGVolume.h> 00046 #include <OSGPlane.h> 00047 #include <OSGMatrix.h> 00048 00049 OSG_BEGIN_NAMESPACE 00050 00057 class OSG_BASE_DLLMAPPING PolytopeVolume : public Volume 00058 { 00059 /*========================== PUBLIC =================================*/ 00060 public: 00061 00062 /*---------------------------------------------------------------------*/ 00066 PolytopeVolume ( ); 00067 PolytopeVolume ( const UInt16& ); 00068 PolytopeVolume ( const PolytopeVolume &obj ); 00069 00071 /*---------------------------------------------------------------------*/ 00075 inline ~PolytopeVolume(); 00076 00078 /*---------------------------------------------------------------------*/ 00082 const Plane & getNear (void ) const; 00083 const Plane * getPlanes (void ); 00084 const Plane * getPlanes (void ) const; 00085 virtual void getCenter (Pnt3f ¢er ) const; 00086 virtual Real32 getScalarVolume (void ) const; 00087 virtual void getBounds ( Pnt3f &minPnt, 00088 Pnt3f &maxPnt ) const; 00089 00091 /*---------------------------------------------------------------------*/ 00095 void setPlane(const Plane&, const UInt16); 00096 00098 /*---------------------------------------------------------------------*/ 00102 virtual void extendBy (const Pnt3f &pt ); 00103 void extendBy (const Volume &volume ); 00104 void extendBy (const PolytopeVolume &bb ); 00105 00107 /*---------------------------------------------------------------------*/ 00111 bool intersect (const Pnt3f &point ) const; 00112 bool intersect (const Line &line ) const; 00113 bool intersect (const Line &line, 00114 Real32 &minDist, 00115 Real32 &maxDist ) const; 00116 00117 bool intersect (const Volume &volume ) const; 00118 bool intersect (const PolytopeVolume &bb ) const; 00119 virtual bool isOnSurface (const Pnt3f &point ) const; 00120 00121 00123 /*---------------------------------------------------------------------*/ 00127 virtual void transform (const Matrix &m ); 00128 00130 /*---------------------------------------------------------------------*/ 00134 const PolytopeVolume &operator =(const PolytopeVolume &b1); 00135 00137 /*---------------------------------------------------------------------*/ 00142 virtual void dump( UInt32 uiIndent = 0, 00143 const BitVector bvFlags = 0) const; 00144 00147 /*========================== PRIVATE ================================*/ 00148 private: 00149 00150 UInt16 _numPlanes; 00151 Plane* _planes; 00152 }; 00153 00154 typedef PolytopeVolume* PolytopeVolumePtr; 00155 00156 OSG_BASE_DLLMAPPING 00157 bool operator ==(const PolytopeVolume &b1, const PolytopeVolume &b2); 00158 00159 inline 00160 bool operator !=(const PolytopeVolume &b1, const PolytopeVolume &b2); 00161 00162 OSG_END_NAMESPACE 00163 00164 #include <OSGPolytopeVolume.inl> 00165 00166 #endif /* _OSG_POLYTOPEVOLUME_H_ */
1.5.5