VR-Forces 4.0.4 Class Documentation
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions
DtCollisionDetector Class Reference

The DtCollisionDetector is a class used to detect collisions between a specified list of obstructions, by vector obstruction ID and by DtVrfObject obstruction IDs, and a specified Dt3dBoundingVolume. More...

List of all members.

Public Types

typedef std::set< DtObjectTypeDtObjectObstructionIDContainer
typedef
DtObjectObstructionIDContainer::iterator 
DtObjectObstructionIDIter
typedef
DtObjectObstructionIDContainer::const_iterator 
DtObjectObstructionIDConstIter
typedef std::list
< DtVectorObstructionID
DtVectorObstructionIDContainer
typedef
DtVectorObstructionIDContainer::iterator 
DtVectorObstructionIDIter
typedef
DtVectorObstructionIDContainer::const_iterator 
DtVectorObstructionIDConstIter
typedef std::set< DtVrfObject * > DtObjectObstructionContainer
typedef
DtObjectObstructionContainer::iterator 
DtObjectObstructionIter
typedef
DtObjectObstructionContainer::const_iterator 
DtObjectObstructionConstIter
typedef std::set
< DtVectorObstruction * > 
DtVectorObstructionContainer
typedef
DtVectorObstructionContainer::iterator 
DtVectorObstructionIter
typedef
DtVectorObstructionContainer::const_iterator 
DtVectorObstructionConstIter

Public Member Functions

 DtCollisionDetector (DtSimManager *simManager)
 constructor
virtual ~DtCollisionDetector ()
 destructor
virtual void setObjectToIgnore (DtVrfObject *vrfObject)
virtual bool detectPotentialCollision (Dt3dBoundingVolume &collisionBv, const DtVector &localPosition, const DtDcm &bvOrientation, DtCollision *&potentialCollision)
 Calculates the closest potential collision among all the defined obstructions in the scene.
virtual bool detectAllEntityCollisions (Dt3dBoundingVolume &collisionBv, const DtVector &localPosition, const DtDcm &bvOrientation, std::list< DtBoost::shared_ptr< DtEntityCollision > > &collisionList)
 Finds all the entities within the provided collisionBv.
virtual bool getObjectObstructions (DtObjectObstructionContainer &objectObstructions) const
 Requests, from the Object Manager, pointers to all of the DtVrfObject types that have been specified as obstructions.
virtual bool getObjectObstructions (Dt3dBoundingVolume &boundingVolume, const DtVector &bvLocation, const DtDcm &bvOrientation, DtObjectObstructionContainer &objectObstructions) const
virtual bool vrfObjectObstructionPredicate (const DtVrfObject &vrfObjectToTest) const
 This function is used to filter out vrfObjects that are not appropriate for some reason.
virtual bool getVectorObstructions (DtVectorObstructionContainer &vectorObstructions) const
 Selects all appropriate vector network elements from the vector network, as specified by the vector obstruction IDs.
virtual bool getVectorObstructions (Dt3dBoundingVolume &boundingVolume, const DtVector &bvLocation, const DtDcm &bvOrientation, DtVectorObstructionContainer &obstructionsToTest) const
virtual bool checkForCollision (Dt3dBoundingVolume &collisionBV, DtCollision &potentialCollision, const DtVector &localPosition, const DtDcm &bvOrientation) const
 Determines if the specified entities collide or not.
virtual void addObjectObstructionID (const DtObjectType &objectObstructionID)
 Add/Remove the specified obstruction IDs.
virtual void addVectorObstructionID (const DtVectorObstructionID &vectorObstructionIDs)
 Add/Remove the specified obstruction IDs.
virtual void removeObjectObstructionID (const DtObjectType &objectObstructionID)
 Add/Remove the specified obstruction IDs.
virtual void removeVectorObstructionID (const DtVectorObstructionID &vectorObstructionID)
 Add/Remove the specified obstruction IDs.
virtual void setObjectObstructionIDs (const DtObjectObstructionIDContainer &objectIDs)
 Clears and sets IDs to the specified list.
virtual void setVectorObstructionIDs (const DtVectorObstructionIDContainer &vectorIDs)
 Clears and sets IDs to the specified list.
virtual DtObjectObstructionIDIter objectIDsBegin ()
virtual
DtObjectObstructionIDConstIter 
objectIDsBegin () const
virtual DtVectorObstructionIDIter vectorIDsBegin ()
virtual
DtVectorObstructionIDConstIter 
vectorIDsBegin () const
virtual DtObjectObstructionIDIter objectIDsEnd ()
virtual
DtObjectObstructionIDConstIter 
objectIDsEnd () const
virtual DtVectorObstructionIDIter vectorIDsEnd ()
virtual
DtVectorObstructionIDConstIter 
vectorIDsEnd () const

Protected Member Functions

bool detectNewClosestCollision (Dt3dBoundingVolume &collisionBV, DtCollision *&potentialCollision, const DtVector &localPosition, const DtDcm &bvOrientation) const
 Determines if the entity is potentially or currently colliding with any obstructions.
bool detectObjectCollision (Dt3dBoundingVolume &collisionBV, DtCollisionProcessor< DtEntityCollision > &collisionProcessor, const DtVector &localPosition, const DtDcm &bvOrientation) const
 Determines if the entity is potentially or currently colliding with any obstructions of the specified types.
bool detectVectorCollision (Dt3dBoundingVolume &collisionBV, DtCollisionProcessor< DtVectorObstructionCollision > &, const DtVector &localPosition, const DtDcm &bvOrientation) const
DtCollisionprimaryCollision (DtCollision *firstCollision, DtCollision *secondCollision) const
bool testInvariant () const

Protected Attributes

DtObjectObstructionIDContainer myObjectObstructionIDs
 The obstruction IDs.
DtVectorObstructionIDContainer myVectorObstructionIDs
DtSimManagermySimManager
DtVrfObjectmyObjectToIgnore
 This object (if set) will not be reported as a collision.

Private Member Functions

 DtCollisionDetector (const DtCollisionDetector &orig)
 copy constructor; not implemented
DtCollisionDetectoroperator= (const DtCollisionDetector &orig)
 assignment operator; not implemented

Detailed Description

The DtCollisionDetector is a class used to detect collisions between a specified list of obstructions, by vector obstruction ID and by DtVrfObject obstruction IDs, and a specified Dt3dBoundingVolume.

This class is used by the DtObstructionSensor to determine potential collisions (with the specified obstructions).

General operation: The collision detector is initialized


Member Typedef Documentation

typedef DtObjectObstructionIDContainer::iterator DtCollisionDetector::DtObjectObstructionIDIter
typedef DtObjectObstructionIDContainer::const_iterator DtCollisionDetector::DtObjectObstructionIDConstIter
typedef DtVectorObstructionIDContainer::iterator DtCollisionDetector::DtVectorObstructionIDIter
typedef DtVectorObstructionIDContainer::const_iterator DtCollisionDetector::DtVectorObstructionIDConstIter
typedef DtObjectObstructionContainer::iterator DtCollisionDetector::DtObjectObstructionIter
typedef DtObjectObstructionContainer::const_iterator DtCollisionDetector::DtObjectObstructionConstIter
typedef DtVectorObstructionContainer::iterator DtCollisionDetector::DtVectorObstructionIter
typedef DtVectorObstructionContainer::const_iterator DtCollisionDetector::DtVectorObstructionConstIter

Constructor & Destructor Documentation

constructor

Parameters:
simManagerA convenience pointer to the symManager, for use in getting the lists of vrfObject obstructions, vector obstructions, etc. The collision detector does not maintain any ownership at all over this simManager.
objectToMonitorThe DtVrfObject that is associated with this detector. This is used to get entity related information, such as location, orientation, bounding volume, etc.

destructor

copy constructor; not implemented


Member Function Documentation

DtCollisionDetector& DtCollisionDetector::operator= ( const DtCollisionDetector orig) [private]

assignment operator; not implemented

virtual void DtCollisionDetector::setObjectToIgnore ( DtVrfObject vrfObject) [virtual]
See also:
myObjectToIgnore
virtual void DtCollisionDetector::addObjectObstructionID ( const DtObjectType objectObstructionID) [virtual]

Add/Remove the specified obstruction IDs.

virtual void DtCollisionDetector::addVectorObstructionID ( const DtVectorObstructionID vectorObstructionIDs) [virtual]

Add/Remove the specified obstruction IDs.

virtual void DtCollisionDetector::removeObjectObstructionID ( const DtObjectType objectObstructionID) [virtual]

Add/Remove the specified obstruction IDs.

virtual void DtCollisionDetector::removeVectorObstructionID ( const DtVectorObstructionID vectorObstructionID) [virtual]

Add/Remove the specified obstruction IDs.

Clears and sets IDs to the specified list.

Clears and sets IDs to the specified list.

Returns:
An iterator to the first/last elements in the obstruction containers
Returns:
An iterator to the first/last elements in the obstruction containers
Returns:
An iterator to the first/last elements in the obstruction containers
Returns:
An iterator to the first/last elements in the obstruction containers
Returns:
An iterator to the first/last elements in the obstruction containers
Returns:
An iterator to the first/last elements in the obstruction containers
Returns:
An iterator to the first/last elements in the obstruction containers
Returns:
An iterator to the first/last elements in the obstruction containers
virtual bool DtCollisionDetector::detectPotentialCollision ( Dt3dBoundingVolume &  collisionBv,
const DtVector localPosition,
const DtDcm &  bvOrientation,
DtCollision *&  potentialCollision 
) [virtual]

Calculates the closest potential collision among all the defined obstructions in the scene.

Parameters:
potentialCollisionAn assumed to be empty DtCollision object which will contain the closest potential collision data if one is detected.
Returns:
A boolean indicating the presence of a collision or not. Returns true if a collision is detected. False otherwise.
See also:
getObstructions()
checkEntityForCollision()
virtual bool DtCollisionDetector::detectAllEntityCollisions ( Dt3dBoundingVolume &  collisionBv,
const DtVector localPosition,
const DtDcm &  bvOrientation,
std::list< DtBoost::shared_ptr< DtEntityCollision > > &  collisionList 
) [virtual]

Finds all the entities within the provided collisionBv.

Caller is responsible for deleting collision item returned on the list.

virtual bool DtCollisionDetector::getObjectObstructions ( DtObjectObstructionContainer objectObstructions) const [virtual]

Requests, from the Object Manager, pointers to all of the DtVrfObject types that have been specified as obstructions.

If the version of the function that takes a bounding volume as a parameter, then the set of returned vrfObjects will contain at least all of the vrfObjects whose extents intersect the extent of the specified bounding volume (in the database CS).

Parameters:
objectObstructionsUsed as a container of the pointers to the DtVrfObject obstructions.
boundingVolumeThe volume of interest.
bvLocationThe location, in the reference CS (database CS) of the bv.
bvOrientationThe orientation of the bv.
Returns:
A boolean indicating success or failure in getting the DtVrfObject pointers.
Note:
The set of DtVrfObject pointers is guaranteed to have all DtVrfObjects that lie within the bounding volume, but may also contain elements that lie outside.
virtual bool DtCollisionDetector::getObjectObstructions ( Dt3dBoundingVolume &  boundingVolume,
const DtVector bvLocation,
const DtDcm &  bvOrientation,
DtObjectObstructionContainer objectObstructions 
) const [virtual]
virtual bool DtCollisionDetector::vrfObjectObstructionPredicate ( const DtVrfObject vrfObjectToTest) const [virtual]

This function is used to filter out vrfObjects that are not appropriate for some reason.

For example, this function currently screens out vrfObjects that are not of one of the specified object types, or if the vrfObjects is attached to the collision detector's entity. (you can collide with yourself in our current system).

Returns:
A boolean indicating whether or not the vrfObject is worth testing for a collision.
See also:
detectObjectCollision
virtual bool DtCollisionDetector::getVectorObstructions ( DtVectorObstructionContainer vectorObstructions) const [virtual]

Selects all appropriate vector network elements from the vector network, as specified by the vector obstruction IDs.

Can be somewhat expensive because of the need to create DtVectorObstruction objects for all the network elements selected.

Parameters:
vectorObstructionsA container of all the appropriate vector obstructions.
boundingVolumeIf specified, then the function will return at least all the vector obstructions that lie within the bounding volume's extent. This means that additional obstructions that do not intersect the bv may be returned, but no obstruction that does intersect it will not be returned.
bvLocationThe location, in the reference CS (database CS) of the bv.
bvOrientationThe orientation matrix of the bv.
Returns:
A boolean signifying success or failure.
Note:
The set of returned vector obstruction pointers may contain vector obstructions that lie outside the specified volume, but it will never not contain obstructions inside the volume.
virtual bool DtCollisionDetector::getVectorObstructions ( Dt3dBoundingVolume &  boundingVolume,
const DtVector bvLocation,
const DtDcm &  bvOrientation,
DtVectorObstructionContainer obstructionsToTest 
) const [virtual]
virtual bool DtCollisionDetector::checkForCollision ( Dt3dBoundingVolume &  collisionBV,
DtCollision potentialCollision,
const DtVector localPosition,
const DtDcm &  bvOrientation 
) const [virtual]

Determines if the specified entities collide or not.

Parameters:
potentialCollideeA vrfObject to test for collisions.
Returns:
A boolean specifying whether or not there was a collision.
Parameters:
localPosition,ifnot 0, 0, 0, will use that position rather than entity position NOTE that false will also be returned when the test could not be done, such as if the potential collidee did not have a state repository.
bool DtCollisionDetector::detectNewClosestCollision ( Dt3dBoundingVolume &  collisionBV,
DtCollision *&  potentialCollision,
const DtVector localPosition,
const DtDcm &  bvOrientation 
) const [protected]

Determines if the entity is potentially or currently colliding with any obstructions.

Parameters:
localPosition,ifnot 0, 0, 0, will use that position rather than entity position
Returns:
a boolean signifying success or failure in detecting the collision.
Note:
if a new collision is detected, it is stored in the myPotentialCollision object.
bool DtCollisionDetector::detectObjectCollision ( Dt3dBoundingVolume &  collisionBV,
DtCollisionProcessor< DtEntityCollision > &  collisionProcessor,
const DtVector localPosition,
const DtDcm &  bvOrientation 
) const [protected]

Determines if the entity is potentially or currently colliding with any obstructions of the specified types.

Parameters:
DtEntityCollisionthe "best" (closest currently) object collision if any.
DtVectorObstructionCollisionthe "best" (closest currently) vector obstruction collision if any.
localPosition,ifnot 0, 0, 0, will use that position rather than entity position
See also:
detectNewCollision
Returns:
a boolean signifying success or failure in detecting the collision.
bool DtCollisionDetector::detectVectorCollision ( Dt3dBoundingVolume &  collisionBV,
DtCollisionProcessor< DtVectorObstructionCollision > &  ,
const DtVector localPosition,
const DtDcm &  bvOrientation 
) const [protected]
DtCollision* DtCollisionDetector::primaryCollision ( DtCollision firstCollision,
DtCollision secondCollision 
) const [protected]
Returns:
the "best" (closest currently) of the two specified collisions.
Returns:
a boolean signifying whether the object's invariant is valid or not.

Member Data Documentation

The obstruction IDs.

This object (if set) will not be reported as a collision.

Typically, this is the object that the collisions are being found for.


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

Document ID: Generated on Fri Jun 29 16:33:32 EDT 2012 from SVN revision 116588
Copyright © 2005-2012 VT MÄK Inc. All Rights Reserved (www.mak.com)