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 #ifndef _OSGBOXVOLUME_INL_
00029 #define _OSGBOXVOLUME_INL_
00030
00031 #include "OSGConfig.h"
00032 #include "OSGVolume.h"
00033
00034 OSG_BEGIN_NAMESPACE
00035
00039 inline
00040 BoxVolume::BoxVolume(void) :
00041 Volume()
00042 {
00043 }
00044
00045
00046 inline
00047 BoxVolume::BoxVolume(Real32 xmin, Real32 ymin, Real32 zmin,
00048 Real32 xmax, Real32 ymax, Real32 zmax) :
00049 Volume( ),
00050 _min (xmin, ymin, zmin),
00051 _max (xmax, ymax, zmax)
00052 {
00053 setEmpty(false);
00054 }
00055
00056
00057 inline
00058 BoxVolume::BoxVolume(const Pnt3f &min, const Pnt3f &max) :
00059 Volume( ),
00060 _min (min),
00061 _max (max)
00062 {
00063 setEmpty(false);
00064 }
00065
00066
00067 inline
00068 BoxVolume::BoxVolume(const BoxVolume &obj) :
00069 Volume(obj ),
00070 _min (obj._min),
00071 _max (obj._max)
00072 {
00073 }
00074
00075
00076 inline
00077 BoxVolume::~BoxVolume(void)
00078 {
00079 }
00080
00081
00082 inline
00083 const Pnt3f &BoxVolume::getMin(void) const
00084 {
00085 return _min;
00086 }
00087
00088
00089 inline
00090 const Pnt3f &BoxVolume::getMax(void) const
00091 {
00092 return _max;
00093 }
00094
00095
00096 inline
00097 void BoxVolume::getBounds(Real32 &xmin, Real32 &ymin, Real32 &zmin,
00098 Real32 &xmax, Real32 &ymax, Real32 &zmax) const
00099 {
00100 _min.getSeparateValues(xmin, ymin, zmin);
00101 _max.getSeparateValues(xmax, ymax, zmax);
00102 }
00103
00104
00105 inline
00106 void BoxVolume::getOrigin(Real32 &originX,
00107 Real32 &originY,
00108 Real32 &originZ) const
00109 {
00110 originX = _min[0];
00111 originY = _min[1];
00112 originZ = _min[2];
00113 }
00114
00115
00116 inline
00117 void BoxVolume::getSize(Real32 &sizeX, Real32 &sizeY, Real32 &sizeZ) const
00118 {
00119 sizeX = _max[0] - _min[0];
00120 sizeY = _max[1] - _min[1];
00121 sizeZ = _max[2] - _min[2];
00122 }
00123
00124
00125 inline
00126 void BoxVolume::getSize(Vec3f &vec) const
00127 {
00128 vec.setValues(_max[0] - _min[0], _max[1] - _min[1], _max[2] - _min[2]);
00129 }
00130
00131
00132 inline
00133 void BoxVolume::setBounds(Real32 w, Real32 h, Real32 d)
00134 {
00135 _min.setValues(-w / 2.0f, -h / 2.0f, -d / 2.0f);
00136 _max.setValues( w / 2.0f, h / 2.0f, d / 2.0f);
00137
00138 Volume::setValid (true );
00139 Volume::setEmpty (false);
00140 Volume::setInfinite(false);
00141 }
00142
00143
00144 inline
00145 void BoxVolume::setBounds(Real32 xmin, Real32 ymin, Real32 zmin,
00146 Real32 xmax, Real32 ymax, Real32 zmax)
00147 {
00148 _min.setValues(xmin, ymin, zmin);
00149 _max.setValues(xmax, ymax, zmax);
00150
00151 Volume::setValid (true );
00152 Volume::setEmpty (false);
00153 Volume::setInfinite(false);
00154 }
00155
00156
00157 inline
00158 void BoxVolume::setBounds(const Pnt3f &min, const Pnt3f &max)
00159 {
00160 _min = min;
00161 _max = max;
00162
00163 Volume::setValid (true );
00164 Volume::setEmpty (false);
00165 Volume::setInfinite(false);
00166 }
00167
00168
00169 inline
00170 void BoxVolume::extendBy(const BoxVolume &volume)
00171 {
00172 OSG::extend(*this, volume);
00173 }
00174
00175
00176 inline
00177 bool operator !=(const BoxVolume &b1, const BoxVolume &b2)
00178 {
00179 return !(b1 == b2);
00180 }
00181
00182 OSG_END_NAMESPACE
00183
00184 #endif // _OSG_BOXVOLUME_INL_