Bullet Collision Detection & Physics Library: btDbvt Struct Reference

Bullet Collision Detection & Physics Library

- Main Page
- Namespaces
- Classes
- Files

- Class List
- Class Hierarchy
- Class Members

Classes | Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Private Member Functions | List of all members
btDbvt Struct Reference

The btDbvt class implements a fast dynamic bounding volume tree based on axis aligned bounding boxes (aabb tree). More...

`#include <btDbvt.h>`

Collaboration diagram for btDbvt:
[legend]

## Classes
struct | IClone
struct | ICollide
struct | IWriter
struct | sStkCLN
struct | sStkNN
struct | sStkNP
struct | sStkNPS

## Public Types
enum | { SIMPLE_STACKSIZE = 64, DOUBLE_STACKSIZE = SIMPLE_STACKSIZE*2 }

## Public Member Functions
| btDbvt ()
| ~btDbvt ()
void | clear ()
bool | empty () const
void | optimizeBottomUp ()
void | optimizeTopDown (int bu_treshold=128)
void | optimizeIncremental (int passes)
btDbvtNode * | insert (const btDbvtVolume &box, void *data)
void | update (btDbvtNode *leaf, int lookahead=-1)
void | update (btDbvtNode *leaf, btDbvtVolume &volume)
bool | update (btDbvtNode *leaf, btDbvtVolume &volume, const btVector3 &velocity, btScalar margin)
bool | update (btDbvtNode *leaf, btDbvtVolume &volume, const btVector3 &velocity)
bool | update (btDbvtNode *leaf, btDbvtVolume &volume, btScalar margin)
void | remove (btDbvtNode *leaf)
void | write (IWriter *iwriter) const
void | clone (btDbvt &dest, IClone *iclone=0) const
DBVT_PREFIX void | collideTT (const btDbvtNode *root0, const btDbvtNode *root1, DBVT_IPOLICY)
DBVT_PREFIX void | collideTTpersistentStack (const btDbvtNode *root0, const btDbvtNode *root1, DBVT_IPOLICY)
DBVT_PREFIX void | collideTV (const btDbvtNode *root, const btDbvtVolume &volume, DBVT_IPOLICY) const
DBVT_PREFIX void | rayTestInternal (const btDbvtNode *root, const btVector3 &rayFrom, const btVector3 &rayTo, const btVector3 &rayDirectionInverse, unsigned int signs[3], btScalar lambda_max, const btVector3 &aabbMin, const btVector3 &aabbMax, DBVT_IPOLICY) const
| rayTestInternal is faster than rayTest, because it uses a persistent stack (to reduce dynamic memory allocations to a minimum) and it uses precomputed signs/rayInverseDirections rayTestInternal is used by btDbvtBroadphase to accelerate world ray casts More...

## Static Public Member Functions
static int | maxdepth (const btDbvtNode *node)
static int | countLeaves (const btDbvtNode *node)
static void | extractLeaves (const btDbvtNode *node, btAlignedObjectArray< const btDbvtNode * > &leaves)
static void | benchmark ()
static DBVT_PREFIX void | enumNodes (const btDbvtNode *root, DBVT_IPOLICY)
static DBVT_PREFIX void | enumLeaves (const btDbvtNode *root, DBVT_IPOLICY)
static DBVT_PREFIX void | rayTest (const btDbvtNode *root, const btVector3 &rayFrom, const btVector3 &rayTo, DBVT_IPOLICY)
| rayTest is a re-entrant ray test, and can be called in parallel as long as the btAlignedAlloc is thread-safe (uses locking etc) rayTest is slower than rayTestInternal, because it builds a local stack, using memory allocations, and it recomputes signs/rayDirectionInverses each time More...
static DBVT_PREFIX void | collideKDOP (const btDbvtNode *root, const btVector3 *normals, const btScalar *offsets, int count, DBVT_IPOLICY)
static DBVT_PREFIX void | collideOCL (const btDbvtNode *root, const btVector3 *normals, const btScalar *offsets, const btVector3 &sortaxis, int count, DBVT_IPOLICY, bool fullsort=true)
static DBVT_PREFIX void | collideTU (const btDbvtNode *root, DBVT_IPOLICY)
static DBVT_INLINE int | nearest (const int *i, const btDbvt::sStkNPS *a, btScalar v, int l, int h)
static DBVT_INLINE int | allocate (btAlignedObjectArray< int > &ifree, btAlignedObjectArray< sStkNPS > &stock, const sStkNPS &value)

## Public Attributes
btDbvtNode * | m_root
btDbvtNode * | m_free
int | m_lkhd
int | m_leaves
unsigned | m_opath
btAlignedObjectArray< sStkNN > | m_stkStack
btAlignedObjectArray< const btDbvtNode * > | m_rayTestStack

## Private Member Functions
| btDbvt (const btDbvt &)

## Detailed Description

The btDbvt class implements a fast dynamic bounding volume tree based on axis aligned bounding boxes (aabb tree).

This btDbvt is used for soft body collision detection and for the btDbvtBroadphase. It has a fast insert, remove and update of nodes. Unlike the btQuantizedBvh, nodes can be dynamically moved around, which allows for change in topology of the underlying data structure.

Definition at line 194 of file btDbvt.h.

## Member Enumeration Documentation

anonymous enum

Enumerator
SIMPLE_STACKSIZE |
DOUBLE_STACKSIZE |

Definition at line 252 of file btDbvt.h.

## Constructor & Destructor Documentation

btDbvt::btDbvt | ( |  | ) |

Definition at line 411 of file btDbvt.cpp.

btDbvt::~btDbvt | ( |  | ) |

Definition at line 421 of file btDbvt.cpp.

btDbvt::btDbvt | ( | const btDbvt & |  | ) |
| inlineprivate

Definition at line 389 of file btDbvt.h.

## Member Function Documentation

static DBVT_INLINE int btDbvt::allocate | ( | btAlignedObjectArray< int > & | ifree,
|  | btAlignedObjectArray< sStkNPS > & | stock,
|  | const sStkNPS & | value
| ) |  |
| inlinestatic

Definition at line 376 of file btDbvt.h.

static void btDbvt::benchmark | ( |  | ) |
| inlinestatic

Definition at line 292 of file btDbvt.h.

void btDbvt::clear | ( |  | ) |

Definition at line 427 of file btDbvt.cpp.

void btDbvt::clone | ( | btDbvt & | dest,
|  | IClone * | iclone = `0`
| ) |  | const

Definition at line 590 of file btDbvt.cpp.

DBVT_PREFIX void btDbvt::collideKDOP | ( | const btDbvtNode * | root,
|  | const btVector3 * | normals,
|  | const btScalar * | offsets,
|  | int | count,
|  | DBVT_IPOLICY |
| ) |  |
| inlinestatic

Definition at line 1076 of file btDbvt.h.

DBVT_PREFIX void btDbvt::collideOCL | ( | const btDbvtNode * | root,
|  | const btVector3 * | normals,
|  | const btScalar * | offsets,
|  | const btVector3 & | sortaxis,
|  | int | count,
|  | DBVT_IPOLICY | ,
|  | bool | fullsort = `true`
| ) |  |
| inlinestatic

Definition at line 1131 of file btDbvt.h.

DBVT_PREFIX void btDbvt::collideTT | ( | const btDbvtNode * | root0,
|  | const btDbvtNode * | root1,
|  | DBVT_IPOLICY |
| ) |  |
| inline

Definition at line 724 of file btDbvt.h.

DBVT_PREFIX void btDbvt::collideTTpersistentStack | ( | const btDbvtNode * | root0,
|  | const btDbvtNode * | root1,
|  | DBVT_IPOLICY |
| ) |  |
| inline

Definition at line 789 of file btDbvt.h.

DBVT_PREFIX void btDbvt::collideTU | ( | const btDbvtNode * | root,
|  | DBVT_IPOLICY |
| ) |  |
| inlinestatic

Definition at line 1235 of file btDbvt.h.

DBVT_PREFIX void btDbvt::collideTV | ( | const btDbvtNode * | root,
|  | const btDbvtVolume & | volume,
|  | DBVT_IPOLICY |
| ) |  | const
| inline

Definition at line 922 of file btDbvt.h.

int btDbvt::countLeaves | ( | const btDbvtNode * | node | ) |
| static

Definition at line 629 of file btDbvt.cpp.

bool btDbvt::empty | ( |  | ) | const
| inline

Definition at line 273 of file btDbvt.h.

DBVT_PREFIX void btDbvt::enumLeaves | ( | const btDbvtNode * | root,
|  | DBVT_IPOLICY |
| ) |  |
| inlinestatic

Definition at line 707 of file btDbvt.h.

DBVT_PREFIX void btDbvt::enumNodes | ( | const btDbvtNode * | root,
|  | DBVT_IPOLICY |
| ) |  |
| inlinestatic

Definition at line 693 of file btDbvt.h.

void btDbvt::extractLeaves | ( | const btDbvtNode * | node,
|  | btAlignedObjectArray< const btDbvtNode * > & | leaves
| ) |  |
| static

Definition at line 638 of file btDbvt.cpp.

btDbvtNode * btDbvt::insert | ( | const btDbvtVolume & | box,
|  | void * | data
| ) |  |

Definition at line 485 of file btDbvt.cpp.

int btDbvt::maxdepth | ( | const btDbvtNode * | node | ) |
| static

Definition at line 621 of file btDbvt.cpp.

static DBVT_INLINE int btDbvt::nearest | ( | const int * | i,
|  | const btDbvt::sStkNPS * | a,
|  | btScalar | v,
|  | int | l,
|  | int | h
| ) |  |
| inlinestatic

Definition at line 366 of file btDbvt.h.

void btDbvt::optimizeBottomUp | ( |  | ) |

Definition at line 440 of file btDbvt.cpp.

void btDbvt::optimizeIncremental | ( | int | passes | ) |

Definition at line 465 of file btDbvt.cpp.

void btDbvt::optimizeTopDown | ( | int | bu_treshold = `128` | ) |

Definition at line 453 of file btDbvt.cpp.

DBVT_PREFIX void btDbvt::rayTest | ( | const btDbvtNode * | root,
|  | const btVector3 & | rayFrom,
|  | const btVector3 & | rayTo,
|  | DBVT_IPOLICY |
| ) |  |
| inlinestatic

rayTest is a re-entrant ray test, and can be called in parallel as long as the btAlignedAlloc is thread-safe (uses locking etc) rayTest is slower than rayTestInternal, because it builds a local stack, using memory allocations, and it recomputes signs/rayDirectionInverses each time

what about division by zero? –> just set rayDirection[i] to INF/BT_LARGE_FLOAT

Definition at line 1007 of file btDbvt.h.

DBVT_PREFIX void btDbvt::rayTestInternal | ( | const btDbvtNode * | root,
|  | const btVector3 & | rayFrom,
|  | const btVector3 & | rayTo,
|  | const btVector3 & | rayDirectionInverse,
|  | unsigned int | signs[3],
|  | btScalar | lambda_max,
|  | const btVector3 & | aabbMin,
|  | const btVector3 & | aabbMax,
|  | DBVT_IPOLICY |
| ) |  | const
| inline

rayTestInternal is faster than rayTest, because it uses a persistent stack (to reduce dynamic memory allocations to a minimum) and it uses precomputed signs/rayInverseDirections rayTestInternal is used by btDbvtBroadphase to accelerate world ray casts

Definition at line 954 of file btDbvt.h.

void btDbvt::remove | ( | btDbvtNode * | leaf | ) |

Definition at line 557 of file btDbvt.cpp.

void btDbvt::update | ( | btDbvtNode * | leaf,
|  | int | lookahead = `-1`
| ) |  |

Definition at line 494 of file btDbvt.cpp.

void btDbvt::update | ( | btDbvtNode * | leaf,
|  | btDbvtVolume & | volume
| ) |  |

Definition at line 511 of file btDbvt.cpp.

bool btDbvt::update | ( | btDbvtNode * | leaf,
|  | btDbvtVolume & | volume,
|  | const btVector3 & | velocity,
|  | btScalar | margin
| ) |  |

Definition at line 529 of file btDbvt.cpp.

bool btDbvt::update | ( | btDbvtNode * | leaf,
|  | btDbvtVolume & | volume,
|  | const btVector3 & | velocity
| ) |  |

Definition at line 539 of file btDbvt.cpp.

bool btDbvt::update | ( | btDbvtNode * | leaf,
|  | btDbvtVolume & | volume,
|  | btScalar | margin
| ) |  |

Definition at line 548 of file btDbvt.cpp.

void btDbvt::write | ( | IWriter * | iwriter | ) | const

Definition at line 565 of file btDbvt.cpp.

## Member Data Documentation

btDbvtNode* btDbvt::m_free

Definition at line 259 of file btDbvt.h.

int btDbvt::m_leaves

Definition at line 261 of file btDbvt.h.

int btDbvt::m_lkhd

Definition at line 260 of file btDbvt.h.

unsigned btDbvt::m_opath

Definition at line 262 of file btDbvt.h.

btAlignedObjectArray<const btDbvtNode*> btDbvt::m_rayTestStack
| mutable

Definition at line 266 of file btDbvt.h.

btDbvtNode* btDbvt::m_root

Definition at line 258 of file btDbvt.h.

btAlignedObjectArray<sStkNN> btDbvt::m_stkStack

Definition at line 265 of file btDbvt.h.

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

- btDbvt.h
- btDbvt.cpp