TAPs 0.7.7.3
TAPsCDLib.hpp File Reference
Include dependency graph for TAPsCDLib.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

template<typename T >
BEGIN_NAMESPACE_TAPs__CD
BVHTree< T > * 
BuildBVHTree (TransformationSupport< T > &transform, HEFaceList< T > *heFaceList, Enum::CD treeType)
 Build a BVH tree from a half-edge face list, i.e., for any model that is an instance of a HalfEdgeModel.

Detailed Description

A header file for including TAPs CD (Collision Detection) libraries.

Usage:
Call BuildBVHTree function with the list of a mesh model's faces to be volumedly bounded for collision detection. The function needs a transformation for the mesh model and the type of the tree to build. The function returns the built BVHTree that the caller can be used for collision detection.
The BVHTree has two types of functions for collision detection: TestOverlapWith(...) and TestOverlapWithTillLeafNodes(...).
TestOverlapWith(...) does collision test with the nodes within the BVHTree, including primitive-primitive test.
TestOverlapWithTillLeafNodes(...) does collision test with the nodes within the BVHTree, excluding primitive-primitive test. I.e., its collision testing path stops when a test between two leaf nodes is reached.
TestOverlapWith(...) is suit for a collision detection needs primitive-primitive test or does not need a collision response.
TestOverlapWithTillLeafNodes(...) is suit for a collision detection does not need primitive-primitive test or needs a collision response to be implemented or called later. With the primitive-primitive test can be tested before a collision response.
These test functions store the collided leaf nodes and bounding volumes.
To get the list of collided leaf nodes of the first BVHTree, call GetListOfCollidedNodes().
To get the list of collided leaf nodes of the second BVHTree, call GetListOfCollidedNodesThat().
To get the list of collided bounding volumes, call GetListOfCollidedBoundingVolume().
A lot of collision detection and response functions are implemented in TAPsColDetFns.hpp. Include this
CAUTION:
If there is a scaling on the mesh model. The scale should be applied to the mesh model, and the tree must be update entirely. The reason behind this is to save the computation time from scaling each bounding volume for collision detection. Therefore, transformation of the mesh model must be kept for only translation and rotation, so that the collision detection will work correctly.
Support
Currently only BVHTree_BinarySphere is supported for a half-edge face list.
Future Plan:
To support an xpolygonal model (XPolygonalModel) with BVHTree_BinarySphere
To support a polygonal model (PolygonalModel) with BVHTree_BinarySphere
Complete Plan:
To support an instance of a HalfEdgeModel, XPolygonalModel, and PolygonalModel with all BVH tree types (see the list of BVHTree types).

Definition in file TAPsCDLib.hpp.


Function Documentation

template<typename T >
BEGIN_NAMESPACE_TAPs__CD BVHTree<T>* BuildBVHTree ( TransformationSupport< T > &  transform,
HEFaceList< T > *  heFaceList,
Enum::CD  treeType 
)

Build a BVH tree from a half-edge face list, i.e., for any model that is an instance of a HalfEdgeModel.

Parameters:
transformI/P: Transformation for the face list
heFaceListI/P: half-edge face list
treeTypeI/P: BVHTree type

Definition at line 98 of file TAPsCDLib.hpp.

References BVH_TREE_BINARY_SPHERE.

Referenced by ModelSurgicalSutureWithHeadNeedle_CD< T >::CreateCD(), and ElasticRodCD< T >::CreateCD().

{
    switch ( treeType ) {
        case Enum::BVH_TREE_BINARY_SPHERE:
            return new BVHTree_BinarySphere<T>( transform, heFaceList );
            break;

        default:
            std::cout << "(TAPsCDLib.hpp) TAPs::CD::BuildBVHTree for Tree Type (" << treeType << ") NOT IMPLEMENTED YET!\n";
            break;
    }
    return NULL;
}

Here is the caller graph for this function:

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines