1 /*---------------------------------------------------------------------------*\
5 * Copyright 2000 by OpenSG Forum *
7 * contact: {reiners|vossg}@igd.fhg.de, jbehr@zgdv.de *
9 \*---------------------------------------------------------------------------*/
10 /*---------------------------------------------------------------------------*\
17 \*---------------------------------------------------------------------------*/
18 /*---------------------------------------------------------------------------*\
26 \*---------------------------------------------------------------------------*/
28 #ifndef _OSGBOXVOLUME_INL_
29 #define _OSGBOXVOLUME_INL_
33 /*! Default constructor - leaves box totally empty
37 BoxVolume::BoxVolume(void) :
46 BoxVolume::BoxVolume(Real32 xmin, Real32 ymin, Real32 zmin,
47 Real32 xmax, Real32 ymax, Real32 zmax) :
49 _min (xmin, ymin, zmin),
50 _max (xmax, ymax, zmax)
57 BoxVolume::BoxVolume(const Pnt3f &min, const Pnt3f &max) :
67 BoxVolume::BoxVolume(const BoxVolume &obj) :
76 BoxVolume::~BoxVolume(void)
82 const Pnt3f &BoxVolume::getMin(void) const
89 const Pnt3f &BoxVolume::getMax(void) const
96 void BoxVolume::getBounds(Real32 &xmin,
103 _min.getSeparateValues(xmin, ymin, zmin);
104 _max.getSeparateValues(xmax, ymax, zmax);
109 void BoxVolume::getOrigin(Real32 &originX,
111 Real32 &originZ) const
120 void BoxVolume::getSize(Real32 &sizeX,
124 sizeX = _max[0] - _min[0];
125 sizeY = _max[1] - _min[1];
126 sizeZ = _max[2] - _min[2];
131 void BoxVolume::getSize(Vec3f &vec) const
133 vec.setValues(_max[0] - _min[0], _max[1] - _min[1], _max[2] - _min[2]);
138 void BoxVolume::setBounds(Real32 w, Real32 h, Real32 d)
140 _min.setValues(-w / 2.0f, -h / 2.0f, -d / 2.0f);
141 _max.setValues( w / 2.0f, h / 2.0f, d / 2.0f);
143 Volume::setValid (true );
144 Volume::setEmpty (false);
145 Volume::setInfinite(false);
150 void BoxVolume::setBounds(Real32 xmin,
157 _min.setValues(xmin, ymin, zmin);
158 _max.setValues(xmax, ymax, zmax);
160 Volume::setValid (true );
161 Volume::setEmpty (false);
162 Volume::setInfinite(false);
167 void BoxVolume::setBounds(const Pnt3f &min, const Pnt3f &max)
172 Volume::setValid (true );
173 Volume::setEmpty (false);
174 Volume::setInfinite(false);
178 Pnt3f &BoxVolume::editMin(void)
185 Pnt3f &BoxVolume::editMax(void)
191 void BoxVolume::extendBy(const BoxVolume &volume)
193 OSG::extend(*this, volume);
198 bool BoxVolume::operator !=(const BoxVolume &rhs) const
200 return !(*this == rhs);
205 #endif // _OSG_BOXVOLUME_INL_