Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef BT_SPHERE_TRIANGLE_DETECTOR_H
00017 #define BT_SPHERE_TRIANGLE_DETECTOR_H
00018
00019 #include "BulletCollision/NarrowPhaseCollision/btDiscreteCollisionDetectorInterface.h"
00020
00021
00022
00023 class btSphereShape;
00024 class btTriangleShape;
00025
00026
00027
00029 struct SphereTriangleDetector : public btDiscreteCollisionDetectorInterface
00030 {
00031 virtual void getClosestPoints(const ClosestPointInput& input,Result& output,class btIDebugDraw* debugDraw,bool swapResults=false);
00032
00033 SphereTriangleDetector(btSphereShape* sphere,btTriangleShape* triangle, btScalar contactBreakingThreshold);
00034
00035 virtual ~SphereTriangleDetector() {};
00036
00037 bool collide(const btVector3& sphereCenter,btVector3 &point, btVector3& resultNormal, btScalar& depth, btScalar &timeOfImpact, btScalar contactBreakingThreshold);
00038
00039 private:
00040
00041
00042 bool pointInTriangle(const btVector3 vertices[], const btVector3 &normal, btVector3 *p );
00043 bool facecontains(const btVector3 &p,const btVector3* vertices,btVector3& normal);
00044
00045 btSphereShape* m_sphere;
00046 btTriangleShape* m_triangle;
00047 btScalar m_contactBreakingThreshold;
00048
00049 };
00050 #endif //BT_SPHERE_TRIANGLE_DETECTOR_H
00051