#include <OSGBoxVolume.h>
Inheritance diagram for osg::BoxVolume:

Operators | |
| const BoxVolume & | operator= (const BoxVolume &b1) |
| Assignment operator. | |
| *friend bool | operator== (const BoxVolume &b1, const BoxVolume &b2) |
| Equality comparisons. | |
Public Member Functions | |
| bool | operator== (const Volume &other) const |
| bool | operator!= (const Volume &other) const |
Constructors | |
| * | BoxVolume (void) |
| BoxVolume (Real32 xmin, Real32 ymin, Real32 zmin, Real32 xmax, Real32 ymax, Real32 zmax) | |
| BoxVolume (const Pnt3f &min, const Pnt3f &max) | |
| BoxVolume (const BoxVolume &obj) | |
Destructors | |
| * | ~BoxVolume () |
Get | |
| *const Pnt3f & | getMin (void) const |
| const Pnt3f & | getMax (void) const |
| virtual void | getCenter (Pnt3f ¢er) const |
| Returns the center of a box. | |
| virtual Real32 | getScalarVolume (void) const |
| Gives the volume of the box (0 for an empty box). | |
| virtual void | getBounds (Pnt3f &min, Pnt3f &max) const |
| void | getBounds (Real32 &xmin, Real32 &ymin, Real32 &zmin, Real32 &xmax, Real32 &ymax, Real32 &zmax) const |
| void | getOrigin (Real32 &originX, Real32 &originY, Real32 &originZ) const |
| void | getSize (Real32 &sizeX, Real32 &sizeY, Real32 &sizeZ) const |
| void | getSize (Vec3f &vec) const |
Set | |
| *void | setBounds (Real32 w, Real32 h, Real32 d) |
| void | setBounds (Real32 xmin, Real32 ymin, Real32 zmin, Real32 xmax, Real32 ymax, Real32 zmax) |
| void | setBounds (const Pnt3f &min, const Pnt3f &max) |
| void | setBoundsByCenterAndSize (const Pnt3f ¢er, const Vec3f &size) |
| set method | |
Extend | |
| *virtual void | extendBy (const Pnt3f &pt) |
| Extends Box3f (if necessary) to contain given 3D point. | |
| virtual void | extendBy (const Volume &volume) |
| Extends Box3f (if necessary) to contain given 3D point. | |
| void | extendBy (const BoxVolume &bb) |
| Extends Box3f (if necessary) to contain given 3D point. | |
Intersect | |
| *virtual bool | intersect (const Pnt3f &point) const |
| Returns true if intersection of given point and Box3f is not empty. | |
| virtual bool | intersect (const Line &line) const |
| virtual bool | intersect (const Line &line, Real32 &min, Real32 &max) const |
| virtual bool | intersect (const Volume &volume) const |
| Returns true if intersection of given point and Box3f is not empty. | |
| bool | intersect (const BoxVolume &bb) const |
| Returns true if intersection of given point and Box3f is not empty. | |
| virtual bool | isOnSurface (const Pnt3f &point) const |
| Returns true if intersection of given point and Box3f is not empty. | |
Transform | |
| *virtual void | transform (const Matrix &m) |
| Transforms Box3f by matrix, enlarging Box3f to contain result. | |
Output | |
| *virtual void | dump (UInt32 uiIndent=0, const BitVector bvFlags=0) const |
| print the volume | |
State | |
| *void | setValid (const bool value=true) |
| bool | isValid (void) const |
| void | setEmpty (const bool value=true) |
| bool | isEmpty (void) const |
| void | setStatic (const bool value=true) |
| bool | isStatic (void) const |
| void | setInfinite (const bool value=true) |
| bool | isInfinite (void) const |
| bool | isUntouchable (void) const |
| UInt16 | getState (void) const |
| void | setState (UInt16 state) |
Protected Attributes | |
| UInt16 | _state |
Private Attributes | |
| Pnt3f | _min |
| Pnt3f | _max |
Definition at line 62 of file OSGBoxVolume.h.
|
|
Default constructor - leaves box totally empty Definition at line 40 of file OSGBoxVolume.inl. 00040 : 00041 Volume() 00042 { 00043 }
|
|
||||||||||||||||||||||||||||
|
Default constructor - leaves box totally empty Definition at line 47 of file OSGBoxVolume.inl. References osg::Volume::setEmpty(). 00048 : 00049 Volume( ), 00050 _min (xmin, ymin, zmin), 00051 _max (xmax, ymax, zmax) 00052 { 00053 setEmpty(false); 00054 }
|
|
||||||||||||
|
Default constructor - leaves box totally empty Definition at line 58 of file OSGBoxVolume.inl. References osg::Volume::setEmpty().
|
|
|
Default constructor - leaves box totally empty Definition at line 68 of file OSGBoxVolume.inl.
|
|
|
Definition at line 77 of file OSGBoxVolume.inl.
|
|
|
Return the lowest point of the volume. Just a convience wrapper for getBounds() Reimplemented from osg::Volume. Definition at line 83 of file OSGBoxVolume.inl. References _min. Referenced by osg::FieldDataTraits< DynamicVolume >::copyToBin(), and osg::ParticleBSPTree::doBuild(). 00084 { 00085 return _min; 00086 }
|
|
|
Return the highest point of the volume. Just a convience wrapper for getBounds() Reimplemented from osg::Volume. Definition at line 90 of file OSGBoxVolume.inl. References _max. Referenced by osg::FieldDataTraits< DynamicVolume >::copyToBin(), and osg::ParticleBSPTree::doBuild(). 00091 { 00092 return _max; 00093 }
|
|
|
Implements osg::Volume. Definition at line 69 of file OSGBoxVolume.cpp. References _max, _min, osg::Volume::isEmpty(), and osg::VecStorage3< ValueTypeT >::setValues(). 00070 { 00071 if(isEmpty() == true) 00072 { 00073 center.setValues(0.0f, 0.0f, 0.0f); 00074 } 00075 else 00076 { 00077 center = _min + (_max - _min) * .5f; 00078 } 00079 }
|
|
|
Implements osg::Volume. Definition at line 83 of file OSGBoxVolume.cpp. References _max, _min, and osg::Volume::isEmpty(). 00084 { 00085 return (isEmpty() == true) ? 0.0f : (_max[0] - _min[0]) * 00086 (_max[1] - _min[1]) * 00087 (_max[2] - _min[2]); 00088 }
|
|
||||||||||||
|
Implements osg::Volume. Definition at line 91 of file OSGBoxVolume.cpp. Referenced by osg::drawVolume(), and osg::Line::intersect().
|
|
||||||||||||||||||||||||||||
|
Definition at line 97 of file OSGBoxVolume.inl. References _max, _min, and osg::VecStorage3< ValueTypeT >::getSeparateValues(). 00099 { 00100 _min.getSeparateValues(xmin, ymin, zmin); 00101 _max.getSeparateValues(xmax, ymax, zmax); 00102 }
|
|
||||||||||||||||
|
Definition at line 106 of file OSGBoxVolume.inl. References _min.
|
|
||||||||||||||||
|
Definition at line 117 of file OSGBoxVolume.inl. 00118 { 00119 sizeX = _max[0] - _min[0]; 00120 sizeY = _max[1] - _min[1]; 00121 sizeZ = _max[2] - _min[2]; 00122 }
|
|
|
Definition at line 126 of file OSGBoxVolume.inl. References _max, _min, and osg::VecStorage3< ValueTypeT >::setValues().
|
|
||||||||||||||||
|
Definition at line 133 of file OSGBoxVolume.inl. References _max, _min, osg::Volume::setEmpty(), osg::Volume::setInfinite(), osg::Volume::setValid(), and osg::VecStorage3< ValueTypeT >::setValues(). Referenced by osg::FieldDataTraits< DynamicVolume >::copyFromBin(), osg::FieldDataTraits< DynamicVolume >::getFromString(), and osg::DynamicVolume::morphToType(). 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 }
|
|
||||||||||||||||||||||||||||
|
Definition at line 145 of file OSGBoxVolume.inl. References _max, _min, osg::Volume::setEmpty(), osg::Volume::setInfinite(), osg::Volume::setValid(), and osg::VecStorage3< ValueTypeT >::setValues(). 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 }
|
|
||||||||||||
|
Definition at line 158 of file OSGBoxVolume.inl. References _max, _min, osg::Volume::setEmpty(), osg::Volume::setInfinite(), and osg::Volume::setValid(). 00159 { 00160 _min = min; 00161 _max = max; 00162 00163 Volume::setValid (true ); 00164 Volume::setEmpty (false); 00165 Volume::setInfinite(false); 00166 }
|
|
||||||||||||
|
Definition at line 99 of file OSGBoxVolume.cpp. References _max, _min, osg::Volume::setEmpty(), osg::Volume::setInfinite(), osg::Volume::setValid(), osg::VecStorage3< ValueTypeT >::setValues(), osg::VecStorage3< ValueTypeT >::x(), osg::VecStorage3< ValueTypeT >::y(), and osg::VecStorage3< ValueTypeT >::z(). 00101 { 00102 _min.setValues(center.x() - size.x() / 2.0f, 00103 center.y() - size.y() / 2.0f, 00104 center.z() - size.z() / 2.0f); 00105 _max.setValues(center.x() + size.x() / 2.0f, 00106 center.y() + size.y() / 2.0f, 00107 center.z() + size.z() / 2.0f); 00108 00109 Volume::setValid (true); 00110 Volume::setEmpty (false); 00111 Volume::setInfinite(true); 00112 }
|
|
|
Implements osg::Volume. Definition at line 119 of file OSGBoxVolume.cpp. References _max, _min, osg::Volume::isEmpty(), osg::Volume::isUntouchable(), and osg::Volume::setEmpty(). Referenced by osg::ParticleBSPTree::doBuild(). 00120 { 00121 if(isUntouchable() == true) 00122 return; 00123 00124 if(isEmpty() == true) 00125 { 00126 _min[0] = _max[0] = pt[0]; 00127 _min[1] = _max[1] = pt[1]; 00128 _min[2] = _max[2] = pt[2]; 00129 00130 setEmpty(false); 00131 00132 return; 00133 } 00134 00135 if(pt[0] < _min[0]) 00136 { 00137 _min[0] = pt[0]; 00138 } 00139 else 00140 { 00141 if(pt[0] > _max[0]) 00142 _max[0] = pt[0]; 00143 } 00144 00145 if(pt[1] < _min[1]) 00146 { 00147 _min[1] = pt[1]; 00148 } 00149 else 00150 { 00151 if(pt[1] > _max[1]) 00152 _max[1] = pt[1]; 00153 } 00154 00155 if(pt[2] < _min[2]) 00156 { 00157 _min[2] = pt[2]; 00158 } 00159 else 00160 { 00161 if(pt[2] > _max[2]) 00162 _max[2] = pt[2]; 00163 } 00164 }
|
|
|
Implements osg::Volume. Definition at line 167 of file OSGBoxVolume.cpp. References osg::extend(). 00168 { 00169 OSG::extend(*this,volume); 00170 }
|
|
|
Definition at line 170 of file OSGBoxVolume.inl. References osg::extend(). 00171 { 00172 OSG::extend(*this, volume); 00173 }
|
|
|
Implements osg::Volume. Definition at line 176 of file OSGBoxVolume.cpp. References _max, _min, and osg::Volume::isEmpty(). 00177 { 00178 return 00179 (!isEmpty() && 00180 (_min[0] < pt[0] && _max[0] > pt[0]) && 00181 (_min[1] < pt[1] && _max[1] > pt[1]) && 00182 (_min[2] < pt[2] && _max[2] > pt[2])); 00183 }
|
|
|
intersect the box with the given Line Implements osg::Volume. Definition at line 187 of file OSGBoxVolume.cpp. References osg::Line::intersect(). 00188 { 00189 Real32 enter; 00190 Real32 exit; 00191 00192 return line.intersect(*this, enter, exit); 00193 }
|
|
||||||||||||||||
|
intersect the box with the given Line Implements osg::Volume. Definition at line 199 of file OSGBoxVolume.cpp. References osg::Line::intersect(). 00200 { 00201 return line.intersect(*this, min, max); 00202 }
|
|
|
Implements osg::Volume. Definition at line 205 of file OSGBoxVolume.cpp. References osg::intersect(). 00206 { 00207 return OSG::intersect(*this, volume); 00208 }
|
|
|
Definition at line 211 of file OSGBoxVolume.cpp. References osg::intersect(). 00212 { 00213 return OSG::intersect(*this, volume); 00214 }
|
|
|
Implements osg::Volume. Definition at line 217 of file OSGBoxVolume.cpp. References _max, _min, osg::Eps, and osg::osgabs(). 00218 { 00219 if(((osgabs(point[0] - _min[0]) < Eps || 00220 osgabs(point[0] - _max[0]) < Eps ) && 00221 (point[1] >= _min[1] && point[1] <= _max[1] && 00222 point[2] >= _min[2] && point[2] <= _max[2] ) ) || 00223 00224 ((osgabs(point[1] - _min[1]) < Eps || 00225 osgabs(point[1] - _max[1]) < Eps ) && 00226 (point[0] >= _min[0] && point[0] <= _max[1] && 00227 point[2] >= _min[2] && point[2] <= _max[2] ) ) || 00228 00229 ((osgabs(point[2] - _min[2]) < Eps || 00230 osgabs(point[2] - _max[2]) < Eps ) && 00231 (point[1] >= _min[1] && point[1] <= _max[1] && 00232 point[0] >= _min[0] && point[0] <= _max[0] ) ) ) 00233 { 00234 return true; 00235 } 00236 else 00237 { 00238 return false; 00239 } 00240 }
|
|
|
Implements osg::Volume. Definition at line 245 of file OSGBoxVolume.cpp. References _max, _min, osg::Volume::isEmpty(), and osg::VecStorage3< ValueTypeT >::setValues(). 00246 { 00247 Real32 xmin; 00248 Real32 ymin; 00249 Real32 zmin; 00250 Real32 xmax; 00251 Real32 ymax; 00252 Real32 zmax; 00253 Real32 a; 00254 Real32 b; 00255 00256 if(isEmpty() == true) 00257 return; 00258 00259 xmin = xmax = m[3][0]; 00260 ymin = ymax = m[3][1]; 00261 zmin = zmax = m[3][2]; 00262 00263 // 00264 // calculate xmin and xmax of new tranformed BBox 00265 // 00266 00267 a = _max[0] * m[0][0]; 00268 b = _min[0] * m[0][0]; 00269 00270 if(a >= b) 00271 { 00272 xmax += a; 00273 xmin += b; 00274 } 00275 else 00276 { 00277 xmax += b; 00278 xmin += a; 00279 } 00280 00281 a = _max[1] * m[1][0]; 00282 b = _min[1] * m[1][0]; 00283 00284 if(a >= b) 00285 { 00286 xmax += a; 00287 xmin += b; 00288 } 00289 else 00290 { 00291 xmax += b; 00292 xmin += a; 00293 } 00294 00295 a = _max[2] * m[2][0]; 00296 b = _min[2] * m[2][0]; 00297 00298 if(a >= b) 00299 { 00300 xmax += a; 00301 xmin += b; 00302 } 00303 else 00304 { 00305 xmax += b; 00306 xmin += a; 00307 } 00308 00309 // 00310 // calculate ymin and ymax of new tranformed BBox 00311 // 00312 00313 a = _max[0] * m[0][1]; 00314 b = _min[0] * m[0][1]; 00315 00316 if(a >= b) 00317 { 00318 ymax += a; 00319 ymin += b; 00320 } 00321 else 00322 { 00323 ymax += b; 00324 ymin += a; 00325 } 00326 00327 a = _max[1] * m[1][1]; 00328 b = _min[1] * m[1][1]; 00329 00330 if(a >= b) 00331 { 00332 ymax += a; 00333 ymin += b; 00334 } 00335 else 00336 { 00337 ymax += b; 00338 ymin += a; 00339 } 00340 00341 a = _max[2] * m[2][1]; 00342 b = _min[2] * m[2][1]; 00343 00344 if(a >= b) 00345 { 00346 ymax += a; 00347 ymin += b; 00348 } 00349 else 00350 { 00351 ymax += b; 00352 ymin += a; 00353 } 00354 00355 // 00356 // calculate zmin and zmax of new tranformed BBox 00357 // 00358 00359 a = _max[0] * m[0][2]; 00360 b = _min[0] * m[0][2]; 00361 00362 if(a >= b) 00363 { 00364 zmax += a; 00365 zmin += b; 00366 } 00367 else 00368 { 00369 zmax += b; 00370 zmin += a; 00371 } 00372 00373 a = _max[1] * m[1][2]; 00374 b = _min[1] * m[1][2]; 00375 00376 if(a >= b) 00377 { 00378 zmax += a; 00379 zmin += b; 00380 } 00381 else 00382 { 00383 zmax += b; 00384 zmin += a; 00385 } 00386 00387 a = _max[2] * m[2][2]; 00388 b = _min[2] * m[2][2]; 00389 00390 if(a >= b) 00391 { 00392 zmax += a; 00393 zmin += b; 00394 } 00395 else 00396 { 00397 zmax += b; 00398 zmin += a; 00399 } 00400 00401 _min.setValues(xmin, ymin, zmin); 00402 _max.setValues(xmax, ymax, zmax); 00403 }
|
|
|
Definition at line 407 of file OSGBoxVolume.cpp. References _max, _min, and osg::Volume::_state. 00408 { 00409 if(&b1 == this) 00410 return *this; 00411 00412 _min = b1._min; 00413 _max = b1._max; 00414 _state = b1._state; 00415 00416 return *this; 00417 }
|
|
||||||||||||
|
Implements osg::Volume. Definition at line 421 of file OSGBoxVolume.cpp. References _max, _min, and PLOG.
|
|
|
set the volume to be valid Definition at line 82 of file OSGVolume.inl. References osg::Volume::_state, osg::Volume::isStatic(), and osg::Volume::OSGVALID. Referenced by osg::Surface::adjustVolume(), osg::Slices::adjustVolume(), osg::ProxyGroup::adjustVolume(), osg::Particles::adjustVolume(), osg::Geometry::adjustVolume(), osg::DVRVolume::adjustVolume(), osg::Node::invalidateVolume(), setBounds(), and setBoundsByCenterAndSize(). 00083 { 00084 if(!isStatic()) 00085 { 00086 if(value == true) 00087 _state |= OSGVALID; 00088 else 00089 _state &= ~OSGVALID; 00090 } 00091 }
|
|
|
Checks if the volume is valid Definition at line 96 of file OSGVolume.inl. References osg::Volume::_state, and osg::Volume::OSGVALID. Referenced by osg::Group::intersect(), osg::Geometry::intersect(), osg::DVRVolume::intersect(), and osg::Node::invalidateVolume().
|
|
|
set the volume to contain nothing Definition at line 104 of file OSGVolume.inl. References osg::Volume::_state, osg::Volume::OSGEMPTY, osg::Volume::OSGINFINITE, and osg::Volume::OSGVALID. Referenced by osg::Surface::adjustVolume(), osg::Slices::adjustVolume(), osg::ProxyGroup::adjustVolume(), osg::Particles::adjustVolume(), osg::Geometry::adjustVolume(), osg::DVRVolume::adjustVolume(), BoxVolume(), osg::CylinderVolume::CylinderVolume(), osg::ParticleBSPTree::doBuild(), osg::SphereVolume::extendBy(), extendBy(), setBounds(), setBoundsByCenterAndSize(), osg::SphereVolume::setValue(), osg::SphereVolume::SphereVolume(), and osg::Node::updateVolume(). 00105 { 00106 if(value == true) 00107 { 00108 _state |= OSGEMPTY; 00109 _state |= OSGVALID; 00110 _state &= ~OSGINFINITE; 00111 } 00112 else 00113 { 00114 _state &= ~OSGEMPTY; 00115 } 00116 }
|
|
|
Checks if the volume is empty Definition at line 121 of file OSGVolume.inl. References osg::Volume::_state, and osg::Volume::OSGEMPTY. Referenced by osg::SphereVolume::extendBy(), extendBy(), getCenter(), osg::SphereVolume::getScalarVolume(), osg::CylinderVolume::getScalarVolume(), getScalarVolume(), intersect(), and transform().
|
|
|
set the volume to be static Definition at line 63 of file OSGVolume.inl. References osg::Volume::_state, and osg::Volume::OSGSTATIC. 00064 { 00065 if(value == true) 00066 _state |= OSGSTATIC; 00067 else 00068 _state &= ~OSGSTATIC; 00069 }
|
|
|
Checks if the volume is static Definition at line 74 of file OSGVolume.inl. References osg::Volume::_state, and osg::Volume::OSGSTATIC. Referenced by osg::Node::invalidateVolume(), and osg::Volume::setValid().
|
|
|
set the volume to be infinite Definition at line 129 of file OSGVolume.inl. References osg::Volume::_state, osg::Volume::OSGEMPTY, osg::Volume::OSGINFINITE, and osg::Volume::OSGVALID. Referenced by setBounds(), and setBoundsByCenterAndSize(). 00130 { 00131 if(value == true) 00132 { 00133 _state |= OSGINFINITE; 00134 _state |= OSGVALID; 00135 _state &= ~OSGEMPTY; 00136 } 00137 else 00138 { 00139 _state &= ~OSGINFINITE; 00140 } 00141 }
|
|
|
Checks if the volume is infinite Definition at line 146 of file OSGVolume.inl. References osg::Volume::_state, and osg::Volume::OSGINFINITE. 00147 { 00148 return (_state & OSGINFINITE) ? true : false; 00149 }
|
|
|
Checks if the volume is untouchable, i.e. it's values should not be changed. Mainly used internally to speed up early outs in extendBy(). Definition at line 157 of file OSGVolume.inl. References osg::Volume::_state, osg::Volume::OSGINFINITE, osg::Volume::OSGSTATIC, and osg::Volume::OSGVALID. Referenced by osg::SphereVolume::extendBy(), and extendBy(). 00158 { 00159 return (_state & (OSGINFINITE | OSGVALID | OSGSTATIC)) != OSGVALID; 00160 }
|
|
|