bool DTIFilterROI::matches(DTIPathway *pathway) { #ifdef USE_RAPID CollModel *pathwayModel = pathway->getCollisionModel(); RAPID_Collide (_rotation_matrix, _position, _model.get(), ZERO_ROTATION, ZERO_TRANSLATION, pathwayModel, RAPID_FIRST_CONTACT); return RAPID_num_contacts > 0 ? true:false; #else Opcode::Model *pathwayModel = pathway->getCollisionModel(); Opcode::AABBTreeCollider TC; TC.SetFirstContact(true); Opcode::BVTCache cache; cache.Model0 = pathway->getCollisionModel(); cache.Model1 = this->_model.get(); TC.Collide(cache); return TC.GetContactStatus(); #endif }
void Opcode2OpcodeTest(neCollisionResult & result, TConvex & convexA, neT3 & transA, TConvex & convexB, neT3 & transB) { tc.SetFirstContact(false); tc.SetFullBoxBoxTest(true); tc.SetFullPrimBoxTest(true); tc.SetTemporalCoherence(false); tc.SetPointers0(convexA.as.opcodeMesh.triIndices, convexA.as.opcodeMesh.vertices); tc.SetPointers1(convexB.as.opcodeMesh.triIndices, convexB.as.opcodeMesh.vertices); // Setup cache ColCache.Model0 = convexA.as.opcodeMesh.opmodel; ColCache.Model1 = convexB.as.opcodeMesh.opmodel; transA.AssignIceMatrix(worldA); transB.AssignIceMatrix(worldB); // Collision query bool IsOk = tc.Collide(ColCache, &worldA, &worldB); if (tc.GetContactStatus() == false) { result.penetrate = false; return; } u32 npairs = tc.GetNbPairs(); result.penetrate = true; result.depth = 0.0f; for (u32 i = 0; i < npairs; i++) { GetTriangleOverlap(result, i, convexA, convexB); } }