Coin  4.0.3
Coin3D core library
Loading...
Searching...
No Matches
SoBoundingBoxCache Class Reference

The SoBoundingBoxCache class is used to cache bounding boxes. More...

#include <Inventor/caches/SoBoundingBoxCache.h>

Inheritance diagram for SoBoundingBoxCache:
SoCache

Public Member Functions

 SoBoundingBoxCache (SoState *state)
 
virtual ~SoBoundingBoxCache ()
 
const SbXfBox3fgetBox () const
 
const SbVec3fgetCenter () const
 
const SbBox3fgetProjectedBox () const
 
SbBool hasLinesOrPoints (void) const
 
SbBool isCenterSet () const
 
void set (const SbXfBox3f &boundingbox, SbBool centerset, const SbVec3f &centerpoint)
 
- Public Member Functions inherited from SoCache
 SoCache (SoState *const state)
 
virtual void addCacheDependency (const SoState *state, SoCache *cache)
 
void addElement (const SoElement *const elem)
 
const SoElementgetInvalidElement (const SoState *const state) const
 
void invalidate (void)
 
virtual SbBool isValid (const SoState *state) const
 
void ref (void)
 
void unref (SoState *state=NULL)
 

Static Public Member Functions

static void setHasLinesOrPoints (SoState *state)
 

Additional Inherited Members

- Protected Member Functions inherited from SoCache
virtual ~SoCache ()
 
virtual void destroy (SoState *state)
 

Detailed Description

The SoBoundingBoxCache class is used to cache bounding boxes.

Constructor & Destructor Documentation

◆ SoBoundingBoxCache()

SoBoundingBoxCache::SoBoundingBoxCache ( SoState * state)

Constructor with state being the current state.

◆ ~SoBoundingBoxCache()

SoBoundingBoxCache::~SoBoundingBoxCache ( )
virtual

Destructor.

Member Function Documentation

◆ getBox()

const SbXfBox3f & SoBoundingBoxCache::getBox ( void ) const

Returns the bounding box for this cache.

◆ getCenter()

const SbVec3f & SoBoundingBoxCache::getCenter ( void ) const

Returns the center of the bounding box. Should only be used if SoBoundingBoxCache::isCenterSet() returns TRUE.

◆ getProjectedBox()

const SbBox3f & SoBoundingBoxCache::getProjectedBox ( void ) const

Returns the projected bounding box for this cache.

◆ hasLinesOrPoints()

SbBool SoBoundingBoxCache::hasLinesOrPoints ( void ) const

Return TRUE if the hasLinesOrPoints flag has been set.

See also
setHasLinesOrPoints()

◆ isCenterSet()

SbBool SoBoundingBoxCache::isCenterSet ( void ) const

Returns whether the center of the bounding box was set in the SoBoundingBoxCache::set() method.

See also
SoBoundingBoxCache::getCenter()

◆ set()

void SoBoundingBoxCache::set ( const SbXfBox3f & boundingbox,
SbBool centerset,
const SbVec3f & centerpoint )

Sets the data for this cache. boundingBox is the node's bounding box, centerSet and centerPoints specifies the center of the geometry inside boundingBox.

◆ setHasLinesOrPoints()

void SoBoundingBoxCache::setHasLinesOrPoints ( SoState * state)
static

Sets the flag returned from SoBoundingBoxCache::hasLinesOrPoints() to TRUE for all open bounding box caches.

The reason bounding box caches keep a lines-or-points flag is to make it known to client code if the shape(s) they contain have any of these primitives – or are rendered with these primitives. The reason this is important to know for the client code is because it might need to add an "epsilon" slack value to the calculated bounding box to account for smoothing / anti-aliasing effects in the renderer, so line and point graphics are not accidentally clipped by near and far clipping planes, for instance.

This method is a static method on the class. It will upon invocation scan through the state stack and set the flag for all open SoBoundingBoxCache elements. It has been made to work like this so it can easily be invoked on all current bounding box cache instances from the SoShape-type nodes using lines and / or point primitives.

See also
hasLinesOrPoints()

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