col::Matrix Class Reference

The collision interest matrix. More...

Collaboration diagram for col::Matrix:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Matrix (unsigned int numcolobjs=50)
 Create a collision interest matrix.
void addObj (ColObj *obj)
 Make a new row & column for a collision object.
void addCallback (Callback *callback, vector< ColObj > *colobjs)
 Add a callback to a cell of the matrix.
MatrixCellgetCell (const ColPair &pair) const
 Return the cell corresponding to a colobj pair.
MatrixCellcreateCell (const ColObj *obj1, const ColObj *obj2)
 Create a new collision interest matrix cell.
bool check (const ColPair &pair, bool use_hulls, AlgoE algo) const
 Check a pair for collision.
void callCallbacks (const ColPair &pair) const
 Call all callbacks associated with a certain pair of col.
bool isConsistent (vector< ColObj > *colobjs) const
 Check consistency of the collision interest matrix.

Protected Types

typedef vector< MatrixCell * > m_Row
 one row of the collision interest matrix (rows have different length)

Protected Member Functions

 Matrix (const Matrix &source)
Matrixoperator= (const Matrix &source)

Protected Attributes

vector< m_Rowm_m
 the raison d'etre

Detailed Description

The collision interest matrix.

Composed of MatrixCell's.

Author:
Gabriel Zachmann


Constructor & Destructor Documentation

col::Matrix::Matrix ( unsigned int  numcolobjs = 50  ) 

Create a collision interest matrix.

Parameters:
numcolobjs this is just an estimate of how many objects there will be
The number of collision objects can be incremented later.

Implementation:
Only the lower triangle of the matrix is occupied, i.e., only cells (i,j) are valid with i>j.


Member Function Documentation

void col::Matrix::addObj ( ColObj obj  ) 

Make a new row & column for a collision object.

Parameters:
obj the collision object
A row is added to the matrix.

Exceptions:
XColBug If colobj has already been added.
Warning:
Dinge, die der Aufrufer unbedingt beachten muss...
Precondition:
Annahmnen, die die Funktion macht...
Sideeffects:
Nebenwirkungen, globale Variablen, die veraendert werden, ..
Todo:
Was noch getan werden muss
Bug:
Bekannte Bugs dieser Funktion
See also:
...
Implementation:
Implementierungsdetails, TODOs, ...

void col::Matrix::addCallback ( Callback callback,
vector< ColObj > *  colobjs 
)

Add a callback to a cell of the matrix.

Parameters:
callback the callback
Exceptions:
XCollision If the same m_callback, or a callback with the same objects, has been added already.
XCollision If the nodes have not been made collidable yet (by an ADD_OBJECT request).
XColBug 
Warning:
A pointer to the callback-functor is stored, so the application should not delete the object.
Precondition:
Annahmnen, die die Funktion macht...
Todo:
Implementation:
We cannot check earlier whether or not the nodes have been made collidable, because that could have happened by just one request earlier in the same queue during the same collision cycle.

MatrixCell * col::Matrix::getCell ( const ColPair pair  )  const

Return the cell corresponding to a colobj pair.

Parameters:
pair the pair of collision objects
Returns:
The corresponding cell.
Exceptions:
XColBug If either of the colmatrix indices is < 0.
Precondition:
  • Matrix index of both obj must be valid.
  • obj1 != obj2, and index1 != index2.

MatrixCell * col::Matrix::createCell ( const ColObj obj1,
const ColObj obj2 
)

Create a new collision interest matrix cell.

Parameters:
obj1,obj2 the pair of collision objects
Returns:
The corresponding cell.
Exceptions:
XColBug If either of the colmatrix indices is < 0.
Precondition:
  • Matrix index of both obj must be valid.
  • obj1 != obj2, and index1 != index2.

bool col::Matrix::check ( const ColPair pair,
bool  use_hulls,
AlgoE  algo 
) const

Check a pair for collision.

See also:
MatrixCell::check()

void col::Matrix::callCallbacks ( const ColPair pair  )  const

Call all callbacks associated with a certain pair of col.

objects

Parameters:
pair the pair of col. objects
If there are no callbacks associated with this pair, nothing happens.

Warning:
Dinge, die der Aufrufer unbedingt beachten muss...
Precondition:
  • Matrix index of both obj must be valid.
  • obj1 != obj2, and index1 != index2.
Sideeffects:
Nebenwirkungen, globale Variablen, die veraendert werden, ..
Todo:
Was noch getan werden muss
Bug:
Bekannte Bugs dieser Funktion
See also:
...
Implementation:
Implementierungsdetails, TODOs, ...

bool col::Matrix::isConsistent ( vector< ColObj > *  colobjs  )  const

Check consistency of the collision interest matrix.

Parameters:
colobjs the list of collision objects
Returns:
True, if an inconsistency has been detected.
If an inconsistency is detected, an error message is printed. Checks:

Precondition:
Implementation:
Implementierungsdetails, TODOs, ...


The documentation for this class was generated from the following files:
Generated on Tue Oct 16 18:13:06 2007 for CollDet by  doxygen 1.5.2