osg::PolytopeVolume Class Reference

3D shadow frustum defined by n planes. More...

#include <OSGPolytopeVolume.h>

Inheritance diagram for osg::PolytopeVolume:

osg::Volume

List of all members.

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 PlanegetNear (void) const
 Returns the near plane.
const PlanegetPlanes (void)
 get method
const PlanegetPlanes (void) const
 get method
virtual void getCenter (Pnt3f &center) 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 PolytopeVolumeoperator= (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


Detailed Description

Author:
dstaneker

Definition at line 57 of file OSGPolytopeVolume.h.


Constructor & Destructor Documentation

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 }


Member Function Documentation

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]

Implements osg::Volume.

Definition at line 79 of file OSGPolytopeVolume.cpp.

00080 {
00081     // not implemented
00082     return;
00083 }

Real32 osg::PolytopeVolume::getScalarVolume ( void   )  const [virtual]

Implements osg::Volume.

Definition at line 86 of file OSGPolytopeVolume.cpp.

00087 {
00088     // not implemented
00089     return 0.0;
00090 }

void osg::PolytopeVolume::getBounds ( Pnt3f minPnt,
Pnt3f maxPnt 
) const [virtual]

Implements osg::Volume.

Definition at line 93 of file OSGPolytopeVolume.cpp.

00095 {
00096     // not implemented !!!
00097     return;
00098 }

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]

Implements osg::Volume.

Definition at line 103 of file OSGPolytopeVolume.cpp.

00104 {
00105     // not implemented !!!
00106     return;
00107 }

void osg::PolytopeVolume::extendBy ( const Volume volume  )  [inline, virtual]

Implements osg::Volume.

Definition at line 113 of file OSGPolytopeVolume.inl.

00114 {
00115     // not implemented
00116 }

void osg::PolytopeVolume::extendBy ( const PolytopeVolume bb  )  [inline]

Definition at line 119 of file OSGPolytopeVolume.inl.

00120 {
00121     // not implemented
00122 }

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.

00141 {
00142     // not implented
00143     return 0;
00144 }

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.

00152 {
00153     // not implented
00154     return 0;
00155 }

bool osg::PolytopeVolume::intersect ( const Volume volume  )  const [inline, virtual]

Implements osg::Volume.

Definition at line 127 of file OSGPolytopeVolume.inl.

00128 {
00129     // not implemented
00130     return(1);
00131 }

bool osg::PolytopeVolume::intersect ( const PolytopeVolume bb  )  const [inline]

Definition at line 134 of file OSGPolytopeVolume.inl.

00135 {
00136     // not implemented
00137     return(1);
00138 }

bool osg::PolytopeVolume::isOnSurface ( const Pnt3f point  )  const [virtual]

Implements osg::Volume.

Definition at line 157 of file OSGPolytopeVolume.cpp.

00158 {
00159     // not implemented
00160     return false;
00161 }

void osg::PolytopeVolume::transform ( const Matrix m  )  [virtual]

Implements osg::Volume.

Definition at line 165 of file OSGPolytopeVolume.cpp.

00166 {
00167     // not implemented
00168     return;
00169 }

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::PolytopeVolume::dump ( UInt32  uiIndent = 0,
const BitVector  bvFlags = 0 
) const [virtual]

Implements osg::Volume.

Definition at line 181 of file OSGPolytopeVolume.cpp.

00183 {
00184     // not implemented...
00185 }

void osg::Volume::setValid ( const bool  value = true  )  [inline, inherited]

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().

00097 {
00098     return (_state & OSGVALID) ? true : false;
00099 }

void osg::Volume::setEmpty ( const bool  value = true  )  [inline, inherited]

bool osg::Volume::isEmpty ( void   )  const [inline, inherited]

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().

00075 {
00076     return (_state & OSGSTATIC) ? true : false;
00077 }

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::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::osg::FieldDataTraits< DynamicVolume >::copyFromBin().

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]

Definition at line 53 of file OSGVolume.cpp.

References osg::Volume::_state.

00054 {
00055     return _state == other._state;
00056 }

bool Volume::operator!= ( const Volume other  )  const [inherited]

Definition at line 58 of file OSGVolume.cpp.

00059 {
00060     return !(*this == other);
00061 }


Member Data Documentation

Definition at line 150 of file OSGPolytopeVolume.h.

Referenced by intersect(), operator=(), PolytopeVolume(), and setPlane().

UInt16 osg::Volume::_state [protected, inherited]


The documentation for this class was generated from the following files:

Generated on Mon Mar 17 12:03:17 2008 for OpenSG by  doxygen 1.5.5