#include <OSGCylinderVolume.h>

Public Member Functions | |
| bool | operator== (const Volume &other) const |
| bool | operator!= (const Volume &other) const |
Constructors | |
| CylinderVolume (void) | |
| CylinderVolume (const Pnt3f &p, const Vec3f &d, Real32 r) | |
| CylinderVolume (const CylinderVolume &c) | |
Destructors | |
| ~CylinderVolume (void) | |
Get | |
| void | getAxis (Pnt3f &apos, Vec3f &adir) const |
| Real32 | getRadius (void) const |
| virtual void | getCenter (Pnt3f ¢er) const |
| virtual Real32 | getScalarVolume (void) const |
| virtual void | getBounds (Pnt3f &min, Pnt3f &max) const |
Set | |
| void | setValue (const Pnt3f &p, const Vec3f &d, Real32 r) |
| void | setAxis (const Pnt3f &p, const Vec3f &d) |
| void | setRadius (Real32 r) |
Extend | |
| virtual void | extendBy (const Pnt3f &pt) |
| virtual void | extendBy (const Volume &volume) |
| void | extendBy (const CylinderVolume &obj) |
Intersect | |
| 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 CylinderVolume &volume) const |
| virtual bool | isOnSurface (const Pnt3f &point) const |
Transform | |
| virtual void | transform (const Matrix &mat) |
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) |
Get Values | |
| Pnt3f | getMin (void) const |
| Pnt3f | getMax (void) const |
Protected Attributes | |
| UInt16 | _state |
Private Attributes | |
| Pnt3f | _axisPos |
| Vec3f | _axisDir |
| Real32 | _radius |
Definition at line 54 of file OSGCylinderVolume.h.
| osg::CylinderVolume::CylinderVolume | ( | void | ) | [inline] |
Definition at line 58 of file OSGCylinderVolume.inl.
References osg::Volume::setEmpty().
00060 : 00061 Volume ( ), 00062 _axisPos(p), 00063 _axisDir(d), 00064 _radius (r) 00065 { 00066 setEmpty(false); 00067 }
| osg::CylinderVolume::CylinderVolume | ( | const CylinderVolume & | c | ) | [inline] |
| osg::CylinderVolume::~CylinderVolume | ( | void | ) | [inline] |
Definition at line 87 of file OSGCylinderVolume.inl.
References _axisDir, and _axisPos.
Referenced by osg::intersect(), osg::Line::intersect(), and transform().
| Real32 osg::CylinderVolume::getRadius | ( | void | ) | const [inline] |
Definition at line 95 of file OSGCylinderVolume.inl.
References _radius.
Referenced by osg::intersect(), osg::Line::intersect(), and transform().
00096 { 00097 return _radius; 00098 }
| void CylinderVolume::getCenter | ( | Pnt3f & | center | ) | const [virtual] |
Implements osg::Volume.
Definition at line 56 of file OSGCylinderVolume.cpp.
References _axisDir, and _axisPos.
Referenced by osg::extend().
| Real32 CylinderVolume::getScalarVolume | ( | void | ) | const [virtual] |
Implements osg::Volume.
Definition at line 62 of file OSGCylinderVolume.cpp.
References _axisDir, _radius, osg::Volume::isEmpty(), osg::VectorInterface< ValueTypeT, StorageInterfaceT >::length(), and osg::Pi.
gives the boundaries of the volume
Implements osg::Volume.
Definition at line 69 of file OSGCylinderVolume.cpp.
References _axisDir, _axisPos, and _radius.
Referenced by osg::extend(), and osg::intersect().
00070 { 00071 for(UInt32 i = 0; i < 3; i++) 00072 { 00073 min[i] = _axisPos[i] - _radius; 00074 max[i] = _axisPos[i] + _radius; 00075 ((_axisDir[i] < 0) ? min[i] : max[i]) += _axisDir[i]; 00076 } 00077 }
Definition at line 102 of file OSGCylinderVolume.inl.
References _axisDir, _axisPos, and _radius.
Referenced by osg::extend().
Definition at line 111 of file OSGCylinderVolume.inl.
References _axisDir, and _axisPos.
Referenced by transform().
| void osg::CylinderVolume::setRadius | ( | Real32 | r | ) | [inline] |
Definition at line 119 of file OSGCylinderVolume.inl.
References _radius.
Referenced by transform().
00120 { 00121 _radius = r; 00122 }
| void CylinderVolume::extendBy | ( | const Pnt3f & | pt | ) | [virtual] |
extends (if necessary) to contain the given 3D point
Implements osg::Volume.
Definition at line 87 of file OSGCylinderVolume.cpp.
| void CylinderVolume::extendBy | ( | const Volume & | volume | ) | [virtual] |
extends (if necessary) to contain the given 3D point
Implements osg::Volume.
Definition at line 93 of file OSGCylinderVolume.cpp.
References osg::extend().
00094 { 00095 OSG::extend(*this, volume); 00096 }
| void osg::CylinderVolume::extendBy | ( | const CylinderVolume & | obj | ) | [inline] |
extends (if necessary) to contain the given 3D point
Definition at line 126 of file OSGCylinderVolume.inl.
References osg::extend().
00127 { 00128 OSG::extend(*this, volume); 00129 }
| bool CylinderVolume::intersect | ( | const Pnt3f & | point | ) | const [virtual] |
Returns true if intersection of given point and CylinderVolume is not empty
Implements osg::Volume.
Definition at line 109 of file OSGCylinderVolume.cpp.
References _axisDir, _axisPos, _radius, and osg::Plane::isInHalfSpace().
00110 { 00111 Real32 dist = Line(_axisPos, _axisDir).distance(point); 00112 00113 if(dist > _radius) 00114 return false; 00115 00116 Plane bottom( _axisDir, _axisPos ); 00117 Plane top (-_axisDir, _axisPos + _axisDir); 00118 00119 bool inspace = bottom.isInHalfSpace(point) && top.isInHalfSpace(point); 00120 00121 return inspace; 00122 }
| bool CylinderVolume::intersect | ( | const Line & | line | ) | const [virtual] |
intersect the CylinderVolume with the given Line
Implements osg::Volume.
Definition at line 127 of file OSGCylinderVolume.cpp.
References osg::Line::intersect().
00128 { 00129 return line.intersect(*this); 00130 }
intersect the volume with the given Line
Implements osg::Volume.
Definition at line 134 of file OSGCylinderVolume.cpp.
References osg::Line::intersect().
00137 { 00138 return line.intersect(*this, enter, exit); 00139 }
| bool CylinderVolume::intersect | ( | const Volume & | volume | ) | const [virtual] |
Returns true if intersection of given point and CylinderVolume is not empty
Implements osg::Volume.
Definition at line 141 of file OSGCylinderVolume.cpp.
References osg::intersect().
00142 { 00143 return OSG::intersect(*this,volume); 00144 }
| bool osg::CylinderVolume::intersect | ( | const CylinderVolume & | volume | ) | const [inline] |
Returns true if intersection of given point and CylinderVolume is not empty
Definition at line 133 of file OSGCylinderVolume.inl.
References osg::intersect().
00134 { 00135 return OSG::intersect(*this, volume); 00136 }
| bool CylinderVolume::isOnSurface | ( | const Pnt3f & | point | ) | const [virtual] |
Returns true if intersection of given point and CylinderVolume is not empty
Implements osg::Volume.
Definition at line 147 of file OSGCylinderVolume.cpp.
References _axisDir, _axisPos, _radius, osg::Eps, osg::Plane::isOnPlane(), and osg::osgabs().
00148 { 00149 Real32 dist = Line(_axisPos, _axisDir).distance(point); 00150 00151 if(dist > _radius) 00152 return false; 00153 00154 Plane bottom(-_axisDir, _axisPos ); 00155 Plane top ( _axisDir, _axisPos + _axisDir); 00156 00157 bool onplane = bottom.isOnPlane(point) || top.isOnPlane(point); 00158 00159 return ( onplane && dist <= _radius ) || 00160 (!onplane && osgabs(dist - _radius) < Eps); 00161 }
| void CylinderVolume::transform | ( | const Matrix & | mtx | ) | [virtual] |
transform volume by the given matrix
Implements osg::Volume.
Definition at line 166 of file OSGCylinderVolume.cpp.
References osg::VectorInterface< ValueTypeT, StorageInterfaceT >::crossThis(), getAxis(), getRadius(), osg::VectorInterface< ValueTypeT, StorageInterfaceT >::length(), osg::TransformationMatrix< ValueTypeT >::mult(), osg::VectorInterface< ValueTypeT, StorageInterfaceT >::normalize(), p, setAxis(), and setRadius().
00167 { 00168 // get pos & axis 00169 Pnt3f p; 00170 Vec3f v, v2, v3; 00171 getAxis(p,v); 00172 00173 // find perpendicular vector (to detect radius transformation) 00174 v2 = v; 00175 v2.normalize(); 00176 v3 = v2.x() > 0.9 ? Vec3f(0,1,0) : Vec3f(1,0,0); 00177 v3.crossThis(v2); 00178 00179 // transform 00180 mtx.mult(p); 00181 mtx.mult(v); 00182 mtx.mult(v3); 00183 00184 // update 00185 setAxis(p,v); 00186 setRadius(getRadius() * v3.length()); 00187 }
| void osg::Volume::setValid | ( | const bool | value = true |
) | [inline, inherited] |
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(), osg::BoxVolume::setBounds(), and osg::BoxVolume::setBoundsByCenterAndSize().
00083 { 00084 if(!isStatic()) 00085 { 00086 if(value == true) 00087 _state |= OSGVALID; 00088 else 00089 _state &= ~OSGVALID; 00090 } 00091 }
| 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::extend(), 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
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(), osg::BoxVolume::BoxVolume(), CylinderVolume(), osg::SphereVolume::extendBy(), osg::BoxVolume::extendBy(), osg::BoxVolume::setBounds(), osg::BoxVolume::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 }
| 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::extend(), osg::SphereVolume::extendBy(), osg::BoxVolume::extendBy(), osg::BoxVolume::getCenter(), osg::SphereVolume::getScalarVolume(), getScalarVolume(), osg::BoxVolume::getScalarVolume(), osg::intersect(), osg::BoxVolume::intersect(), and osg::BoxVolume::transform().
| void osg::Volume::setStatic | ( | const bool | value = true |
) | [inline, inherited] |
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 }
| 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::extend(), osg::Node::invalidateVolume(), and osg::Volume::setValid().
| void osg::Volume::setInfinite | ( | const bool | value = true |
) | [inline, inherited] |
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 osg::extend(), 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.
Referenced by osg::extend(), and osg::intersect().
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 osg::SphereVolume::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::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.
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().
00185 { 00186 Pnt3f pmin; 00187 Pnt3f pmax; 00188 00189 getBounds(pmin, pmax); 00190 00191 return pmin; 00192 }
| 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().
Referenced by osg::RenderAction::drawHierarchicalMultiFrameOcclusionBB(), osg::RenderAction::drawMultiFrameOcclusionBB(), and osg::RenderAction::dropFunctor().
00200 { 00201 Pnt3f pmin; 00202 Pnt3f pmax; 00203 00204 getBounds(pmin, pmax); 00205 00206 return pmax; 00207 }
| bool Volume::operator== | ( | const Volume & | other | ) | const [inherited] |
| bool Volume::operator!= | ( | const Volume & | other | ) | const [inherited] |
Pnt3f osg::CylinderVolume::_axisPos [private] |
Definition at line 148 of file OSGCylinderVolume.h.
Referenced by dump(), getAxis(), getBounds(), getCenter(), intersect(), isOnSurface(), setAxis(), and setValue().
Vec3f osg::CylinderVolume::_axisDir [private] |
Definition at line 149 of file OSGCylinderVolume.h.
Referenced by dump(), getAxis(), getBounds(), getCenter(), getScalarVolume(), intersect(), isOnSurface(), setAxis(), and setValue().
Real32 osg::CylinderVolume::_radius [private] |
Definition at line 150 of file OSGCylinderVolume.h.
Referenced by dump(), getBounds(), getRadius(), getScalarVolume(), intersect(), isOnSurface(), setRadius(), and setValue().
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(), and osg::Volume::setValid().
1.5.5