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

#include <Opcode.h>

Inheritance diagram for Opcode::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 Opcode::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 Opcode::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 Opcode::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

Definition at line 70 of file Opcode.h.

Constructor & Destructor Documentation

AABBTreeCollider::AABBTreeCollider ( )

Constructor.

Definition at line 49 of file OPC_TreeCollider.cpp.

AABBTreeCollider::~AABBTreeCollider ( )
virtual

Destructor.

Definition at line 67 of file OPC_TreeCollider.cpp.

Member Function Documentation

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

Recursive collision query for normal AABB trees.

Parameters
b0[in] collision node from first tree
b1[in] collision node from second tree

Definition at line 518 of file OPC_TreeCollider.cpp.

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

Recursive collision query for quantized AABB trees.

Parameters
b0[in] collision node from first tree
b1[in] collision node from second tree
a[in] extent from box A
Pa[in] center from box A
b[in] extent from box B
Pb[in] center from box B

Definition at line 804 of file OPC_TreeCollider.cpp.

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

Recursive collision query for no-leaf AABB trees.

Parameters
a[in] collision node from first tree
b[in] collision node from second tree

Definition at line 709 of file OPC_TreeCollider.cpp.

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

Recursive collision query for quantized no-leaf AABB trees.

Parameters
a[in] collision node from first tree
b[in] collision node from second tree

Definition at line 914 of file OPC_TreeCollider.cpp.

void AABBTreeCollider::_CollideBoxTri ( const AABBNoLeafNode b)
protected

Recursive collision of a leaf node from B and a branch from A.

Parameters
b[in] collision node from first tree

Definition at line 674 of file OPC_TreeCollider.cpp.

void AABBTreeCollider::_CollideBoxTri ( const AABBQuantizedNoLeafNode b)
protected

Recursive collision of a leaf node from B and a quantized branch from A.

Parameters
b[in] collision node from first tree
leaf[in] leaf triangle from second tree

Definition at line 885 of file OPC_TreeCollider.cpp.

void AABBTreeCollider::_CollideTriBox ( const AABBNoLeafNode b)
protected

Recursive collision of a leaf node from A and a branch from B.

Parameters
b[in] collision node from second tree

Definition at line 650 of file OPC_TreeCollider.cpp.

void AABBTreeCollider::_CollideTriBox ( const AABBQuantizedNoLeafNode b)
protected

Recursive collision of a leaf node from A and a quantized branch from B.

Parameters
leaf[in] leaf triangle from first tree
b[in] collision node from second tree

Definition at line 856 of file OPC_TreeCollider.cpp.

inline_ BOOL Opcode::AABBTreeCollider::BoxBoxOverlap ( const Point ea,
const Point ca,
const Point eb,
const Point cb 
)
protected
bool AABBTreeCollider::CheckTemporalCoherence ( Pair cache)
protected

Takes advantage of temporal coherence.

Parameters
cache[in] cache for a pair of previously colliding primitives
Returns
true if we can return immediately
Warning
only works for "First Contact" mode

Definition at line 316 of file OPC_TreeCollider.cpp.

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.

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
world1[in] world matrix for second object
Returns
true if success
Warning
SCALE NOT SUPPORTED. The matrices must contain rotation & translation parts only.

Definition at line 97 of file OPC_TreeCollider.cpp.

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

Collision query for normal AABB trees.

Parameters
tree0[in] AABB tree from first object
tree1[in] AABB tree from second object
world0[in] world matrix for first object
world1[in] world matrix for second object
cache[in/out] cache for a pair of previously colliding primitives
Returns
true if success
Warning
SCALE NOT SUPPORTED. The matrices must contain rotation & translation parts only.

Definition at line 349 of file OPC_TreeCollider.cpp.

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

Collision query for no-leaf AABB trees.

Parameters
tree0[in] AABB tree from first object
tree1[in] AABB tree from second object
world0[in] world matrix for first object
world1[in] world matrix for second object
cache[in/out] cache for a pair of previously colliding primitives
Returns
true if success
Warning
SCALE NOT SUPPORTED. The matrices must contain rotation & translation parts only.

Definition at line 377 of file OPC_TreeCollider.cpp.

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

Collision query for quantized AABB trees.

Parameters
tree0[in] AABB tree from first object
tree1[in] AABB tree from second object
world0[in] world matrix for first object
world1[in] world matrix for second object
cache[in/out] cache for a pair of previously colliding primitives
Returns
true if success
Warning
SCALE NOT SUPPORTED. The matrices must contain rotation & translation parts only.

Definition at line 405 of file OPC_TreeCollider.cpp.

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

Collision query for quantized no-leaf AABB trees.

Parameters
tree0[in] AABB tree from first object
tree1[in] AABB tree from second object
world0[in] world matrix for first object
world1[in] world matrix for second object
cache[in/out] cache for a pair of previously colliding primitives
Returns
true if success
Warning
SCALE NOT SUPPORTED. The matrices must contain rotation & translation parts only.

Definition at line 448 of file OPC_TreeCollider.cpp.

inline_ udword Opcode::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 Opcode.h.

inline_ udword Opcode::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 Opcode.h.

inline_ udword Opcode::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 Opcode.h.

inline_ udword Opcode::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 Opcode.h.

inline_ const Pair* Opcode::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 Opcode.h.

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

Initializes a collision query :

  • reset stats & contact status
  • setup matrices
Parameters
world0[in] world matrix for first object
world1[in] world matrix for second object
Warning
SCALE NOT SUPPORTED. The matrices must contain rotation & translation parts only.

Definition at line 241 of file OPC_TreeCollider.cpp.

Opcode::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
void AABBTreeCollider::PrimTest ( udword  id0,
udword  id1 
)
protected

Leaf-leaf test for two primitive indices.

Parameters
id0[in] index from first leaf-triangle
id1[in] index from second leaf-triangle

Definition at line 571 of file OPC_TreeCollider.cpp.

inline_ void AABBTreeCollider::PrimTestIndexTri ( udword  id0)
protected

Leaf-leaf test for a previously fetched triangle from tree B (in A's space) and a new leaf from A.

Parameters
id0[in] leaf-triangle index from tree A

Definition at line 628 of file OPC_TreeCollider.cpp.

inline_ void AABBTreeCollider::PrimTestTriIndex ( udword  id1)
protected

Leaf-leaf test for a previously fetched triangle from tree A (in B's space) and a new leaf from B.

Parameters
id1[in] leaf-triangle index from tree B

Definition at line 606 of file OPC_TreeCollider.cpp.

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

Definition at line 77 of file Opcode.h.

inline_ void Opcode::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 Opcode.h.

inline_ void Opcode::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 Opcode.h.

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

Definition at line 247 of file Opcode.h.

inline_ BOOL Opcode::AABBTreeCollider::TriBoxOverlap ( const Point center,
const Point extents 
)
protected
BOOL Opcode::AABBTreeCollider::TriTriOverlap ( const Point V0,
const Point V1,
const Point V2,
const Point U0,
const Point U1,
const Point U2 
)
protected

Member Data Documentation

hrp::CollisionPairInserterBase* Opcode::AABBTreeCollider::collisionPairInserter
protected

Definition at line 220 of file Opcode.h.

Matrix3x3 Opcode::AABBTreeCollider::mAR
protected

Absolute rotation matrix.

Definition at line 198 of file Opcode.h.

Point Opcode::AABBTreeCollider::mCenterCoeff0
protected

Definition at line 204 of file Opcode.h.

Point Opcode::AABBTreeCollider::mCenterCoeff1
protected

Definition at line 206 of file Opcode.h.

Point Opcode::AABBTreeCollider::mExtentsCoeff0
protected

Definition at line 205 of file Opcode.h.

Point Opcode::AABBTreeCollider::mExtentsCoeff1
protected

Definition at line 207 of file Opcode.h.

bool Opcode::AABBTreeCollider::mFullBoxBoxTest
protected

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

Definition at line 218 of file Opcode.h.

bool Opcode::AABBTreeCollider::mFullPrimBoxTest
protected

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

Definition at line 219 of file Opcode.h.

udword Opcode::AABBTreeCollider::mId0
protected

Definition at line 210 of file Opcode.h.

udword Opcode::AABBTreeCollider::mId1
protected

Definition at line 211 of file Opcode.h.

const MeshInterface* Opcode::AABBTreeCollider::mIMesh0
protected

User-defined mesh interface for object0.

Definition at line 191 of file Opcode.h.

const MeshInterface* Opcode::AABBTreeCollider::mIMesh1
protected

User-defined mesh interface for object1.

Definition at line 192 of file Opcode.h.

udword Opcode::AABBTreeCollider::mLeafIndex
protected

Triangle index.

Definition at line 216 of file Opcode.h.

Point Opcode::AABBTreeCollider::mLeafVerts[3]
protected

Triangle vertices.

Definition at line 215 of file Opcode.h.

udword Opcode::AABBTreeCollider::mNbBVBVTests
protected

Number of BV-BV tests.

Definition at line 194 of file Opcode.h.

udword Opcode::AABBTreeCollider::mNbBVPrimTests
protected

Number of BV-Primitive tests.

Definition at line 196 of file Opcode.h.

udword Opcode::AABBTreeCollider::mNbPrimPrimTests
protected

Number of Primitive-Primitive tests.

Definition at line 195 of file Opcode.h.

const AABBCollisionNode* Opcode::AABBTreeCollider::mNowNode0
protected

Definition at line 212 of file Opcode.h.

const AABBCollisionNode* Opcode::AABBTreeCollider::mNowNode1
protected

Definition at line 213 of file Opcode.h.

Container Opcode::AABBTreeCollider::mPairs
protected

Pairs of colliding primitives.

Definition at line 189 of file Opcode.h.

Matrix3x3 Opcode::AABBTreeCollider::mR0to1
protected

Rotation from object0 to object1.

Definition at line 199 of file Opcode.h.

Matrix3x3 Opcode::AABBTreeCollider::mR1to0
protected

Rotation from object1 to object0.

Definition at line 200 of file Opcode.h.

Point Opcode::AABBTreeCollider::mT0to1
protected

Translation from object0 to object1.

Definition at line 201 of file Opcode.h.

Point Opcode::AABBTreeCollider::mT1to0
protected

Translation from object1 to object0.

Definition at line 202 of file Opcode.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 Sat May 8 2021 02:42:45