#include <OSGSphereVolume.h>
Public Member Functions | |
| bool | operator== (const Volume &other) const |
| bool | operator!= (const Volume &other) const |
Constructor | |
| SphereVolume (void) | |
| SphereVolume (const SphereVolume &obj) | |
| SphereVolume (const Pnt3f &c, Real32 r) | |
Destructor | |
| ~SphereVolume (void) | |
Set Values | |
| void | setValue (const Pnt3f &c, Real32 r) |
| void | setCenter (const Pnt3f &c) |
| void | setRadius (Real32 r) |
Get Values | |
| const Pnt3f & | getCenter (void) const |
| Real32 | getRadius (void) const |
| virtual void | getCenter (Pnt3f ¢er) const |
| virtual Real32 | getScalarVolume (void) const |
| virtual void | getBounds (Pnt3f &min, Pnt3f &max) const |
Extending | |
| virtual void | extendBy (const Pnt3f &pt) |
| virtual void | extendBy (const Volume &volume) |
| void | extendBy (const SphereVolume &bb) |
Intersection | |
| virtual bool | intersect (const Pnt3f &point) const |
| virtual bool | intersect (const Line &line) const |
| virtual bool | intersect (const Line &line, Real32 &enter, Real32 &exit) const |
| virtual bool | intersect (const Volume &volume) const |
| bool | intersect (const SphereVolume &sphere) const |
| virtual bool | isOnSurface (const Pnt3f &point) const |
Transformation | |
| virtual void | transform (const Matrix &mat) |
Output | |
| virtual void | dump (UInt32 uiIndent=0, const BitVector bvFlags=0) const |
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) |
Get Values | |
| Pnt3f | getMin (void) const |
| Pnt3f | getMax (void) const |
Protected Attributes | |
| UInt16 | _state |
Private Attributes | |
| Pnt3f | _center |
| Real32 | _radius |
Operators | |
|
| |
| SphereVolume & | operator= (const SphereVolume &source) |
| bool | operator== (const SphereVolume &lhs, const SphereVolume &rhs) |
Sphere in 3D space defined by center and radius.
Definition at line 53 of file OSGSphereVolume.h.
| osg::SphereVolume::SphereVolume | ( | void | ) | [inline] |
Definition at line 50 of file OSGSphereVolume.inl.
| osg::SphereVolume::SphereVolume | ( | const SphereVolume & | obj | ) | [inline] |
Definition at line 58 of file OSGSphereVolume.inl.
References osg::Volume::setEmpty().
Definition at line 67 of file OSGSphereVolume.inl.
References osg::Volume::setEmpty().
| osg::SphereVolume::~SphereVolume | ( | void | ) | [inline] |
Definition at line 76 of file OSGSphereVolume.inl.
| SphereVolume & SphereVolume::operator= | ( | const SphereVolume & | source | ) |
Change the center and radius
Definition at line 85 of file OSGSphereVolume.inl.
References _center, _radius, and osg::Volume::setEmpty().
Referenced by osg::DynamicVolume::morphToType().
| void osg::SphereVolume::setCenter | ( | const Pnt3f & | c | ) | [inline] |
set just the center
Definition at line 97 of file OSGSphereVolume.inl.
References _center.
Referenced by osg::FieldDataTraits< DynamicVolume >::copyFromBin(), and osg::FieldDataTraits< DynamicVolume >::getFromString().
00098 { 00099 _center = c; 00100 }
| void osg::SphereVolume::setRadius | ( | Real32 | r | ) | [inline] |
set just the radius
Definition at line 105 of file OSGSphereVolume.inl.
References _radius.
Referenced by osg::FieldDataTraits< DynamicVolume >::copyFromBin(), and osg::FieldDataTraits< DynamicVolume >::getFromString().
00106 { 00107 _radius = r; 00108 }
| const Pnt3f & osg::SphereVolume::getCenter | ( | void | ) | const [inline] |
Returns the center
Definition at line 115 of file OSGSphereVolume.inl.
References _center.
Referenced by osg::FieldDataTraits< DynamicVolume >::copyToBin(), osg::Line::intersect(), and osg::FieldDataTraits< DynamicVolume >::putToString().
00116 { 00117 return _center; 00118 }
| Real32 osg::SphereVolume::getRadius | ( | void | ) | const [inline] |
Returns the radius
Definition at line 123 of file OSGSphereVolume.inl.
References _radius.
Referenced by osg::FieldDataTraits< DynamicVolume >::copyToBin(), osg::Line::intersect(), and osg::FieldDataTraits< DynamicVolume >::putToString().
00124 { 00125 return _radius; 00126 }
| void SphereVolume::getCenter | ( | Pnt3f & | center | ) | const [virtual] |
Returns the center
Implements osg::Volume.
Definition at line 87 of file OSGSphereVolume.cpp.
References _center.
00088 { 00089 center = _center; 00090 }
| Real32 SphereVolume::getScalarVolume | ( | void | ) | const [virtual] |
Returns the center
Implements osg::Volume.
Definition at line 93 of file OSGSphereVolume.cpp.
References _radius, osg::Volume::isEmpty(), and osg::Pi.
| void SphereVolume::extendBy | ( | const Pnt3f & | pt | ) | [virtual] |
Implements osg::Volume.
Definition at line 110 of file OSGSphereVolume.cpp.
References _center, _radius, osg::Volume::isEmpty(), osg::Volume::isUntouchable(), and osg::Volume::setEmpty().
| void SphereVolume::extendBy | ( | const Volume & | volume | ) | [virtual] |
Definition at line 132 of file OSGSphereVolume.cpp.
References osg::extend().
00133 { 00134 OSG::extend(*this, volume); 00135 }
| void osg::SphereVolume::extendBy | ( | const SphereVolume & | bb | ) | [inline, virtual] |
Implements osg::Volume.
Definition at line 131 of file OSGSphereVolume.inl.
References osg::extend().
00132 { 00133 OSG::extend(*this, volume); 00134 }
| bool SphereVolume::intersect | ( | const Pnt3f & | point | ) | const [virtual] |
Returns true if intersection of given point and Volume is not empty
Implements osg::Volume.
Definition at line 141 of file OSGSphereVolume.cpp.
References _center, and _radius.
Referenced by intersect().
| bool SphereVolume::intersect | ( | const Line & | line | ) | const [virtual] |
intersect the SphereVolume with the given Line
Implements osg::Volume.
Definition at line 153 of file OSGSphereVolume.cpp.
References osg::Line::intersect().
00154 { 00155 return line.intersect(*this); 00156 }
intersect the SphereVolume with the given Line
Implements osg::Volume.
Definition at line 160 of file OSGSphereVolume.cpp.
References osg::Line::intersect().
00163 { 00164 return line.intersect(*this, enter, exit); 00165 }
| bool SphereVolume::intersect | ( | const Volume & | volume | ) | const [virtual] |
Returns true if intersection of given point and Volume is not empty
Definition at line 168 of file OSGSphereVolume.cpp.
References intersect().
00169 { 00170 return OSG::intersect(*this, volume); 00171 }
| bool osg::SphereVolume::intersect | ( | const SphereVolume & | sphere | ) | const [inline, virtual] |
Returns true if intersection of given point and Volume is not empty
Implements osg::Volume.
Definition at line 139 of file OSGSphereVolume.inl.
References intersect().
00140 { 00141 return OSG::intersect(*this, volume); 00142 }
| bool SphereVolume::isOnSurface | ( | const Pnt3f & | point | ) | const [virtual] |
Returns true if intersection of given point and Volume is not empty
Implements osg::Volume.
Definition at line 174 of file OSGSphereVolume.cpp.
References _center, _radius, osg::Eps, and osg::osgabs().
| void SphereVolume::transform | ( | const Matrix & | mat | ) | [virtual] |
Implements osg::Volume.
Definition at line 189 of file OSGSphereVolume.cpp.
References _center, _radius, and osg::TransformationMatrix< ValueTypeT >::mult().
00190 { 00191 // assume uniform scaling, otherways we get an ellipsoid 00192 Pnt3f hull(_center); 00193 hull += Vec3f(0, _radius, 0); 00194 00195 mat.mult(_center, _center); 00196 mat.mult(hull, hull ); 00197 _radius = (hull - _center).length(); 00198 00199 /* 00200 Vec3f translation, scaleFactor; 00201 Quaternion rotation, scaleOrientation; 00202 00203 mat.mult(_center); 00204 mat.getTransform(translation, rotation, scaleFactor, scaleOrientation); 00205 _radius *= scaleFactor[0]; 00206 */ 00207 }
| void osg::Volume::setValid | ( | const bool | value = true |
) | [inline, inherited] |
set the volume to be valid
Reimplemented in osg::DynamicVolume.
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(), osg::BoxVolume::setBounds(), and osg::BoxVolume::setBoundsByCenterAndSize().
| bool osg::Volume::isValid | ( | void | ) | const [inline, inherited] |
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().
| void osg::Volume::setEmpty | ( | const bool | value = true |
) | [inline, inherited] |
set the volume to contain nothing
Reimplemented in osg::DynamicVolume.
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::DVRVolume::adjustVolume(), osg::BoxVolume::BoxVolume(), osg::CylinderVolume::CylinderVolume(), osg::ParticleBSPTree::doBuild(), extendBy(), osg::BoxVolume::extendBy(), osg::BoxVolume::setBounds(), osg::BoxVolume::setBoundsByCenterAndSize(), setValue(), SphereVolume(), and osg::Node::updateVolume().
| bool osg::Volume::isEmpty | ( | void | ) | const [inline, inherited] |
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::Geometry::adjustVolume(), extendBy(), osg::BoxVolume::extendBy(), osg::BoxVolume::getCenter(), getScalarVolume(), osg::CylinderVolume::getScalarVolume(), osg::BoxVolume::getScalarVolume(), osg::BoxVolume::intersect(), and osg::BoxVolume::transform().
| void osg::Volume::setStatic | ( | const bool | value = true |
) | [inline, inherited] |
set the volume to be static
Reimplemented in osg::DynamicVolume.
Definition at line 63 of file OSGVolume.inl.
References osg::Volume::_state, and osg::Volume::OSGSTATIC.
| bool osg::Volume::isStatic | ( | void | ) | const [inline, inherited] |
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().
| void osg::Volume::setInfinite | ( | const bool | value = true |
) | [inline, inherited] |
set the volume to be infinite
Reimplemented in osg::DynamicVolume.
Definition at line 129 of file OSGVolume.inl.
References osg::Volume::_state, osg::Volume::OSGEMPTY, osg::Volume::OSGINFINITE, and osg::Volume::OSGVALID.
Referenced by osg::BoxVolume::setBounds(), and osg::BoxVolume::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 }
| bool osg::Volume::isInfinite | ( | void | ) | const [inline, inherited] |
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 }
| bool osg::Volume::isUntouchable | ( | void | ) | const [inline, inherited] |
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 extendBy(), and osg::BoxVolume::extendBy().
00158 { 00159 return (_state & (OSGINFINITE | OSGVALID | OSGSTATIC)) != OSGVALID; 00160 }
| UInt16 osg::Volume::getState | ( | void | ) | const [inline, inherited] |
get the volume's state
Definition at line 166 of file OSGVolume.inl.
References osg::Volume::_state.
Referenced by osg::FieldDataTraits< BoxVolume >::copyToBin(), osg::FieldDataTraits< DynamicVolume >::copyToBin(), and osg::DynamicVolume::instanceChanged().
00167 { 00168 return _state; 00169 }
| void osg::Volume::setState | ( | UInt16 | val | ) | [inline, inherited] |
set the volume's state
Definition at line 174 of file OSGVolume.inl.
References osg::Volume::_state.
Referenced by osg::FieldDataTraits< BoxVolume >::copyFromBin(), osg::FieldDataTraits< DynamicVolume >::copyFromBin(), and osg::DynamicVolume::updateInstanceState().
00175 { 00176 _state = val; 00177 }
| Pnt3f osg::Volume::getMin | ( | void | ) | const [inline, inherited] |
Return the lowest point of the volume. Just a convience wrapper for getBounds()
Reimplemented in osg::BoxVolume.
Definition at line 184 of file OSGVolume.inl.
References osg::Volume::getBounds().
| Pnt3f osg::Volume::getMax | ( | void | ) | const [inline, inherited] |
Return the highest point of the volume. Just a convience wrapper for getBounds()
Reimplemented in osg::BoxVolume.
Definition at line 199 of file OSGVolume.inl.
References osg::Volume::getBounds().
| bool Volume::operator== | ( | const Volume & | other | ) | const [inherited] |
Definition at line 53 of file OSGVolume.cpp.
References osg::Volume::_state.
| bool Volume::operator!= | ( | const Volume & | other | ) | const [inherited] |
Definition at line 58 of file OSGVolume.cpp.
| bool operator== | ( | const SphereVolume & | lhs, | |
| const SphereVolume & | rhs | |||
| ) | [friend] |
Pnt3f osg::SphereVolume::_center [private] |
Definition at line 155 of file OSGSphereVolume.h.
Referenced by dump(), extendBy(), getBounds(), getCenter(), intersect(), isOnSurface(), operator=(), setCenter(), setValue(), and transform().
Real32 osg::SphereVolume::_radius [private] |
Definition at line 156 of file OSGSphereVolume.h.
Referenced by dump(), extendBy(), getBounds(), getRadius(), getScalarVolume(), intersect(), isOnSurface(), operator=(), setRadius(), setValue(), and transform().
UInt16 osg::Volume::_state [protected, inherited] |
Definition at line 149 of file OSGVolume.h.
Referenced by osg::Volume::getState(), osg::DynamicVolume::instanceChanged(), osg::Volume::isEmpty(), osg::Volume::isInfinite(), osg::Volume::isStatic(), osg::Volume::isUntouchable(), osg::Volume::isValid(), osg::FrustumVolume::operator=(), osg::BoxVolume::operator=(), osg::Volume::operator==(), osg::Volume::setEmpty(), osg::Volume::setInfinite(), osg::Volume::setState(), osg::Volume::setStatic(), osg::Volume::setValid(), and osg::DynamicVolume::updateInstanceState().
1.6.1