[1963] | 1 | /* |
---|
| 2 | Bullet Continuous Collision Detection and Physics Library |
---|
| 3 | Copyright (c) 2003-2008 Erwin Coumans http://continuousphysics.com/Bullet/ |
---|
| 4 | |
---|
| 5 | This software is provided 'as-is', without any express or implied warranty. |
---|
| 6 | In no event will the authors be held liable for any damages arising from the |
---|
| 7 | use of this software. |
---|
| 8 | Permission is granted to anyone to use this software for any purpose, |
---|
| 9 | including commercial applications, and to alter it and redistribute it |
---|
| 10 | freely, |
---|
| 11 | subject to the following restrictions: |
---|
| 12 | |
---|
| 13 | 1. The origin of this software must not be misrepresented; you must not |
---|
| 14 | claim that you wrote the original software. If you use this software in a |
---|
| 15 | product, an acknowledgment in the product documentation would be appreciated |
---|
| 16 | but is not required. |
---|
| 17 | 2. Altered source versions must be plainly marked as such, and must not be |
---|
| 18 | misrepresented as being the original software. |
---|
| 19 | 3. This notice may not be removed or altered from any source distribution. |
---|
| 20 | */ |
---|
| 21 | |
---|
| 22 | /* |
---|
| 23 | GJK-EPA collision solver by Nathanael Presson, 2008 |
---|
| 24 | */ |
---|
[8393] | 25 | #ifndef BT_GJK_EPA2_H |
---|
| 26 | #define BT_GJK_EPA2_H |
---|
| 27 | |
---|
[1963] | 28 | #include "BulletCollision/CollisionShapes/btConvexShape.h" |
---|
| 29 | |
---|
| 30 | ///btGjkEpaSolver contributed under zlib by Nathanael Presson |
---|
| 31 | struct btGjkEpaSolver2 |
---|
| 32 | { |
---|
| 33 | struct sResults |
---|
| 34 | { |
---|
| 35 | enum eStatus |
---|
| 36 | { |
---|
| 37 | Separated, /* Shapes doesnt penetrate */ |
---|
| 38 | Penetrating, /* Shapes are penetrating */ |
---|
| 39 | GJK_Failed, /* GJK phase fail, no big issue, shapes are probably just 'touching' */ |
---|
| 40 | EPA_Failed /* EPA phase fail, bigger problem, need to save parameters, and debug */ |
---|
| 41 | } status; |
---|
| 42 | btVector3 witnesses[2]; |
---|
| 43 | btVector3 normal; |
---|
| 44 | btScalar distance; |
---|
| 45 | }; |
---|
| 46 | |
---|
| 47 | static int StackSizeRequirement(); |
---|
| 48 | |
---|
| 49 | static bool Distance( const btConvexShape* shape0,const btTransform& wtrs0, |
---|
| 50 | const btConvexShape* shape1,const btTransform& wtrs1, |
---|
| 51 | const btVector3& guess, |
---|
| 52 | sResults& results); |
---|
| 53 | |
---|
| 54 | static bool Penetration(const btConvexShape* shape0,const btTransform& wtrs0, |
---|
| 55 | const btConvexShape* shape1,const btTransform& wtrs1, |
---|
| 56 | const btVector3& guess, |
---|
| 57 | sResults& results, |
---|
| 58 | bool usemargins=true); |
---|
[8351] | 59 | #ifndef __SPU__ |
---|
[1963] | 60 | static btScalar SignedDistance( const btVector3& position, |
---|
| 61 | btScalar margin, |
---|
| 62 | const btConvexShape* shape, |
---|
| 63 | const btTransform& wtrs, |
---|
| 64 | sResults& results); |
---|
| 65 | |
---|
| 66 | static bool SignedDistance( const btConvexShape* shape0,const btTransform& wtrs0, |
---|
| 67 | const btConvexShape* shape1,const btTransform& wtrs1, |
---|
| 68 | const btVector3& guess, |
---|
| 69 | sResults& results); |
---|
[8351] | 70 | #endif //__SPU__ |
---|
| 71 | |
---|
[1963] | 72 | }; |
---|
| 73 | |
---|
[8393] | 74 | #endif //BT_GJK_EPA2_H |
---|
| 75 | |
---|