- Main Page
- Namespaces
- Classes
- Files
- Related Pages

- Class List
- Class Hierarchy
- Class Members

# col::ColObj Class Reference

One collidable object. More...

Collaboration diagram for col::ColObj:

[legend]
List of all members.

## Public Member Functions
const char * | getName (void) const
void | setActive (bool active)
| Set the activity-status of a Colobj Used to remove an object temporarily from collision checks.
bool | isActive ()
| Returns the activity-status of a Colobj.
void | setFlexible (bool flexible)
void | setStationary (bool stationary)
void | SetGridObj (Grid *grid)
Constructors, desctructors, assignment
| ColObj ()
| The default ctor is not meant for "real" usage It is only there so that we can create vector's.
| ColObj (osg::GeometryPtr &geom, osg::NodePtr &node, bool flexible, bool stationary, bool compute_hull, AlgoE algo, Grid *grid, bool show_hull=false, char *name=NULL)
| The ctor you should use.
| ColObj (const ColObj &source)
| Copy a collision object.
void | operator= (const ColObj &source)
| Assignment.
Checks
void | updateBBox (void)
| Update current world bbox.
bool | bboxIntersects (ColObj *other)
| Check if the bboxes of two objects intersect.
bool | hasMoved (unsigned int global_cycle)
| Update toworld matrix and check whether or not an object has moved.
GridObj * | GetGridObj (void)
| Return GridObj.
void | updateGrid (void)
| Update GridObj if object has moved.
## Static Public Member Functions
static ColObj * | find (vector< ColObj > *colobjs, osg::NodePtr obj)
| Find the colobjs[i] for which colobjs[i].m_node == obj; If not found, returns NULL.
## Protected Attributes
bool | m_active
| Used to remove an object temporarily from collision checks.
bool | m_flexible
| Set if the object deforms.
bool | m_stationary
| Set if the object doesn't move.
const DopTree * | m_doptree
| DOP tree of this obj.
const Boxtree * | m_boxtree
| Boxtree of this obj.
osg::NodePtr | m_node
| The actual "collidable" object.
osg::Matrix | m_old_matr
| The toWorld matrix of node as of last frame.
osg::Matrix | m_curr_matr
| The current toWorld matrix as of start of current cycle.
vector< const osg::MFPnt3f * > | points
char * | m_name
| The name of the colobj.
int | m_col_matr_idx
| row/column index into col.
bool | m_has_moved
| Flags whether or not obj has moved since last frame.
bool | m_first_moved_check
unsigned int | m_cycle
ConvexHull | m_hull
| the convex hull of geom
GridObj * | m_gridobj
## Friends
class | Matrix
class | MatrixCell
class | ColPair

## Detailed Description

One collidable object.

Holds various flags for one collidable object, including all auxiliary collision detection data (hierarchies, etc.).

Todo:
  Was man noch tun muss ..

Implementation:
  Each ColObj stores the toWorld matrix of the geometry, because the collision detection module does not necessarily run in its own thread, and thus does not necessarily have its own aspect.

## Constructor & Destructor Documentation

col::ColObj::ColObj | ( | osg::GeometryPtr & | geom,
|  | osg::NodePtr & | node,
|  | bool | flexible,
|  | bool | stationary,
|  | bool | compute_hull,
|  | AlgoE | algo,
|  | Grid * | grid,
|  | bool | show_hull = `false`,
|  | char * | colname = `NULL` |
| ) |  |  |

The ctor you should use.

Parameters:

  | geom,node | the OSG object
  | flexible | tells the coll.det. module that this object might deform
  | stationary | tells the coll.det. module that this object won't move
  | compute_hull | a convex hull of m_geom will be computed and stored,
  | algo | determines what hierarchical data structure to build
  | show_hull | creates a geometry from the convex hull
  | colname | name of colobj

This is the ctor whould should be used for creating ColObj's.

If an object is not m_stationary, then hasMoved() will return true when called for the first time (whether or not the object really has moved).

If show_hull is `true`, then the convex hull geometry will be attached to the m_node so that it will get rendered, too.

Colname is the name which will be printed with ColObj::print; if it is NULL, then the OSG name will be printed; if that does not exist, an automatically generated ID will be printed.

Precondition:
  m_geom should belong to m_node.

Exceptions:

  | XDopTree | If geometry has no polygons, or no GeoPosition3f.
  | XColBug | If a bug in the doptree code occurs.
  | bad_alloc |

Todo:
  Parameter m_geom ist ueberfluessig.

See also:
  MatrixCell::check

col::ColObj::ColObj | ( | const ColObj & | source | ) |

Copy a collision object.

Warning:
  Since the two colobj's point to the same geometry, their DOP trees are copied only shallow!

## Member Function Documentation

void col::ColObj::operator= | ( | const ColObj & | source | ) |

Assignment.

Warning:
  Since the two colobj's point to the same geometry, their DOP trees are copied only shallow!

void col::ColObj::updateBBox | ( | void |  | ) |

Update current world bbox.

Calculates the current bbox in world coordinates. It can be retrieved later by getBBox().

Bug:
  Funktioniert noch nicht, da OSG einen Bug hat.

bool col::ColObj::bboxIntersects | ( | ColObj * | other | ) |

Check if the bboxes of two objects intersect.

Parameters:

  | other | another collision object

bool col::ColObj::hasMoved | ( | unsigned int | global_cycle | ) |

Update toworld matrix and check whether or not an object has moved.

This is based on a toWorld matrix comparison. The check will be performed only once per collision cycle.

Whether or not the obj has moved, m_curr_matr will be copied into m_old_matr, and m_curr_matr will get the node's current toWorld matrix. This happens only if global_cycle has been incremented.

See also:
  MatrixCell::check()

void col::ColObj::setActive | ( | bool | active | ) |

Set the activity-status of a Colobj Used to remove an object temporarily from collision checks.

Parameters:

  | active | true => object will be checked

## Member Data Documentation

int col::ColObj::m_col_matr_idx`[protected]`

row/column index into col.

interest matrix If col_matr_idx < 0, then the ColObj is not valid. However, this should never happen!

bool col::ColObj::m_has_moved`[protected]`

Flags whether or not obj has moved since last frame.

Is valid only if cycle == coll::Cycle

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

- ColObj.h
- ColObj.cpp