Exemplo n.º 1
0
bool SSVTreeCollider::Collide(const AABBCollisionTree* tree0, 
                              const AABBCollisionTree* tree1, 
                              const Matrix4x4* world0, const Matrix4x4* world1, 
                              Pair* cache, double tolerance)
{
    // Init collision query
    InitQuery(world0, world1);
    
    // todo : cache should be used 

    // Perform collision detection
    if (_Collide(tree0->GetNodes(), tree1->GetNodes(), tolerance)){
        // update cache
        cache->id0 = mId0;
        cache->id1 = mId1;
        return true;
    }

    return false;
}
Exemplo n.º 2
0
void SSVTreeCollider::Distance(const AABBCollisionTree* tree0, 
                               const AABBCollisionTree* tree1, 
                               const Matrix4x4* world0, const Matrix4x4* world1, 
                               Pair* cache, float& minD, Point &point0, Point&point1)
{
    if (debug) std::cout << "Distance()" << std::endl;
    // Init collision query
    InitQuery(world0, world1);
    
    // Compute initial value using temporal coherency
    // todo : cache should be used 

    const AABBCollisionNode *n;
    for (unsigned int i=0; i<tree0->GetNbNodes(); i++){
        n = tree0->GetNodes()+i;
        if (n->IsLeaf()){
            mId0 = n->GetPrimitive();
            break;
        }
    } 
    for (unsigned int i=0; i<tree1->GetNbNodes(); i++){
        n = tree1->GetNodes()+i;
        if (n->IsLeaf()){
            mId1 = n->GetPrimitive();
            break;
        }
    } 
    Point p0, p1;
    minD = PrimDist(mId0, mId1, p0, p1);
    
    // Perform distance computation
    _Distance(tree0->GetNodes(), tree1->GetNodes(), minD, p0, p1);

    // transform points
    TransformPoint4x3(point0, p0, *world1);
    TransformPoint4x3(point1, p1, *world1);

    // update cache
    cache->id0 = mId0;
    cache->id1 = mId1;
}
Exemplo n.º 3
0
Query::Query(std::string strTable, std::string strCondition, cell connectionHandle, unsigned short type) 
	: m_strCondition(strCondition), m_nConnectionHandle(connectionHandle), m_nType(type)
{
	InitQuery(type, strTable);
}