Collision::CollisionModel Class Reference

#include <collisionModel.h>

List of all members.

Public Member Functions

void addTriangle (Triangle t)
 Adds a triangle to the model. Only works if bb hierarchy is not built yet.
void build ()
 Builds the bbox hierarchy. Recursively calls split on the root.
void cloneModel (CollisionModel *original)
 This model will share the bbox hierarchy of the original.
 CollisionModel (int threadId)
 Creates an empty collision model with no geometry and a tree with just an empty Leaf root.
void getBoundingVolumes (int depth, std::vector< BoundingBox > *bvs)
const NodegetRoot () const
int getThreadId () const
const transfgetTran () const
bool isActive () const
void reset ()
 Destroys the bb hierarchy, but does not save the triangles that it contained.
void setActive (bool act)
void setTran (const transf &t)
 ~CollisionModel ()
 Also deletes the bb hierarchy, if this model is not a clone.

Private Attributes

bool mActive
bool mClone
 Tells us if this model is a clone of another model.
NodemRoot
int mThreadId
 The id of the thread that this body was added in.
transf mTran

Detailed Description

The collision model contains its bb hierarchy, a transform and a flag indicating whether it is active or not. It is the only public interface with the bb hierarchy: a model is created with a number of triangles, then it is asked to build its own bb hierarchy.

Definition at line 169 of file collisionModel.h.


Constructor & Destructor Documentation

Collision::CollisionModel::CollisionModel ( int  threadId  )  [inline]

Creates an empty collision model with no geometry and a tree with just an empty Leaf root.

Definition at line 182 of file collisionModel.h.

Collision::CollisionModel::~CollisionModel (  )  [inline]

Also deletes the bb hierarchy, if this model is not a clone.

Definition at line 189 of file collisionModel.h.


Member Function Documentation

void Collision::CollisionModel::addTriangle ( Triangle  t  ) 

Adds a triangle to the model. Only works if bb hierarchy is not built yet.

After all the triangles have been added, use build() to build the bb hierarchy. Use reset() to clear the bb hierarchy of an already built model.

Definition at line 467 of file collisionModel.cpp.

void Collision::CollisionModel::build (  ) 

Builds the bbox hierarchy. Recursively calls split on the root.

Definition at line 499 of file collisionModel.cpp.

void Collision::CollisionModel::cloneModel ( CollisionModel original  ) 

This model will share the bbox hierarchy of the original.

This model does not have its own bbox hierarchy, but instead uses the one of the original model. WARNING: the entire cloning system is not completely finished. If the original is changed or deleted then the clone is almost guaranteed to cause a crash!

The clone can also be created (when using the constructor) in a different, thread than the original, which is the way cloning is most usually applied.

Definition at line 447 of file collisionModel.cpp.

void Collision::CollisionModel::getBoundingVolumes ( int  depth,
std::vector< BoundingBox > *  bvs 
)

Definition at line 457 of file collisionModel.cpp.

const Node* Collision::CollisionModel::getRoot (  )  const [inline]

Definition at line 194 of file collisionModel.h.

int Collision::CollisionModel::getThreadId (  )  const [inline]

Definition at line 204 of file collisionModel.h.

const transf& Collision::CollisionModel::getTran (  )  const [inline]

Definition at line 201 of file collisionModel.h.

bool Collision::CollisionModel::isActive (  )  const [inline]

Definition at line 202 of file collisionModel.h.

void Collision::CollisionModel::reset (  ) 

Destroys the bb hierarchy, but does not save the triangles that it contained.

In the future, this should also have a version where all the triangles that used to be in the hierarchy are centralized back in the root. Does not work for clones.

Definition at line 486 of file collisionModel.cpp.

void Collision::CollisionModel::setActive ( bool  act  )  [inline]

Definition at line 203 of file collisionModel.h.

void Collision::CollisionModel::setTran ( const transf t  )  [inline]

Definition at line 200 of file collisionModel.h.


Member Data Documentation

Definition at line 172 of file collisionModel.h.

Tells us if this model is a clone of another model.

Definition at line 175 of file collisionModel.h.

Definition at line 171 of file collisionModel.h.

The id of the thread that this body was added in.

This marker helps us keep track of bodies that are specific to a given thread. See the threading functions of the CollisionInterface for details.

Definition at line 179 of file collisionModel.h.

Definition at line 173 of file collisionModel.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines


graspit
Author(s):
autogenerated on Wed Jan 25 11:00:31 2012