VR-Forces 5.0.1 Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions
DtSpatialVrfObjectManager Class Reference

Implementation of a spatial object manager based on DtSpatialSubdivision.

Inheritance diagram for DtSpatialVrfObjectManager:
Inheritance graph
[legend]

Public Types

typedef DtSpatialSubdivision
< const DtSimObject * > 
DtSpatialContainer
 
typedef std::vector< const
DtSimObject * > 
DtNonSpatialContainer
 
typedef
DtNonSpatialContainer::iterator 
DtNonSpatialVrfObjectIter
 
typedef
DtNonSpatialContainer::const_iterator 
DtNonSpatialVrfObjectConstIter
 
- Public Types inherited from DtSpatialVrfObjectManagerInterface
typedef std::vector< const
DtSimObject * > 
DtVrfObjectUniqueContainer
 
typedef std::vector< const
DtSimObject * > 
DtVrfConstObjectUniqueContainer
 
typedef std::vector< const
DtSimObject * > 
DtVrfObjectContainer
 

Public Member Functions

 DtSpatialVrfObjectManager (unsigned int xRes=1, unsigned int yRes=1, unsigned int zRes=1)
 
virtual ~DtSpatialVrfObjectManager ()
 
virtual bool initialize (const DtManagedObjectListConstPtr &vrfObjects, unsigned int cellCountX, unsigned int cellCountY, unsigned int cellCountZ)
 
virtual void addVrfObjects (const DtManagedObjectListConstPtr &vrfObjects)
 
virtual void removeVrfObject (const DtSimObject *vrfObject)
 
virtual void clearVrfObjects ()
 
virtual bool setResolutions (unsigned int xRes, unsigned int yRes, unsigned int zRes)
 
virtual unsigned int xResolution () const
 
virtual unsigned int yResolution () const
 
virtual unsigned int zResolution () const
 
virtual void resolutions (unsigned int &xRes, unsigned int &yRes, unsigned int &zRes) const
 
virtual void reset (const DtManagedObjectListConstPtr &vrfObjects)
 
bool getVrfObjects (const DtExtent &extent, DtVrfConstObjectUniqueContainer &objects) const override
 
bool getVrfObjects (const DtVrfObjectPredicate &predicate, const DtExtent &extent, DtVrfConstObjectUniqueContainer &objects) const override
 
bool getVrfObjects (const DtChord &chord, std::list< const DtSimObject * > &objects) const override
 
bool getVrfObjects (const DtVrfObjectPredicate &predicate, const DtChord &chord, std::list< const DtSimObject * > &objects) const override
 
void visitVrfObjects (const DtExtent &extent, DtSpatialSelectionFunctor &callback) const override
 
void visitVrfObjects (const DtChord &chord, DtSpatialSelectionFunctor &callback) const override
 
virtual const DtSpatialContainerspatialContainer () const
 
virtual DtSpatialContainerspatialContainer ()
 
virtual const
DtNonSpatialContainer
nonSpatiallyOrganizedObjects () const
 
virtual DtNonSpatialContainernonSpatiallyOrganizedObjects ()
 
- Public Member Functions inherited from DtSpatialVrfObjectManagerInterface
virtual ~DtSpatialVrfObjectManagerInterface ()
 
virtual unsigned int numObjects () const =0
 

Protected Member Functions

virtual bool createSpatialContainer (const DtExtent &extent, unsigned int cellCountX, unsigned int cellCountY, unsigned int cellCountZ)
 
virtual void setExtent (const DtManagedObjectListConstPtr &vrfObjects)
 
virtual void expandExtent (const DtManagedObjectListConstPtr &vrfObjects, DtExtent &expandedExtent) const
 
bool testInvariant () const
 

Protected Attributes

DtSpatialContainermyVrfObjectSpatialContainer
 
DtNonSpatialContainer myNonSpatiallyOrganizedObjects
 

Private Member Functions

 DtSpatialVrfObjectManager (const DtSpatialVrfObjectManager &original)
 
DtSpatialVrfObjectManageroperator= (const DtSpatialVrfObjectManager &original)
 

Member Typedef Documentation

typedef DtNonSpatialContainer::iterator DtSpatialVrfObjectManager::DtNonSpatialVrfObjectIter
typedef DtNonSpatialContainer::const_iterator DtSpatialVrfObjectManager::DtNonSpatialVrfObjectConstIter

Constructor & Destructor Documentation

DtSpatialVrfObjectManager::DtSpatialVrfObjectManager ( unsigned int  xRes = 1,
unsigned int  yRes = 1,
unsigned int  zRes = 1 
)

Constructor Creates a default container, with a single cell unless the resolutions are otherwise specified.

virtual DtSpatialVrfObjectManager::~DtSpatialVrfObjectManager ( )
virtual

Destructor.

DtSpatialVrfObjectManager::DtSpatialVrfObjectManager ( const DtSpatialVrfObjectManager original)
private

Copy constructor and assignment operator not implemented.

Member Function Documentation

DtSpatialVrfObjectManager& DtSpatialVrfObjectManager::operator= ( const DtSpatialVrfObjectManager original)
private
virtual bool DtSpatialVrfObjectManager::initialize ( const DtManagedObjectListConstPtr vrfObjects,
unsigned int  cellCountX,
unsigned int  cellCountY,
unsigned int  cellCountZ 
)
virtual

Initializes the spatial object manager. This includes creating and initializing spatial container managed by this class.

Must be called immediately after creation and before any operations are performed or the container used in any way.

virtual void DtSpatialVrfObjectManager::addVrfObjects ( const DtManagedObjectListConstPtr vrfObjects)
virtual

Spatially sorts the vrfObjects associated in the vrfObjects.

Note
Implementation detail: If the objects do not fit into the spatial container, then they are stored in a non-spatially sorted container.

Implements DtSpatialVrfObjectManagerInterface.

virtual void DtSpatialVrfObjectManager::removeVrfObject ( const DtSimObject vrfObject)
virtual

Removes vrfObject from the set of vrfObjects we are maintaining.

Parameters
vrfObjectPointer to the object to be removed.

Implements DtSpatialVrfObjectManagerInterface.

virtual void DtSpatialVrfObjectManager::clearVrfObjects ( )
virtual

Clears all managed objects from the manager. Does not affect the spatial container, other than to empty its cells of any elements.

Implements DtSpatialVrfObjectManagerInterface.

virtual bool DtSpatialVrfObjectManager::setResolutions ( unsigned int  xRes,
unsigned int  yRes,
unsigned int  zRes 
)
virtual

Deprecated – doesn't apply to octree manager. Still necessary for DtSpatialVrfObjectManager. TODO need to push this all into the manager class, instead of having the DtPhysicalWorld assume that things are uniformly subdivided.

Implements DtSpatialVrfObjectManagerInterface.

virtual unsigned int DtSpatialVrfObjectManager::xResolution ( ) const
virtual
Returns
The resolution in the X dimension.
virtual unsigned int DtSpatialVrfObjectManager::yResolution ( ) const
virtual
Returns
The resolution in the Y dimension.
virtual unsigned int DtSpatialVrfObjectManager::zResolution ( ) const
virtual
Returns
The resolution in the Z dimension.
virtual void DtSpatialVrfObjectManager::resolutions ( unsigned int xRes,
unsigned int yRes,
unsigned int zRes 
) const
virtual
Returns
The resolution in each dimension in the specified output parameters.
virtual void DtSpatialVrfObjectManager::reset ( const DtManagedObjectListConstPtr vrfObjects)
virtual

Clears out the current subdivision, sets it to have the minimum extent, that contains all of the DtSimObjects specified, and adds the specified DtSimObjects.

Note
This is provided as a memory optimization. Deleting and reallocating the spatial subdivision every tick was inefficient. So the spatial container is just cleared and resized to adjust for entities moving, being created destroyed, etc. This has the benefit of not causing a large memory reallocation, but at the disadvantage of not allowing the spatial subdivision to change its resolution.

Implements DtSpatialVrfObjectManagerInterface.

void DtSpatialVrfObjectManager::visitVrfObjects ( const DtExtent extent,
DtSpatialSelectionFunctor callback 
) const
overridevirtual

Functions that call the specified functor for every object intersecting the requested region (whether chord or extent). The functor should return false while additional processing should be done, and true if processing is complete and visitVrfObjects() should return. Note that processing is not guaranteed to stop immediately when the functor returns true; it is only a recommendation that processing can stop at any time.

Note
The functor may, and probably will, be called for additional DtSimObjects when a primitive is supplied. We are only guaranteed not to miss any that do intersect.

Implements DtSpatialVrfObjectManagerInterface.

void DtSpatialVrfObjectManager::visitVrfObjects ( const DtChord chord,
DtSpatialSelectionFunctor callback 
) const
overridevirtual
virtual const DtSpatialContainer* DtSpatialVrfObjectManager::spatialContainer ( ) const
virtual
Returns
A pointer to the spatial container of vrfObjects.
virtual DtSpatialContainer* DtSpatialVrfObjectManager::spatialContainer ( )
virtual
virtual const DtNonSpatialContainer* DtSpatialVrfObjectManager::nonSpatiallyOrganizedObjects ( ) const
virtual
Returns
A pointer to the container of non-spatially organized objects
virtual DtNonSpatialContainer* DtSpatialVrfObjectManager::nonSpatiallyOrganizedObjects ( )
virtual
virtual bool DtSpatialVrfObjectManager::createSpatialContainer ( const DtExtent extent,
unsigned int  cellCountX,
unsigned int  cellCountY,
unsigned int  cellCountZ 
)
protectedvirtual

Creates an empty spatial container with the specified extent and resolution.

Returns
A boolean indicating success or failure in creating the container.
virtual void DtSpatialVrfObjectManager::setExtent ( const DtManagedObjectListConstPtr vrfObjects)
protectedvirtual

Updates the spatial container's extent to encompasses all the vrfObjects specified by the vrfObject iterator. This does not insert the specified vrfObjects into the spatial container.

Note
This will clear the spatial container of all currently managed objects.
The spatial subdivision member is assumed be valid when this is called. If it is not, nothing is done.
See Also
expandExtentToIncludeVrfObjects
virtual void DtSpatialVrfObjectManager::expandExtent ( const DtManagedObjectListConstPtr vrfObjects,
DtExtent expandedExtent 
) const
protectedvirtual

Expands the specified extent to include all the extents of all vrfObjects specified in the vrfObject iterator.

bool DtSpatialVrfObjectManager::testInvariant ( ) const
protected
Returns
a boolean indicating whether or not the class is respecting its invariant or not. If not, returns false.

Member Data Documentation

DtSpatialContainer* DtSpatialVrfObjectManager::myVrfObjectSpatialContainer
protected

Spatial container of DtSimObjects. (a pointer because it is not guaranteed to exist at construction.)

DtNonSpatialContainer DtSpatialVrfObjectManager::myNonSpatiallyOrganizedObjects
protected

Container of objects that fall outside of the spatial subdivision. This is necessary because the spatial subdivision, as configured, may not contain all the vrfObjects specified. Thus the ones that do not fit in the spatial subdivision are stored in this container.


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

Document ID: Generated on Mon Jun 20 00:38:30 EDT 2022 from SVN revision 244029
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)