OPC_SphereCollider.h
Go to the documentation of this file.
00001 
00002 /*
00003  *      OPCODE - Optimized Collision Detection
00004  *      Copyright (C) 2001 Pierre Terdiman
00005  *      Homepage: http://www.codercorner.com/Opcode.htm
00006  */
00008 
00010 
00016 
00017 
00019 // Include Guard
00020 #ifndef __OPC_SPHERECOLLIDER_H__
00021 #define __OPC_SPHERECOLLIDER_H__
00022 
00023         struct OPCODE_API SphereCache : VolumeCache
00024         {
00025                                         SphereCache() : Center(0.0f,0.0f,0.0f), FatRadius2(0.0f), FatCoeff(1.1f)        {}
00026                                         ~SphereCache()                                                                                                                          {}
00027 
00028                 // Cached faces signature
00029                 Point           Center;         
00030                 float           FatRadius2;     
00031                 // User settings
00032                 float           FatCoeff;       
00033         };
00034 
00035         class OPCODE_API SphereCollider : public VolumeCollider
00036         {
00037                 public:
00038                 // Constructor / Destructor
00039                                                                                         SphereCollider();
00040                 virtual                                                         ~SphereCollider();
00041 
00043 
00057 
00058                                                         bool                    Collide(SphereCache& cache, const Sphere& sphere, const Model& model, const Matrix4x4* worlds=null, const Matrix4x4* worldm=null);
00059 
00060                 // 
00061                                                         bool                    Collide(SphereCache& cache, const Sphere& sphere, const AABBTree* tree);
00062                 protected:
00063                 // Sphere in model space
00064                                                         Point                   mCenter;                        
00065                                                         float                   mRadius2;                       
00066                 // Internal methods
00067                                                         void                    _Collide(const AABBCollisionNode* node);
00068                                                         void                    _Collide(const AABBNoLeafNode* node);
00069                                                         void                    _Collide(const AABBQuantizedNode* node);
00070                                                         void                    _Collide(const AABBQuantizedNoLeafNode* node);
00071                                                         void                    _Collide(const AABBTreeNode* node);
00072                                                         void                    _CollideNoPrimitiveTest(const AABBCollisionNode* node);
00073                                                         void                    _CollideNoPrimitiveTest(const AABBNoLeafNode* node);
00074                                                         void                    _CollideNoPrimitiveTest(const AABBQuantizedNode* node);
00075                                                         void                    _CollideNoPrimitiveTest(const AABBQuantizedNoLeafNode* node);
00076                         // Overlap tests
00077                 inline_                         BOOL                    SphereContainsBox(const Point& bc, const Point& be);
00078                 inline_                         BOOL                    SphereAABBOverlap(const Point& center, const Point& extents);
00079                                                         BOOL                    SphereTriOverlap(const Point& vert0, const Point& vert1, const Point& vert2);
00080                         // Init methods
00081                                                         BOOL                    InitQuery(SphereCache& cache, const Sphere& sphere, const Matrix4x4* worlds=null, const Matrix4x4* worldm=null);
00082         };
00083 
00084         class OPCODE_API HybridSphereCollider : public SphereCollider
00085         {
00086                 public:
00087                 // Constructor / Destructor
00088                                                                                         HybridSphereCollider();
00089                 virtual                                                         ~HybridSphereCollider();
00090 
00091                                                         bool                    Collide(SphereCache& cache, const Sphere& sphere, const HybridModel& model, const Matrix4x4* worlds=null, const Matrix4x4* worldm=null);
00092                 protected:
00093                                                         Container               mTouchedBoxes;
00094         };
00095 
00096 #endif // __OPC_SPHERECOLLIDER_H__


openhrp3
Author(s): AIST, General Robotix Inc., Nakamura Lab of Dept. of Mechano Informatics at University of Tokyo
autogenerated on Sun Apr 2 2017 03:43:56