00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040 #ifndef _OSGBOXVOLUME_H_
00041 #define _OSGBOXVOLUME_H_
00042
00043 #include "OSGConfig.h"
00044 #include "OSGVolume.h"
00045
00046 OSG_BEGIN_NAMESPACE
00047
00048 class BoxVolume;
00049
00050 OSG_BASE_DLLMAPPING
00051 bool operator ==(const BoxVolume &b1, const BoxVolume &b2);
00052
00053 inline
00054 bool operator !=(const BoxVolume &b1, const BoxVolume &b2);
00055
00056
00062 class OSG_BASE_DLLMAPPING BoxVolume : public Volume
00063 {
00064
00065
00066 public:
00067
00068
00072 BoxVolume(void);
00073
00074 BoxVolume(Real32 xmin, Real32 ymin, Real32 zmin,
00075 Real32 xmax, Real32 ymax, Real32 zmax);
00076
00077 BoxVolume(const Pnt3f &min,
00078 const Pnt3f &max);
00079 BoxVolume(const BoxVolume &obj);
00080
00082
00086 ~BoxVolume();
00087
00089
00093 const Pnt3f &getMin (void ) const;
00094 const Pnt3f &getMax (void ) const;
00095
00096 virtual void getCenter (Pnt3f ¢er ) const;
00097
00098 virtual Real32 getScalarVolume(void ) const;
00099
00100 virtual void getBounds (Pnt3f &min,
00101 Pnt3f &max ) const;
00102
00103
00104 void getBounds (Real32 &xmin,
00105 Real32 &ymin,
00106 Real32 &zmin,
00107 Real32 &xmax,
00108 Real32 &ymax,
00109 Real32 &zmax ) const;
00110
00111
00112 void getOrigin (Real32 &originX,
00113 Real32 &originY,
00114 Real32 &originZ) const;
00115 void getSize (Real32 &sizeX,
00116 Real32 &sizeY,
00117 Real32 &sizeZ ) const;
00118 void getSize (Vec3f &vec ) const;
00119
00121
00125 void setBounds( Real32 w, Real32 h, Real32 d );
00126 void setBounds( Real32 xmin, Real32 ymin, Real32 zmin,
00127 Real32 xmax, Real32 ymax, Real32 zmax);
00128 void setBounds(const Pnt3f &min, const Pnt3f &max );
00129
00130 void setBoundsByCenterAndSize ( const Pnt3f ¢er,
00131 const Vec3f &size );
00132
00134
00138 virtual void extendBy(const Pnt3f &pt );
00139 virtual void extendBy(const Volume &volume);
00140 void extendBy(const BoxVolume &bb );
00141
00143
00147 virtual bool intersect (const Pnt3f &point ) const;
00148 virtual bool intersect (const Line &line ) const;
00149 virtual bool intersect (const Line &line,
00150 Real32 &min,
00151 Real32 &max ) const;
00152 virtual bool intersect (const Volume &volume) const;
00153
00154 bool intersect (const BoxVolume &bb ) const;
00155
00156 virtual bool isOnSurface(const Pnt3f &point ) const;
00157
00159
00163 virtual void transform(const Matrix &m);
00164
00166
00170 friend OSG_BASE_DLLMAPPING
00171 bool operator ==(const BoxVolume &b1, const BoxVolume &b2);
00172
00173 const BoxVolume &operator =(const BoxVolume &b1);
00174
00176
00180 virtual void dump( UInt32 uiIndent = 0,
00181 const BitVector bvFlags = 0) const;
00182
00184
00185
00186 protected:
00187
00188
00189
00190 private:
00191
00192 Pnt3f _min;
00193 Pnt3f _max;
00194 };
00195
00196 OSG_END_NAMESPACE
00197
00198 #include <OSGBoxVolume.inl>
00199
00200 #endif // _OSGBOXVOLUME_H_