OpenSceneGraph
Public Types | Public Member Functions | Protected Attributes | List of all members
osg::Polytope Class Reference

A Polytope class for representing convex clipping volumes made up of a set of planes. More...

Collaboration diagram for osg::Polytope:
Collaboration graph
[legend]

Public Types

typedef unsigned int ClippingMask
 
typedef std::vector< PlanePlaneList
 
typedef std::vector< Vec3VertexList
 
typedef fast_back_stack< ClippingMask > MaskStack
 

Public Member Functions

 Polytope (const Polytope &cv)
 
 Polytope (const PlaneList &pl)
 
void clear ()
 
Polytopeoperator= (const Polytope &cv)
 
void setToUnitFrustum (bool withNear=true, bool withFar=true)
 Create a Polytope which is a cube, centered at 0,0,0, with sides of 2 units. More...
 
void setToBoundingBox (const BoundingBox &bb)
 Create a Polytope which is a equivalent to BoundingBox. More...
 
void setAndTransformProvidingInverse (const Polytope &pt, const osg::Matrix &matrix)
 
void set (const PlaneList &pl)
 
void add (const osg::Plane &pl)
 
void flip ()
 flip/reverse the orientation of all the planes. More...
 
bool empty () const
 
PlaneList & getPlaneList ()
 
const PlaneList & getPlaneList () const
 
void setReferenceVertexList (VertexList &vertices)
 
VertexListgetReferenceVertexList ()
 
const VertexListgetReferenceVertexList () const
 
void setupMask ()
 
ClippingMask & getCurrentMask ()
 
ClippingMask getCurrentMask () const
 
void setResultMask (ClippingMask mask)
 
ClippingMask getResultMask () const
 
MaskStackgetMaskStack ()
 
const MaskStackgetMaskStack () const
 
void pushCurrentMask ()
 
void popCurrentMask ()
 
bool contains (const osg::Vec3 &v) const
 Check whether a vertex is contained within clipping set. More...
 
bool contains (const std::vector< Vec3 > &vertices)
 Check whether any part of vertex list is contained within clipping set. More...
 
bool contains (const osg::BoundingSphere &bs)
 Check whether any part of a bounding sphere is contained within clipping set. More...
 
bool contains (const osg::BoundingBox &bb)
 Check whether any part of a bounding box is contained within clipping set. More...
 
bool containsAllOf (const std::vector< Vec3 > &vertices)
 Check whether all of vertex list is contained with clipping set. More...
 
bool containsAllOf (const osg::BoundingSphere &bs)
 Check whether the entire bounding sphere is contained within clipping set. More...
 
bool containsAllOf (const osg::BoundingBox &bb)
 Check whether the entire bounding box is contained within clipping set. More...
 
void transform (const osg::Matrix &matrix)
 Transform the clipping set by matrix. More...
 
void transformProvidingInverse (const osg::Matrix &matrix)
 Transform the clipping set by provide a pre inverted matrix. More...
 

Protected Attributes

MaskStack _maskStack
 
ClippingMask _resultMask
 
PlaneList _planeList
 
VertexList _referenceVertexList
 

Detailed Description

A Polytope class for representing convex clipping volumes made up of a set of planes.

When adding planes, their normals should point inwards (into the volume)

Member Function Documentation

◆ contains() [1/4]

bool osg::Polytope::contains ( const osg::Vec3 v) const
inline

Check whether a vertex is contained within clipping set.

◆ contains() [2/4]

bool osg::Polytope::contains ( const std::vector< Vec3 > &  vertices)
inline

Check whether any part of vertex list is contained within clipping set.

◆ contains() [3/4]

bool osg::Polytope::contains ( const osg::BoundingSphere bs)
inline

Check whether any part of a bounding sphere is contained within clipping set.

Using a mask to determine which planes should be used for the check, and modifying the mask to turn off planes which wouldn't contribute to clipping of any internal objects. This feature is used in osgUtil::CullVisitor to prevent redundant plane checking.

◆ contains() [4/4]

bool osg::Polytope::contains ( const osg::BoundingBox &  bb)
inline

Check whether any part of a bounding box is contained within clipping set.

Using a mask to determine which planes should be used for the check, and modifying the mask to turn off planes which wouldn't contribute to clipping of any internal objects. This feature is used in osgUtil::CullVisitor to prevent redundant plane checking.

◆ containsAllOf() [1/3]

bool osg::Polytope::containsAllOf ( const std::vector< Vec3 > &  vertices)
inline

Check whether all of vertex list is contained with clipping set.

◆ containsAllOf() [2/3]

bool osg::Polytope::containsAllOf ( const osg::BoundingSphere bs)
inline

Check whether the entire bounding sphere is contained within clipping set.

◆ containsAllOf() [3/3]

bool osg::Polytope::containsAllOf ( const osg::BoundingBox &  bb)
inline

Check whether the entire bounding box is contained within clipping set.

◆ flip()

void osg::Polytope::flip ( )
inline

flip/reverse the orientation of all the planes.

◆ setToBoundingBox()

void osg::Polytope::setToBoundingBox ( const BoundingBox &  bb)
inline

Create a Polytope which is a equivalent to BoundingBox.

◆ setToUnitFrustum()

void osg::Polytope::setToUnitFrustum ( bool  withNear = true,
bool  withFar = true 
)
inline

Create a Polytope which is a cube, centered at 0,0,0, with sides of 2 units.

◆ transform()

void osg::Polytope::transform ( const osg::Matrix matrix)
inline

Transform the clipping set by matrix.

Note, this operations carries out the calculation of the inverse of the matrix since a plane must be multiplied by the inverse transposed to transform it. This makes this operation expensive. If the inverse has been already calculated elsewhere then use transformProvidingInverse() instead. See http://www.worldserver.com/turk/computergraphics/NormalTransformations.pdf

◆ transformProvidingInverse()

void osg::Polytope::transformProvidingInverse ( const osg::Matrix matrix)
inline

Transform the clipping set by provide a pre inverted matrix.

see transform for details.


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