Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

physics::OBBCollisionDetector Class Reference

Inheritance diagram for physics::OBBCollisionDetector:

Inheritance graph
[legend]
Collaboration diagram for physics::OBBCollisionDetector:

Collaboration graph
[legend]
List of all members.

Public Types

enum  CollisionQueryType { DetectCollision, FirstContactPoint, AllContactPoints }
typedef Int Attributes
typedef Int VisualType
enum  AttributeFlags {
  ShowAxes = 1, ShowBounds = 2, ShowCollisions = 4, ShowCollisionModel = 8,
  ShowCollisionDetection = 16, ShowEdges = 32, ShowNormals = 64, VerticesOnly = 128
}

Public Member Functions

 OBBCollisionDetector ()
virtual String className () const
virtual CollisionModel::CollisionModelType getType () const
virtual bool collision (ref< const Solid > solid1, ref< const Solid > solid2, CollisionQueryType queryType)
virtual bool collisionEnable (bool enabled)
 enable/disable all collisions

virtual void setCollisionQueryType (CollisionQueryType collisionQueryType)
virtual ref< CollidableBodycreateCollidableBody (ref< Shape > shape)=0
 new CollidableBody with specified Shape

virtual ref< CollisionStategetCollisionState (ref< const CollidableBody > collidableBody1, ref< const CollidableBody > collidableBody2) const
 Get the CollisionState for a pair of CollidableBodys.

virtual gfx::Segment3 shortestSegmentBetween (ref< const Collidable > collidable1, ref< const Collidable > collidable2)
 Compute the shortest line segment between the surfaces of a pair of Collidables.

virtual void reset ()
 called at the beginning of each collision cycle

virtual void collide (ref< const Collidable > collidable1, ref< const Collidable > collidable2)=0
 notify PotentialCollisionListeners if possible collision between Collidables

virtual void collide (ref< const Collidable > collidable)
virtual bool isCollisionEnabled () const
virtual void addPotentialCollisionListener (ref< PotentialCollisionListener > listener)
virtual void removePotentialCollisionListener (ref< PotentialCollisionListener > listener)
virtual void potentialCollision (ref< const Collidable > collidable1, ref< const Collidable > collidable2)
virtual bool visualTypeSupported (VisualType type) const
virtual osg::Node * createOSGVisual (Visual::Attributes visualAttributes=0) const
virtual bool isSameKindAs (const ReferencedObject &) const
virtual bool isSameKindAs (const Object &) const
void reference () const
bool unreference () const
const int referenceCount () const
void enableOnUnreferenceCall (bool enabled)
virtual void onUnreference () const

Public Attributes

Int numBoxTests
Int numTriTests

Static Public Attributes

const Real collisionEpsilon
const Int OSGVisual = 1

Protected Types

typedef std::pair< ref< const
CollidableBody >, ref< const
CollidableBody > > 
CollidableBodyPair
typedef std::map< CollidableBodyPair,
ref< CollisionState > > 
CollisionStateMap
typedef base::reflist< PotentialCollisionListenerListenerList

Protected Member Functions

void Collide (const base::Matrix3 &R1, const base::Vector3 &T1, ref< const OBBCollisionModel > model1, const base::Matrix3 &R2, const base::Vector3 &T2, ref< const OBBCollisionModel > model2, CollisionQueryType queryType)
void Collide (const base::Matrix3 &R1, const base::Vector3 &T1, Real s1, ref< const OBBCollisionModel > model1, const base::Matrix3 &R2, const base::Vector3 &T2, Real s2, ref< const OBBCollisionModel > model2, CollisionQueryType queryType)
void collideRecursive (const OBBCollisionModel::OBB &b1, const OBBCollisionModel::OBB &b2, const base::Matrix3 &R, const base::Vector3 &T, double s)
void triContact (const OBBCollisionModel::OBB &b1, const OBBCollisionModel::OBB &b2)
bool triContact (const base::Vector3 &P1, const base::Vector3 &P2, const gfx::Vector3 &P3, const base::Point3 &Q1, const base::Point3 &Q2, const gfx::Point3 &Q3)
bool project6 (const Vector3 &ax, const Vector3 &p1, const Vector3 &p2, const Vector3 &p3, const Vector3 &q1, const Vector3 &q2, const Vector3 &q3) const
Int OBBDisjoint (const base::Matrix3 &B, const base::Vector3 &T, const base::Vector3 &a, const base::Vector3 &b)
virtual ref< CollisionStatenewCollisionState (ref< const Solid > solid1, ref< const Solid > solid2) const
virtual ref< CollisionStatenewCollisionState (ref< const CollidableBody > collidableBody1, ref< const CollidableBody > collidableBody2) const
void notifyListeners (ref< const Collidable > collidable1, ref< const Collidable > collidable2)
 call potentialCollision(collidable1,collidable2) on all listeners (if enabled)

void resetListeners ()
 call reset() on all listeners (if enabled)


Protected Attributes

bool collisionDetectionEnabled
base::Vector3 i1
base::Vector3 i2
base::Vector3 i3
base::Matrix3 Bf
base::Matrix3 mR
base::Vector3 mT
Real ms
std::vector< std::pair< gfx::Triangle3,
gfx::Triangle3 > > 
contacts
bool firstContact
base::Vector3 p1
base::Vector3 p2
base::Vector3 p3
base::Vector3 q1
base::Vector3 q2
base::Vector3 q3
base::Vector3 e1
base::Vector3 e2
base::Vector3 e3
base::Vector3 f1
base::Vector3 f2
base::Vector3 f3
base::Vector3 g1
base::Vector3 g2
base::Vector3 g3
base::Vector3 h1
base::Vector3 h2
base::Vector3 h3
base::Vector3 n1
base::Vector3 m1
base::Vector3 z
base::Vector3 ef11
base::Vector3 ef12
base::Vector3 ef13
base::Vector3 ef21
base::Vector3 ef22
base::Vector3 ef23
base::Vector3 ef31
base::Vector3 ef32
base::Vector3 ef33
CollisionStateMap collisionStates
CollisionQueryType queryType
bool enabled
ListenerList listeners
int _refCount
bool onUnreferenceEnabled

Member Typedef Documentation

typedef Int gfx::Visual::Attributes [inherited]
 

Definition at line 39 of file Visual.

Referenced by gfx::Visual::createOSGVisual().

typedef std::pair< ref<const CollidableBody>, ref<const CollidableBody> > physics::CollisionDetector::CollidableBodyPair [protected, inherited]
 

Definition at line 65 of file CollisionDetector.

typedef std::map< CollidableBodyPair, ref<CollisionState> > physics::CollisionDetector::CollisionStateMap [protected, inherited]
 

Definition at line 66 of file CollisionDetector.

typedef base::reflist<PotentialCollisionListener> physics::Collider::ListenerList [protected, inherited]
 

Definition at line 76 of file Collider.

typedef Int gfx::Visual::VisualType [inherited]
 

Definition at line 44 of file Visual.

Referenced by gfx::Visual::visualTypeSupported().


Member Enumeration Documentation

enum gfx::Visual::AttributeFlags [inherited]
 

Enumeration values:
ShowAxes 
ShowBounds 
ShowCollisions 
ShowCollisionModel 
ShowCollisionDetection 
ShowEdges 
ShowNormals 
VerticesOnly 

Definition at line 40 of file Visual.

enum physics::CollisionDetector::CollisionQueryType [inherited]
 

Enumeration values:
DetectCollision 
FirstContactPoint 
AllContactPoints 

Definition at line 45 of file CollisionDetector.


Constructor & Destructor Documentation

physics::OBBCollisionDetector::OBBCollisionDetector  )  [inline]
 

Definition at line 44 of file OBBCollisionDetector.


Member Function Documentation

virtual void physics::Collider::addPotentialCollisionListener ref< PotentialCollisionListener listener  )  [inline, virtual, inherited]
 

Definition at line 60 of file Collider.

References base::reflist< _Tp, _Alloc >::push_back().

virtual String physics::OBBCollisionDetector::className  )  const [inline, virtual]
 

return the name of the object's class type. Must be defined by derived classes.

Implements base::Object.

Definition at line 47 of file OBBCollisionDetector.

virtual void physics::Collider::collide ref< const Collidable collidable  )  [virtual, inherited]
 

convenience method that calls collide(collidable1, collidable2) for each pair of Collidables in the group collidable, unless collidable isn't a group or has child inter-collision disabled (so that you can keep all your Collidables in a single top-level group)

Reimplemented in physics::ODECollisionCuller, physics::ODECollisionDetector, and physics::SimpleCollisionCuller.

virtual void physics::Collider::collide ref< const Collidable collidable1,
ref< const Collidable collidable2
[pure virtual, inherited]
 

notify PotentialCollisionListeners if possible collision between Collidables

Implemented in physics::CollisionResponseHandler, physics::NullCollisionResponseHandler, physics::ODECollisionCuller, physics::ODECollisionDetector, and physics::SimpleCollisionCuller.

Referenced by physics::Collider::potentialCollision().

void physics::OBBCollisionDetector::Collide const base::Matrix3 R1,
const base::Vector3 T1,
Real  s1,
ref< const OBBCollisionModel model1,
const base::Matrix3 R2,
const base::Vector3 T2,
Real  s2,
ref< const OBBCollisionModel model2,
CollisionQueryType  queryType
[protected]
 

void physics::OBBCollisionDetector::Collide const base::Matrix3 R1,
const base::Vector3 T1,
ref< const OBBCollisionModel model1,
const base::Matrix3 R2,
const base::Vector3 T2,
ref< const OBBCollisionModel model2,
CollisionQueryType  queryType
[protected]
 

void physics::OBBCollisionDetector::collideRecursive const OBBCollisionModel::OBB b1,
const OBBCollisionModel::OBB b2,
const base::Matrix3 R,
const base::Vector3 T,
double  s
[protected]
 

virtual bool physics::OBBCollisionDetector::collision ref< const Solid solid1,
ref< const Solid solid2,
CollisionQueryType  queryType
[virtual]
 

virtual bool physics::OBBCollisionDetector::collisionEnable bool  enabled  )  [inline, virtual]
 

enable/disable all collisions

Reimplemented from physics::Collider.

Definition at line 56 of file OBBCollisionDetector.

virtual ref<CollidableBody> physics::CollisionDetector::createCollidableBody ref< Shape shape  )  [pure virtual, inherited]
 

new CollidableBody with specified Shape

Implemented in physics::ODECollisionDetector.

virtual osg::Node* gfx::Visual::createOSGVisual Visual::Attributes  visualAttributes = 0  )  const [inline, virtual, inherited]
 

Reimplemented in physics::GJKCollisionDetector, physics::OBBCollisionModel, physics::ODECollisionModel, physics::ODESolidSystem, physics::Solid, physics::SOLIDCollisionModel, and robot::sim::SimulatedBasicEnvironment.

Definition at line 49 of file Visual.

References gfx::Visual::Attributes, Logln, and NewObj.

void base::Referenced::enableOnUnreferenceCall bool  enabled  )  [inline, inherited]
 

If enabled, each call to unreference() will also call virtual method onUnreference()

Definition at line 115 of file Referenced.

References base::Referenced::onUnreferenceEnabled.

virtual ref<CollisionState> physics::CollisionDetector::getCollisionState ref< const CollidableBody collidableBody1,
ref< const CollidableBody collidableBody2
const [virtual, inherited]
 

Get the CollisionState for a pair of CollidableBodys.

virtual CollisionModel::CollisionModelType physics::OBBCollisionDetector::getType  )  const [inline, virtual]
 

Definition at line 49 of file OBBCollisionDetector.

virtual bool physics::Collider::isCollisionEnabled  )  const [inline, virtual, inherited]
 

Reimplemented in physics::CollisionCuller.

Definition at line 58 of file Collider.

References physics::Collider::enabled.

virtual bool base::Object::isSameKindAs const Object  )  const [inline, virtual, inherited]
 

Definition at line 47 of file Object.

virtual bool base::ReferencedObject::isSameKindAs const ReferencedObject  )  const [inline, virtual, inherited]
 

Definition at line 52 of file ReferencedObject.

virtual ref<CollisionState> physics::CollisionDetector::newCollisionState ref< const CollidableBody collidableBody1,
ref< const CollidableBody collidableBody2
const [inline, protected, virtual, inherited]
 

Reimplemented in physics::ODECollisionDetector.

Definition at line 60 of file CollisionDetector.

References NewNamedObj.

virtual ref<CollisionState> physics::OBBCollisionDetector::newCollisionState ref< const Solid solid1,
ref< const Solid solid2
const [inline, protected, virtual]
 

Definition at line 117 of file OBBCollisionDetector.

References NewNamedObj.

void physics::Collider::notifyListeners ref< const Collidable collidable1,
ref< const Collidable collidable2
[protected, inherited]
 

call potentialCollision(collidable1,collidable2) on all listeners (if enabled)

Int physics::OBBCollisionDetector::OBBDisjoint const base::Matrix3 B,
const base::Vector3 T,
const base::Vector3 a,
const base::Vector3 b
[protected]
 

virtual void base::Referenced::onUnreference  )  const [inline, virtual, inherited]
 

Called by unreference() if enabled via enableOnUnreferenceCall(true). Typically overridden in subclasses that wish to know about unreference() calls - for example to handle manually breaking cyclic references

Reimplemented in robot::control::ControllableAdaptor::AdaptorControlInterface, and robot::control::ControllableAdaptor.

Definition at line 121 of file Referenced.

Referenced by base::Referenced::unreference().

virtual void physics::Collider::potentialCollision ref< const Collidable collidable1,
ref< const Collidable collidable2
[inline, virtual, inherited]
 

Implements physics::PotentialCollisionListener.

Definition at line 66 of file Collider.

References physics::Collider::collide().

bool physics::OBBCollisionDetector::project6 const Vector3 ax,
const Vector3 p1,
const Vector3 p2,
const Vector3 p3,
const Vector3 q1,
const Vector3 q2,
const Vector3 q3
const [protected]
 

void base::Referenced::reference  )  const [inline, inherited]
 

Increment the reference count by one, indicating that this object has another pointer which is referencing it.

Definition at line 65 of file Referenced.

References base::Referenced::_refCount.

const int base::Referenced::referenceCount  )  const [inline, inherited]
 

Return the number pointers currently referencing this object.

Definition at line 112 of file Referenced.

References base::Referenced::_refCount.

Referenced by robot::control::ControllableAdaptor::AdaptorControlInterface::onUnreference().

virtual void physics::Collider::removePotentialCollisionListener ref< PotentialCollisionListener listener  )  [inline, virtual, inherited]
 

Definition at line 63 of file Collider.

References base::reflist< _Tp, _Alloc >::remove().

virtual void physics::Collider::reset  )  [inline, virtual, inherited]
 

called at the beginning of each collision cycle

Reimplemented from physics::PotentialCollisionListener.

Reimplemented in physics::SolidCollisionResponseHandler, and robot::sim::SimulatedKinematicChain::ProximityCollisionResponseHandler.

Definition at line 46 of file Collider.

References physics::Collider::resetListeners().

void physics::Collider::resetListeners  )  [protected, inherited]
 

call reset() on all listeners (if enabled)

Referenced by physics::Collider::reset().

virtual void physics::CollisionDetector::setCollisionQueryType CollisionQueryType  collisionQueryType  )  [inline, virtual, inherited]
 

Definition at line 47 of file CollisionDetector.

References physics::CollisionDetector::queryType.

virtual gfx::Segment3 physics::CollisionDetector::shortestSegmentBetween ref< const Collidable collidable1,
ref< const Collidable collidable2
[virtual, inherited]
 

Compute the shortest line segment between the surfaces of a pair of Collidables.

bool physics::OBBCollisionDetector::triContact const base::Vector3 P1,
const base::Vector3 P2,
const gfx::Vector3 &  P3,
const base::Point3 Q1,
const base::Point3 Q2,
const gfx::Point3 &  Q3
[protected]
 

void physics::OBBCollisionDetector::triContact const OBBCollisionModel::OBB b1,
const OBBCollisionModel::OBB b2
[protected]
 

bool base::Referenced::unreference  )  const [inline, inherited]
 

Decrement the reference count by one, indicating that a pointer to this object is referencing it. If the refence count goes to zero, it is assumed that this object is nolonger referenced and is automatically deleted.

Definition at line 81 of file Referenced.

References base::Referenced::_refCount, Exception, base::Referenced::onUnreference(), and base::Referenced::onUnreferenceEnabled.

virtual bool gfx::Visual::visualTypeSupported VisualType  type  )  const [inline, virtual, inherited]
 

Reimplemented in gfx::OSGWorld, gfx::VisualPath, physics::Box, physics::Capsule, physics::Cone, physics::Cylinder, physics::GJKCollisionDetector, physics::LODTerrain, physics::OBBCollisionModel, physics::ODECollisionModel, physics::ODESolidSystem, physics::Polyhedron, physics::Solid, physics::SOLIDCollisionModel, physics::Sphere, physics::Torus, physics::VisualDebugUtil, and robot::sim::VisualIKORTest.

Definition at line 47 of file Visual.

References gfx::Visual::VisualType.


Member Data Documentation

int base::Referenced::_refCount [mutable, protected, inherited]
 

Definition at line 136 of file Referenced.

Referenced by base::Referenced::reference(), base::Referenced::referenceCount(), base::Referenced::Referenced(), base::Referenced::unreference(), and base::Referenced::~Referenced().

base::Matrix3 physics::OBBCollisionDetector::Bf [protected]
 

Definition at line 71 of file OBBCollisionDetector.

bool physics::OBBCollisionDetector::collisionDetectionEnabled [protected]
 

Definition at line 68 of file OBBCollisionDetector.

const Real physics::CollisionDetector::collisionEpsilon [static, inherited]
 

Definition at line 49 of file CollisionDetector.

CollisionStateMap physics::CollisionDetector::collisionStates [mutable, protected, inherited]
 

Definition at line 67 of file CollisionDetector.

std::vector<std::pair<gfx::Triangle3,gfx::Triangle3> > physics::OBBCollisionDetector::contacts [protected]
 

Definition at line 76 of file OBBCollisionDetector.

base::Vector3 physics::OBBCollisionDetector::e1 [protected]
 

Definition at line 122 of file OBBCollisionDetector.

base::Vector3 physics::OBBCollisionDetector::e2 [protected]
 

Definition at line 122 of file OBBCollisionDetector.

base::Vector3 physics::OBBCollisionDetector::e3 [protected]
 

Definition at line 122 of file OBBCollisionDetector.

base::Vector3 physics::OBBCollisionDetector::ef11 [protected]
 

Definition at line 122 of file OBBCollisionDetector.

base::Vector3 physics::OBBCollisionDetector::ef12 [protected]
 

Definition at line 122 of file OBBCollisionDetector.

base::Vector3 physics::OBBCollisionDetector::ef13 [protected]
 

Definition at line 122 of file OBBCollisionDetector.

base::Vector3 physics::OBBCollisionDetector::ef21 [protected]
 

Definition at line 122 of file OBBCollisionDetector.

base::Vector3 physics::OBBCollisionDetector::ef22 [protected]
 

Definition at line 122 of file OBBCollisionDetector.

base::Vector3 physics::OBBCollisionDetector::ef23 [protected]
 

Definition at line 122 of file OBBCollisionDetector.

base::Vector3 physics::OBBCollisionDetector::ef31 [protected]
 

Definition at line 122 of file OBBCollisionDetector.

base::Vector3 physics::OBBCollisionDetector::ef32 [protected]
 

Definition at line 122 of file OBBCollisionDetector.

base::Vector3 physics::OBBCollisionDetector::ef33 [protected]
 

Definition at line 122 of file OBBCollisionDetector.

bool physics::Collider::enabled [protected, inherited]
 

Definition at line 74 of file Collider.

Referenced by physics::Collider::Collider(), and physics::Collider::isCollisionEnabled().

base::Vector3 physics::OBBCollisionDetector::f1 [protected]
 

Definition at line 122 of file OBBCollisionDetector.

base::Vector3 physics::OBBCollisionDetector::f2 [protected]
 

Definition at line 122 of file OBBCollisionDetector.

base::Vector3 physics::OBBCollisionDetector::f3 [protected]
 

Definition at line 122 of file OBBCollisionDetector.

bool physics::OBBCollisionDetector::firstContact [protected]
 

Definition at line 78 of file OBBCollisionDetector.

base::Vector3 physics::OBBCollisionDetector::g1 [protected]
 

Definition at line 122 of file OBBCollisionDetector.

base::Vector3 physics::OBBCollisionDetector::g2 [protected]
 

Definition at line 122 of file OBBCollisionDetector.

base::Vector3 physics::OBBCollisionDetector::g3 [protected]
 

Definition at line 122 of file OBBCollisionDetector.

base::Vector3 physics::OBBCollisionDetector::h1 [protected]
 

Definition at line 122 of file OBBCollisionDetector.

base::Vector3 physics::OBBCollisionDetector::h2 [protected]
 

Definition at line 122 of file OBBCollisionDetector.

base::Vector3 physics::OBBCollisionDetector::h3 [protected]
 

Definition at line 122 of file OBBCollisionDetector.

base::Vector3 physics::OBBCollisionDetector::i1 [protected]
 

Definition at line 70 of file OBBCollisionDetector.

base::Vector3 physics::OBBCollisionDetector::i2 [protected]
 

Definition at line 70 of file OBBCollisionDetector.

base::Vector3 physics::OBBCollisionDetector::i3 [protected]
 

Definition at line 70 of file OBBCollisionDetector.

ListenerList physics::Collider::listeners [protected, inherited]
 

Definition at line 77 of file Collider.

base::Vector3 physics::OBBCollisionDetector::m1 [protected]
 

Definition at line 122 of file OBBCollisionDetector.

base::Matrix3 physics::OBBCollisionDetector::mR [protected]
 

Definition at line 72 of file OBBCollisionDetector.

Real physics::OBBCollisionDetector::ms [protected]
 

Definition at line 74 of file OBBCollisionDetector.

base::Vector3 physics::OBBCollisionDetector::mT [protected]
 

Definition at line 73 of file OBBCollisionDetector.

base::Vector3 physics::OBBCollisionDetector::n1 [protected]
 

Definition at line 122 of file OBBCollisionDetector.

Int physics::OBBCollisionDetector::numBoxTests
 

Definition at line 64 of file OBBCollisionDetector.

Int physics::OBBCollisionDetector::numTriTests
 

Definition at line 65 of file OBBCollisionDetector.

bool base::Referenced::onUnreferenceEnabled [protected, inherited]
 

Definition at line 137 of file Referenced.

Referenced by base::Referenced::enableOnUnreferenceCall(), base::Referenced::Referenced(), and base::Referenced::unreference().

const Int gfx::Visual::OSGVisual = 1 [static, inherited]
 

Definition at line 45 of file Visual.

base::Vector3 physics::OBBCollisionDetector::p1 [protected]
 

Definition at line 122 of file OBBCollisionDetector.

base::Vector3 physics::OBBCollisionDetector::p2 [protected]
 

Definition at line 122 of file OBBCollisionDetector.

base::Vector3 physics::OBBCollisionDetector::p3 [protected]
 

Definition at line 122 of file OBBCollisionDetector.

base::Vector3 physics::OBBCollisionDetector::q1 [protected]
 

Definition at line 122 of file OBBCollisionDetector.

base::Vector3 physics::OBBCollisionDetector::q2 [protected]
 

Definition at line 122 of file OBBCollisionDetector.

base::Vector3 physics::OBBCollisionDetector::q3 [protected]
 

Definition at line 122 of file OBBCollisionDetector.

CollisionQueryType physics::CollisionDetector::queryType [protected, inherited]
 

Definition at line 69 of file CollisionDetector.

Referenced by physics::CollisionDetector::setCollisionQueryType().

base::Vector3 physics::OBBCollisionDetector::z [protected]
 

Definition at line 122 of file OBBCollisionDetector.


The documentation for this class was generated from the following file:
Generated on Thu Jul 29 16:40:45 2004 for OpenSim by doxygen 1.3.6