osg::Polytope Class Reference

`#include <Polytope>`

## Public Types

typedef unsigned int | ClippingMask
typedef std::vector< Plane > | PlaneList
typedef std::vector< Vec3 > | VertexList
typedef fast_back_stack< ClippingMask > | MaskStack

## Public Member Functions

| Polytope ()
| Polytope (const Polytope &cv)
| Polytope (const PlaneList &pl)
| ~Polytope ()
void | clear ()
Polytope & | operator= (const Polytope &cv)
void | setToUnitFrustum (bool withNear=true, bool withFar=true)
void | setToBoundingBox (const BoundingBox &bb)
void | setAndTransformProvidingInverse (const Polytope &pt, const osg::Matrix &matrix)
void | set (const PlaneList &pl)
void | add (const osg::Plane &pl)
void | flip ()
bool | empty () const
PlaneList & | getPlaneList ()
const PlaneList & | getPlaneList () const
void | setReferenceVertexList (VertexList &vertices)
VertexList & | getReferenceVertexList ()
const VertexList & | getReferenceVertexList () const
void | setupMask ()
ClippingMask & | getCurrentMask ()
ClippingMask | getCurrentMask () const
void | setResultMask (ClippingMask mask)
ClippingMask | getResultMask () const
MaskStack & | getMaskStack ()
const MaskStack & | getMaskStack () const
void | pushCurrentMask ()
void | popCurrentMask ()
bool | contains (const osg::Vec3 &v) const
bool | contains (const std::vector< Vec3 > &vertices)
bool | contains (const osg::BoundingSphere &bs)
bool | contains (const osg::BoundingBox &bb)
bool | containsAllOf (const std::vector< Vec3 > &vertices)
bool | containsAllOf (const osg::BoundingSphere &bs)
bool | containsAllOf (const osg::BoundingBox &bb)
bool | contains (const osg::Vec3f &v0, const osg::Vec3f &v1, const osg::Vec3f &v2) const
void | transform (const osg::Matrix &matrix)
void | transformProvidingInverse (const osg::Matrix &matrix)

## 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 Typedef Documentation

## ClippingMask

typedef unsigned int osg::Polytope::ClippingMask

## MaskStack

typedef fast_back_stack<ClippingMask> osg::Polytope::MaskStack

## PlaneList

typedef std::vector<Plane> osg::Polytope::PlaneList

## VertexList

typedef std::vector<Vec3> osg::Polytope::VertexList

## Constructor & Destructor Documentation

## Polytope() [1/3]

osg::Polytope::Polytope | ( |  | ) |

inline

References setupMask().

Referenced by operator=(), Polytope(), and setAndTransformProvidingInverse().

## Polytope() [2/3]

osg::Polytope::Polytope | ( | const Polytope & | cv | ) |

inline

References _maskStack, _planeList, _referenceVertexList, _resultMask, and Polytope().

## Polytope() [3/3]

osg::Polytope::Polytope | ( | const PlaneList & | pl | ) |

inline

References _planeList, and setupMask().

## ~Polytope()

osg::Polytope::~Polytope | ( |  | ) |

inline

## Member Function Documentation

## add()

void osg::Polytope::add | ( | const osg::Plane & | pl | ) |

inline

References _planeList, and setupMask().

## clear()

void osg::Polytope::clear | ( |  | ) |

inline

References _planeList, and setupMask().

## contains() [1/5]

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.

References _maskStack, _planeList, and _resultMask.

## contains() [2/5]

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.

References _maskStack, _planeList, and _resultMask.

## contains() [3/5]

bool osg::Polytope::contains | ( | const osg::Vec3 & | v | ) | const

inline

Check whether a vertex is contained within clipping set.

References _maskStack, and _planeList.

## contains() [4/5]

bool osg::Polytope::contains | ( | const osg::Vec3f & | v0,
|  | const osg::Vec3f & | v1,
|  | const osg::Vec3f & | v2 ) const

Check whether any part of a triangle is contained within the polytope.

## contains() [5/5]

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

inline

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

References _maskStack, _planeList, and _resultMask.

## containsAllOf() [1/3]

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

inline

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

References _maskStack, _planeList, and _resultMask.

## containsAllOf() [2/3]

bool osg::Polytope::containsAllOf | ( | const osg::BoundingSphere & | bs | ) |

inline

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

References _maskStack, _planeList, and _resultMask.

## containsAllOf() [3/3]

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

inline

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

References _maskStack, _planeList, and _resultMask.

## empty()

bool osg::Polytope::empty | ( |  | ) | const

inline

References _planeList.

## flip()

void osg::Polytope::flip | ( |  | ) |

inline

flip/reverse the orientation of all the planes.

References _planeList.

## getCurrentMask() [1/2]

ClippingMask & osg::Polytope::getCurrentMask | ( |  | ) |

inline

References _maskStack.

## getCurrentMask() [2/2]

ClippingMask osg::Polytope::getCurrentMask | ( |  | ) | const

inline

References _maskStack.

## getMaskStack() [1/2]

MaskStack & osg::Polytope::getMaskStack | ( |  | ) |

inline

References _maskStack.

## getMaskStack() [2/2]

const MaskStack & osg::Polytope::getMaskStack | ( |  | ) | const

inline

References _maskStack.

## getPlaneList() [1/2]

PlaneList & osg::Polytope::getPlaneList | ( |  | ) |

inline

References _planeList.

Referenced by osgUtil::CullVisitor::MatrixPlanesDrawables::set().

## getPlaneList() [2/2]

const PlaneList & osg::Polytope::getPlaneList | ( |  | ) | const

inline

References _planeList.

## getReferenceVertexList() [1/2]

VertexList & osg::Polytope::getReferenceVertexList | ( |  | ) |

inline

References _referenceVertexList.

## getReferenceVertexList() [2/2]

const VertexList & osg::Polytope::getReferenceVertexList | ( |  | ) | const

inline

References _referenceVertexList.

## getResultMask()

ClippingMask osg::Polytope::getResultMask | ( |  | ) | const

inline

References _resultMask.

Referenced by osgUtil::CullVisitor::MatrixPlanesDrawables::set().

## operator=()

Polytope & osg::Polytope::operator= | ( | const Polytope & | cv | ) |

inline

References _maskStack, _planeList, _referenceVertexList, _resultMask, and Polytope().

## popCurrentMask()

void osg::Polytope::popCurrentMask | ( |  | ) |

inline

References _maskStack.

## pushCurrentMask()

void osg::Polytope::pushCurrentMask | ( |  | ) |

inline

References _maskStack, and _resultMask.

## set()

void osg::Polytope::set | ( | const PlaneList & | pl | ) |

inline

References _planeList, and setupMask().

## setAndTransformProvidingInverse()

void osg::Polytope::setAndTransformProvidingInverse | ( | const Polytope & | pt,
|  | const osg::Matrix & | matrix )

inline

References _maskStack, _planeList, _referenceVertexList, _resultMask, osg::fast_back_stack< T >::back(), and Polytope().

## setReferenceVertexList()

void osg::Polytope::setReferenceVertexList | ( | VertexList & | vertices | ) |

inline

References _referenceVertexList.

## setResultMask()

void osg::Polytope::setResultMask | ( | ClippingMask | mask | ) |

inline

References _resultMask.

## setToBoundingBox()

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

inline

Create a Polytope which is a equivalent to BoundingBox.

References _planeList, setupMask(), osg::BoundingBoxImpl< VT >::xMax(), osg::BoundingBoxImpl< VT >::xMin(), osg::BoundingBoxImpl< VT >::yMax(), osg::BoundingBoxImpl< VT >::yMin(), osg::BoundingBoxImpl< VT >::zMax(), and osg::BoundingBoxImpl< VT >::zMin().

## 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.

References _planeList, and setupMask().

## setupMask()

void osg::Polytope::setupMask | ( |  | ) |

inline

References _maskStack, _planeList, and _resultMask.

Referenced by add(), clear(), Polytope(), Polytope(), set(), setToBoundingBox(), and setToUnitFrustum().

## 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

References osg::Matrixd::invert(), and transformProvidingInverse().

## transformProvidingInverse()

void osg::Polytope::transformProvidingInverse | ( | const osg::Matrix & | matrix | ) |

inline

Transform the clipping set by provide a pre inverted matrix. see transform for details.

References _maskStack, _planeList, and _resultMask.

Referenced by transform().

## Member Data Documentation

## _maskStack

MaskStack osg::Polytope::_maskStack

protected

Referenced by contains(), contains(), contains(), contains(), containsAllOf(), containsAllOf(), containsAllOf(), getCurrentMask(), getCurrentMask(), getMaskStack(), getMaskStack(), operator=(), Polytope(), popCurrentMask(), pushCurrentMask(), setAndTransformProvidingInverse(), setupMask(), and transformProvidingInverse().

## _planeList

PlaneList osg::Polytope::_planeList

protected

Referenced by add(), clear(), contains(), contains(), contains(), contains(), containsAllOf(), containsAllOf(), containsAllOf(), empty(), flip(), getPlaneList(), getPlaneList(), operator=(), Polytope(), Polytope(), set(), setAndTransformProvidingInverse(), setToBoundingBox(), setToUnitFrustum(), setupMask(), and transformProvidingInverse().

## _referenceVertexList

VertexList osg::Polytope::_referenceVertexList

protected

Referenced by getReferenceVertexList(), getReferenceVertexList(), operator=(), Polytope(), setAndTransformProvidingInverse(), and setReferenceVertexList().

## _resultMask

ClippingMask osg::Polytope::_resultMask

protected

Referenced by contains(), contains(), contains(), containsAllOf(), containsAllOf(), containsAllOf(), getResultMask(), operator=(), Polytope(), pushCurrentMask(), setAndTransformProvidingInverse(), setResultMask(), setupMask(), and transformProvidingInverse().

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

- Polytope