Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
AABBTreeCollider Class Reference

#include <OPC_TreeCollider.h>

Inheritance diagram for AABBTreeCollider:
Inheritance graph
[legend]

Public Member Functions

 AABBTreeCollider ()
 
bool Collide (BVTCache &cache, const Matrix4x4 *world0=null, const Matrix4x4 *world1=null)
 
bool Collide (const AABBCollisionTree *tree0, const AABBCollisionTree *tree1, const Matrix4x4 *world0=null, const Matrix4x4 *world1=null, Pair *cache=null)
 
bool Collide (const AABBNoLeafTree *tree0, const AABBNoLeafTree *tree1, const Matrix4x4 *world0=null, const Matrix4x4 *world1=null, Pair *cache=null)
 
bool Collide (const AABBQuantizedTree *tree0, const AABBQuantizedTree *tree1, const Matrix4x4 *world0=null, const Matrix4x4 *world1=null, Pair *cache=null)
 
bool Collide (const AABBQuantizedNoLeafTree *tree0, const AABBQuantizedNoLeafTree *tree1, const Matrix4x4 *world0=null, const Matrix4x4 *world1=null, Pair *cache=null)
 
inline_ udword GetNbBVBVTests () const
 
inline_ udword GetNbBVPrimTests () const
 
inline_ udword GetNbPairs () const
 
inline_ udword GetNbPrimPrimTests () const
 
inline_ const PairGetPairs () const
 
 override (Collider) HRP_COLLISION_EXPORT const char *ValidateSettings()
 
void setCollisionPairInserter (hrp::CollisionPairInserterBase *collisionPairInserter)
 
inline_ void SetFullBoxBoxTest (bool flag)
 
inline_ void SetFullPrimBoxTest (bool flag)
 
virtual ~AABBTreeCollider ()
 
- Public Member Functions inherited from Collider
 Collider ()
 
inline_ BOOL ContactFound () const
 
inline_ BOOL FirstContactEnabled () const
 
inline_ BOOL GetContactStatus () const
 
inline_ void SetFirstContact (bool flag)
 
inline_ void SetPrimitiveTests (bool flag)
 
inline_ void SetTemporalCoherence (bool flag)
 
inline_ BOOL SkipPrimitiveTests () const
 
inline_ BOOL TemporalCoherenceEnabled () const
 
inline_ BOOL TemporalHit () const
 
virtual const char * ValidateSettings ()=0
 
virtual ~Collider ()
 

Protected Member Functions

void _Collide (const AABBCollisionNode *b0, const AABBCollisionNode *b1)
 
void _Collide (const AABBQuantizedNode *b0, const AABBQuantizedNode *b1, const Point &a, const Point &Pa, const Point &b, const Point &Pb)
 
void _Collide (const AABBNoLeafNode *a, const AABBNoLeafNode *b)
 
void _Collide (const AABBQuantizedNoLeafNode *a, const AABBQuantizedNoLeafNode *b)
 
void _CollideBoxTri (const AABBNoLeafNode *b)
 
void _CollideBoxTri (const AABBQuantizedNoLeafNode *b)
 
void _CollideTriBox (const AABBNoLeafNode *b)
 
void _CollideTriBox (const AABBQuantizedNoLeafNode *b)
 
inline_ BOOL BoxBoxOverlap (const Point &ea, const Point &ca, const Point &eb, const Point &cb)
 
bool CheckTemporalCoherence (Pair *cache)
 
HRP_COLLISION_EXPORT void InitQuery (const Matrix4x4 *world0=null, const Matrix4x4 *world1=null)
 
void PrimTest (udword id0, udword id1)
 
inline_ void PrimTestIndexTri (udword id0)
 
inline_ void PrimTestTriIndex (udword id1)
 
inline_ BOOL Setup (const MeshInterface *mi0, const MeshInterface *mi1)
 
inline_ BOOL TriBoxOverlap (const Point &center, const Point &extents)
 
BOOL TriTriOverlap (const Point &V0, const Point &V1, const Point &V2, const Point &U0, const Point &U1, const Point &U2)
 
- Protected Member Functions inherited from Collider
virtual inline_ void InitQuery ()
 
inline_ BOOL Setup (const BaseModel *model)
 

Protected Attributes

hrp::CollisionPairInserterBasecollisionPairInserter
 
Matrix3x3 mAR
 Absolute rotation matrix. More...
 
Point mCenterCoeff0
 
Point mCenterCoeff1
 
Point mExtentsCoeff0
 
Point mExtentsCoeff1
 
bool mFullBoxBoxTest
 Perform full BV-BV tests (true) or SAT-lite tests (false) More...
 
bool mFullPrimBoxTest
 Perform full Primitive-BV tests (true) or SAT-lite tests (false) More...
 
udword mId0
 
udword mId1
 
const MeshInterfacemIMesh0
 User-defined mesh interface for object0. More...
 
const MeshInterfacemIMesh1
 User-defined mesh interface for object1. More...
 
udword mLeafIndex
 Triangle index. More...
 
Point mLeafVerts [3]
 Triangle vertices. More...
 
udword mNbBVBVTests
 Number of BV-BV tests. More...
 
udword mNbBVPrimTests
 Number of BV-Primitive tests. More...
 
udword mNbPrimPrimTests
 Number of Primitive-Primitive tests. More...
 
const AABBCollisionNodemNowNode0
 
const AABBCollisionNodemNowNode1
 
Container mPairs
 Pairs of colliding primitives. More...
 
Matrix3x3 mR0to1
 Rotation from object0 to object1. More...
 
Matrix3x3 mR1to0
 Rotation from object1 to object0. More...
 
Point mT0to1
 Translation from object0 to object1. More...
 
Point mT1to0
 Translation from object1 to object0. More...
 
- Protected Attributes inherited from Collider
const BaseModelmCurrentModel
 Current model for collision query (owner of touched faces) More...
 
udword mFlags
 Bit flags. More...
 
const MeshInterfacemIMesh
 User-defined mesh interface. More...
 

Detailed Description

Contains an AABB tree collider. This class performs a collision test between two AABB trees.

Author
Pierre Terdiman
Version
1.3
Date
March, 20, 2001

Definition at line 70 of file OPC_TreeCollider.h.

Constructor & Destructor Documentation

◆ AABBTreeCollider()

AABBTreeCollider::AABBTreeCollider ( )

◆ ~AABBTreeCollider()

virtual AABBTreeCollider::~AABBTreeCollider ( )
virtual

Member Function Documentation

◆ _Collide() [1/4]

void AABBTreeCollider::_Collide ( const AABBCollisionNode b0,
const AABBCollisionNode b1 
)
protected

◆ _Collide() [2/4]

void AABBTreeCollider::_Collide ( const AABBQuantizedNode b0,
const AABBQuantizedNode b1,
const Point a,
const Point Pa,
const Point b,
const Point Pb 
)
protected

◆ _Collide() [3/4]

void AABBTreeCollider::_Collide ( const AABBNoLeafNode a,
const AABBNoLeafNode b 
)
protected

◆ _Collide() [4/4]

void AABBTreeCollider::_Collide ( const AABBQuantizedNoLeafNode a,
const AABBQuantizedNoLeafNode b 
)
protected

◆ _CollideBoxTri() [1/2]

void AABBTreeCollider::_CollideBoxTri ( const AABBNoLeafNode b)
protected

◆ _CollideBoxTri() [2/2]

void AABBTreeCollider::_CollideBoxTri ( const AABBQuantizedNoLeafNode b)
protected

◆ _CollideTriBox() [1/2]

void AABBTreeCollider::_CollideTriBox ( const AABBNoLeafNode b)
protected

◆ _CollideTriBox() [2/2]

void AABBTreeCollider::_CollideTriBox ( const AABBQuantizedNoLeafNode b)
protected

◆ BoxBoxOverlap()

inline_ BOOL AABBTreeCollider::BoxBoxOverlap ( const Point ea,
const Point ca,
const Point eb,
const Point cb 
)
protected

OBB-OBB overlap test using the separating axis theorem.

  • original code by Gomez / Gamasutra (similar to Gottschalk's one in RAPID)
  • optimized for AABB trees by computing the rotation matrix once (SOLID-fashion)
  • the fabs matrix is precomputed as well and epsilon-tweaked (RAPID-style, we found this almost mandatory)
  • Class III axes can be disabled... (SOLID & Intel fashion)
  • ...or enabled to perform some profiling
  • CPU comparisons used when appropriate
  • lazy evaluation sometimes saves some work in case of early exits (unlike SOLID)
Parameters
ea[in] extents from box A
ca[in] center from box A
eb[in] extents from box B
cb[in] center from box B
Returns
true if boxes overlap

Definition at line 19 of file OPC_BoxBoxOverlap.h.

◆ CheckTemporalCoherence()

bool AABBTreeCollider::CheckTemporalCoherence ( Pair cache)
protected

◆ Collide() [1/5]

bool AABBTreeCollider::Collide ( BVTCache cache,
const Matrix4x4 world0 = null,
const Matrix4x4 world1 = null 
)

Generic collision query for generic OPCODE models. After the call, access the results with:

Parameters
cache[in] collision cache for model pointers and a colliding pair of primitives
world0[in] world matrix for first object, or null
world1[in] world matrix for second object, or null
Returns
true if success
Warning
SCALE NOT SUPPORTED. The matrices must contain rotation & translation parts only.

◆ Collide() [2/5]

bool AABBTreeCollider::Collide ( const AABBCollisionTree tree0,
const AABBCollisionTree tree1,
const Matrix4x4 world0 = null,
const Matrix4x4 world1 = null,
Pair cache = null 
)

◆ Collide() [3/5]

bool AABBTreeCollider::Collide ( const AABBNoLeafTree tree0,
const AABBNoLeafTree tree1,
const Matrix4x4 world0 = null,
const Matrix4x4 world1 = null,
Pair cache = null 
)

◆ Collide() [4/5]

bool AABBTreeCollider::Collide ( const AABBQuantizedTree tree0,
const AABBQuantizedTree tree1,
const Matrix4x4 world0 = null,
const Matrix4x4 world1 = null,
Pair cache = null 
)

◆ Collide() [5/5]

bool AABBTreeCollider::Collide ( const AABBQuantizedNoLeafTree tree0,
const AABBQuantizedNoLeafTree tree1,
const Matrix4x4 world0 = null,
const Matrix4x4 world1 = null,
Pair cache = null 
)

◆ GetNbBVBVTests()

inline_ udword AABBTreeCollider::GetNbBVBVTests ( ) const
inline

Stats: gets the number of BV-BV overlap tests after a collision query.

See also
GetNbPrimPrimTests()
GetNbBVPrimTests()
Returns
the number of BV-BV tests performed during last query

Definition at line 135 of file OPC_TreeCollider.h.

◆ GetNbBVPrimTests()

inline_ udword AABBTreeCollider::GetNbBVPrimTests ( ) const
inline

Stats: gets the number of BV-Triangle overlap tests after a collision query.

See also
GetNbBVBVTests()
GetNbPrimPrimTests()
Returns
the number of BV-Triangle tests performed during last query

Definition at line 155 of file OPC_TreeCollider.h.

◆ GetNbPairs()

inline_ udword AABBTreeCollider::GetNbPairs ( ) const
inline

Gets the number of contacts after a collision query.

See also
GetContactStatus()
GetPairs()
Returns
the number of contacts / colliding pairs.

Definition at line 167 of file OPC_TreeCollider.h.

◆ GetNbPrimPrimTests()

inline_ udword AABBTreeCollider::GetNbPrimPrimTests ( ) const
inline

Stats: gets the number of Triangle-Triangle overlap tests after a collision query.

See also
GetNbBVBVTests()
GetNbBVPrimTests()
Returns
the number of Triangle-Triangle tests performed during last query

Definition at line 145 of file OPC_TreeCollider.h.

◆ GetPairs()

inline_ const Pair* AABBTreeCollider::GetPairs ( ) const
inline

Gets the pairs of colliding triangles after a collision query.

See also
GetContactStatus()
GetNbPairs()
Returns
the list of colliding pairs (triangle indices)

Definition at line 177 of file OPC_TreeCollider.h.

◆ InitQuery()

HRP_COLLISION_EXPORT void AABBTreeCollider::InitQuery ( const Matrix4x4 world0 = null,
const Matrix4x4 world1 = null 
)
protected

◆ override()

AABBTreeCollider::override ( Collider  ) const

Validates current settings. You should call this method after all the settings and callbacks have been defined for a collider.

Returns
null if everything is ok, else a string describing the problem

◆ PrimTest()

void AABBTreeCollider::PrimTest ( udword  id0,
udword  id1 
)
protected

◆ PrimTestIndexTri()

inline_ void AABBTreeCollider::PrimTestIndexTri ( udword  id0)
protected

◆ PrimTestTriIndex()

inline_ void AABBTreeCollider::PrimTestTriIndex ( udword  id1)
protected

◆ setCollisionPairInserter()

void AABBTreeCollider::setCollisionPairInserter ( hrp::CollisionPairInserterBase collisionPairInserter)
inline

Definition at line 77 of file OPC_TreeCollider.h.

◆ SetFullBoxBoxTest()

inline_ void AABBTreeCollider::SetFullBoxBoxTest ( bool  flag)
inline

Settings: selects between full box-box tests or "SAT-lite" tests (where Class III axes are discarded)

Parameters
flag[in] true for full tests, false for coarse tests
See also
SetFullPrimBoxTest(bool flag)

Definition at line 114 of file OPC_TreeCollider.h.

◆ SetFullPrimBoxTest()

inline_ void AABBTreeCollider::SetFullPrimBoxTest ( bool  flag)
inline

Settings: selects between full triangle-box tests or "SAT-lite" tests (where Class III axes are discarded)

Parameters
flag[in] true for full tests, false for coarse tests
See also
SetFullBoxBoxTest(bool flag)

Definition at line 123 of file OPC_TreeCollider.h.

◆ Setup()

inline_ BOOL AABBTreeCollider::Setup ( const MeshInterface mi0,
const MeshInterface mi1 
)
inlineprotected

Definition at line 247 of file OPC_TreeCollider.h.

◆ TriBoxOverlap()

inline_ BOOL AABBTreeCollider::TriBoxOverlap ( const Point center,
const Point extents 
)
protected

Triangle-Box overlap test using the separating axis theorem. This is the code from Tomas Möller, a bit optimized:

  • with some more lazy evaluation (faster path on PC)
  • with a tiny bit of assembly
  • with "SAT-lite" applied if needed
  • and perhaps with some more minor modifs...
Parameters
center[in] box center
extents[in] box extents
Returns
true if triangle & box overlap

Definition at line 118 of file OPC_TriBoxOverlap.h.

◆ TriTriOverlap()

BOOL AABBTreeCollider::TriTriOverlap ( const Point V0,
const Point V1,
const Point V2,
const Point U0,
const Point U1,
const Point U2 
)
protected

Triangle/triangle intersection test routine, by Tomas Moller, 1997. See article "A Fast Triangle-Triangle Intersection Test", Journal of Graphics Tools, 2(2), 1997

Updated June 1999: removed the divisions – a little faster now! Updated October 1999: added {} to CROSS and SUB macros

int NoDivTriTriIsect(float V0[3],float V1[3],float V2[3], float U0[3],float U1[3],float U2[3])

Parameters
V0[in] triangle 0, vertex 0
V1[in] triangle 0, vertex 1
V2[in] triangle 0, vertex 2
U0[in] triangle 1, vertex 0
U1[in] triangle 1, vertex 1
U2[in] triangle 1, vertex 2
Returns
true if triangles overlap

Definition at line 179 of file OPC_TriTriOverlap.h.

Member Data Documentation

◆ collisionPairInserter

hrp::CollisionPairInserterBase* AABBTreeCollider::collisionPairInserter
protected

Definition at line 220 of file OPC_TreeCollider.h.

◆ mAR

Matrix3x3 AABBTreeCollider::mAR
protected

Absolute rotation matrix.

Definition at line 198 of file OPC_TreeCollider.h.

◆ mCenterCoeff0

Point AABBTreeCollider::mCenterCoeff0
protected

Definition at line 204 of file OPC_TreeCollider.h.

◆ mCenterCoeff1

Point AABBTreeCollider::mCenterCoeff1
protected

Definition at line 206 of file OPC_TreeCollider.h.

◆ mExtentsCoeff0

Point AABBTreeCollider::mExtentsCoeff0
protected

Definition at line 205 of file OPC_TreeCollider.h.

◆ mExtentsCoeff1

Point AABBTreeCollider::mExtentsCoeff1
protected

Definition at line 207 of file OPC_TreeCollider.h.

◆ mFullBoxBoxTest

bool AABBTreeCollider::mFullBoxBoxTest
protected

Perform full BV-BV tests (true) or SAT-lite tests (false)

Definition at line 218 of file OPC_TreeCollider.h.

◆ mFullPrimBoxTest

bool AABBTreeCollider::mFullPrimBoxTest
protected

Perform full Primitive-BV tests (true) or SAT-lite tests (false)

Definition at line 219 of file OPC_TreeCollider.h.

◆ mId0

udword AABBTreeCollider::mId0
protected

Definition at line 210 of file OPC_TreeCollider.h.

◆ mId1

udword AABBTreeCollider::mId1
protected

Definition at line 211 of file OPC_TreeCollider.h.

◆ mIMesh0

const MeshInterface* AABBTreeCollider::mIMesh0
protected

User-defined mesh interface for object0.

Definition at line 191 of file OPC_TreeCollider.h.

◆ mIMesh1

const MeshInterface* AABBTreeCollider::mIMesh1
protected

User-defined mesh interface for object1.

Definition at line 192 of file OPC_TreeCollider.h.

◆ mLeafIndex

udword AABBTreeCollider::mLeafIndex
protected

Triangle index.

Definition at line 216 of file OPC_TreeCollider.h.

◆ mLeafVerts

Point AABBTreeCollider::mLeafVerts[3]
protected

Triangle vertices.

Definition at line 215 of file OPC_TreeCollider.h.

◆ mNbBVBVTests

udword AABBTreeCollider::mNbBVBVTests
protected

Number of BV-BV tests.

Definition at line 194 of file OPC_TreeCollider.h.

◆ mNbBVPrimTests

udword AABBTreeCollider::mNbBVPrimTests
protected

Number of BV-Primitive tests.

Definition at line 196 of file OPC_TreeCollider.h.

◆ mNbPrimPrimTests

udword AABBTreeCollider::mNbPrimPrimTests
protected

Number of Primitive-Primitive tests.

Definition at line 195 of file OPC_TreeCollider.h.

◆ mNowNode0

const AABBCollisionNode* AABBTreeCollider::mNowNode0
protected

Definition at line 212 of file OPC_TreeCollider.h.

◆ mNowNode1

const AABBCollisionNode* AABBTreeCollider::mNowNode1
protected

Definition at line 213 of file OPC_TreeCollider.h.

◆ mPairs

Container AABBTreeCollider::mPairs
protected

Pairs of colliding primitives.

Definition at line 189 of file OPC_TreeCollider.h.

◆ mR0to1

Matrix3x3 AABBTreeCollider::mR0to1
protected

Rotation from object0 to object1.

Definition at line 199 of file OPC_TreeCollider.h.

◆ mR1to0

Matrix3x3 AABBTreeCollider::mR1to0
protected

Rotation from object1 to object0.

Definition at line 200 of file OPC_TreeCollider.h.

◆ mT0to1

Point AABBTreeCollider::mT0to1
protected

Translation from object0 to object1.

Definition at line 201 of file OPC_TreeCollider.h.

◆ mT1to0

Point AABBTreeCollider::mT1to0
protected

Translation from object1 to object0.

Definition at line 202 of file OPC_TreeCollider.h.


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


openhrp3
Author(s): AIST, General Robotix Inc., Nakamura Lab of Dept. of Mechano Informatics at University of Tokyo
autogenerated on Thu Sep 8 2022 02:24:06