#include <OSGPolytopeVolume.h>

Public Member Functions | |
| bool | operator== (const Volume &other) const |
| bool | operator!= (const Volume &other) const |
Constructors | |
| PolytopeVolume () | |
| PolytopeVolume (const UInt16 &) | |
| Constructor given bounds. | |
| PolytopeVolume (const PolytopeVolume &obj) | |
| Copy Constructor. | |
Destructors | |
| ~PolytopeVolume () | |
| Destructor. | |
Get | |
| const Plane & | getNear (void) const |
| Returns the near plane. | |
| const Plane * | getPlanes (void) |
| get method | |
| const Plane * | getPlanes (void) const |
| get method | |
| virtual void | getCenter (Pnt3f ¢er) const |
| Returns the center of a box. | |
| virtual Real32 | getScalarVolume (void) const |
| Gives the volume of the frustum. | |
| virtual void | getBounds (Pnt3f &minPnt, Pnt3f &maxPnt) const |
| Gives the boundaries of the volume. | |
Get | |
| void | setPlane (const Plane &, const UInt16) |
| set method | |
Extending | |
| virtual void | extendBy (const Pnt3f &pt) |
| Extends Frustum3f (if necessary) to contain given 3D point. | |
| void | extendBy (const Volume &volume) |
| Extends Frustum3f (if necessary) to contain given 3D point. | |
| void | extendBy (const PolytopeVolume &bb) |
| Extends Frustum3f (if necessary) to contain given 3D point. | |
Intersection | |
| bool | intersect (const Pnt3f &point) const |
| Returns true if intersection of given point and Frustum3f is not empty. | |
| bool | intersect (const Line &line) const |
| bool | intersect (const Line &line, Real32 &minDist, Real32 &maxDist) const |
| bool | intersect (const Volume &volume) const |
| Returns true if intersection of given point and Frustum3f is not empty. | |
| bool | intersect (const PolytopeVolume &bb) const |
| Returns true if intersection of given point and Frustum3f is not empty. | |
| virtual bool | isOnSurface (const Pnt3f &point) const |
| Returns true if intersection of given point and Frustum3f is not empty. | |
Transformation | |
| virtual void | transform (const Matrix &m) |
| Transforms Frustum3f by matrix, enlarging Frustum3f to contain result. | |
Assignment | |
| const PolytopeVolume & | operator= (const PolytopeVolume &b1) |
| Assignment operator. | |
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 | |
| UInt16 | _numPlanes |
| Plane * | _planes |
Definition at line 57 of file OSGPolytopeVolume.h.
| osg::PolytopeVolume::PolytopeVolume | ( | ) | [inline] |
Default constructor - leaves box totally empty
Definition at line 56 of file OSGPolytopeVolume.inl.
00056 : 00057 Volume() 00058 { 00059 }
| osg::PolytopeVolume::PolytopeVolume | ( | const UInt16 & | s | ) | [inline] |
Definition at line 64 of file OSGPolytopeVolume.inl.
References _numPlanes, and _planes.
00064 : 00065 Volume(), _numPlanes(s) 00066 { 00067 _planes = new Plane[_numPlanes]; 00068 }
| osg::PolytopeVolume::PolytopeVolume | ( | const PolytopeVolume & | obj | ) | [inline] |
Definition at line 72 of file OSGPolytopeVolume.inl.
References _numPlanes, and _planes.
00072 : 00073 Volume(obj), _numPlanes(obj._numPlanes) 00074 { 00075 _planes=new Plane[_numPlanes]; 00076 for(UInt16 i=0; i<_numPlanes; i++) 00077 _planes[i]=obj._planes[i]; 00078 }
| osg::PolytopeVolume::~PolytopeVolume | ( | ) | [inline] |
Definition at line 82 of file OSGPolytopeVolume.inl.
References _planes.
00083 { 00084 delete[] _planes; 00085 }
| const Plane & osg::PolytopeVolume::getNear | ( | void | ) | const [inline] |
Definition at line 91 of file OSGPolytopeVolume.inl.
References _planes.
00092 { 00093 return _planes[0]; 00094 }
| const Plane * osg::PolytopeVolume::getPlanes | ( | void | ) | [inline] |
Definition at line 98 of file OSGPolytopeVolume.inl.
References _planes.
00099 { 00100 return _planes; 00101 }
| const Plane * osg::PolytopeVolume::getPlanes | ( | void | ) | const [inline] |
Definition at line 105 of file OSGPolytopeVolume.inl.
References _planes.
00106 { 00107 return _planes; 00108 }
| void osg::PolytopeVolume::getCenter | ( | Pnt3f & | center | ) | const [virtual] |
| Real32 osg::PolytopeVolume::getScalarVolume | ( | void | ) | const [virtual] |
| void osg::PolytopeVolume::setPlane | ( | const Plane & | p, | |
| const | UInt16 | |||
| ) |
Definition at line 68 of file OSGPolytopeVolume.cpp.
References _numPlanes, and _planes.
00069 { 00070 if(i>=_numPlanes) 00071 { 00072 std::cerr << "\nARGL!\n\n"; 00073 return; 00074 } 00075 _planes[i]=p; 00076 }
| void osg::PolytopeVolume::extendBy | ( | const Pnt3f & | pt | ) | [virtual] |
| void osg::PolytopeVolume::extendBy | ( | const Volume & | volume | ) | [inline, virtual] |
| void osg::PolytopeVolume::extendBy | ( | const PolytopeVolume & | bb | ) | [inline] |
| bool osg::PolytopeVolume::intersect | ( | const Pnt3f & | point | ) | const [virtual] |
Implements osg::Volume.
Definition at line 112 of file OSGPolytopeVolume.cpp.
References _numPlanes, and _planes.
00113 { 00114 int i; 00115 bool retCode = true; 00116 00117 for (i = 0; i < _numPlanes; i++) 00118 { 00119 /* 00120 if ( ( _planes[i].getNormal().x() * point.x() + 00121 _planes[i].getNormal().y() * point.x() + 00122 _planes[i].getNormal().z() * point.x() + 00123 _planes[i].getDistanceFromOrigin()) < 0 ) { 00124 retCode = false; 00125 break; 00126 } 00127 */ 00128 if(_planes[i].isInHalfSpace(point)==false) 00129 { 00130 retCode = false; 00131 break; 00132 } 00133 } 00134 00135 return retCode; 00136 }
| bool osg::PolytopeVolume::intersect | ( | const Line & | line | ) | const [virtual] |
intersect the box with the given Line
Implements osg::Volume.
Definition at line 140 of file OSGPolytopeVolume.cpp.
| bool osg::PolytopeVolume::intersect | ( | const Line & | line, | |
| Real32 & | minDist, | |||
| Real32 & | maxDist | |||
| ) | const [virtual] |
intersect the box with the given Line
Implements osg::Volume.
Definition at line 149 of file OSGPolytopeVolume.cpp.
| bool osg::PolytopeVolume::intersect | ( | const Volume & | volume | ) | const [inline, virtual] |
| bool osg::PolytopeVolume::intersect | ( | const PolytopeVolume & | bb | ) | const [inline] |
| bool osg::PolytopeVolume::isOnSurface | ( | const Pnt3f & | point | ) | const [virtual] |
| void osg::PolytopeVolume::transform | ( | const Matrix & | m | ) | [virtual] |
| const PolytopeVolume & osg::PolytopeVolume::operator= | ( | const PolytopeVolume & | b1 | ) |
Definition at line 172 of file OSGPolytopeVolume.cpp.
References _numPlanes, and _planes.
00173 { 00174 for (int i = 0; i < _numPlanes; i++) 00175 _planes[i] = b1._planes[i]; 00176 00177 return *this; 00178 }
| 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(), osg::CylinderVolume::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(), osg::CylinderVolume::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] |
UInt16 osg::PolytopeVolume::_numPlanes [private] |
Definition at line 150 of file OSGPolytopeVolume.h.
Referenced by intersect(), operator=(), PolytopeVolume(), and setPlane().
Plane* osg::PolytopeVolume::_planes [private] |
Definition at line 151 of file OSGPolytopeVolume.h.
Referenced by getNear(), getPlanes(), intersect(), operator=(), PolytopeVolume(), setPlane(), and ~PolytopeVolume().
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