Blender V2.61 - r43446

btGjkEpa2.h

Go to the documentation of this file.
00001 /*
00002 Bullet Continuous Collision Detection and Physics Library
00003 Copyright (c) 2003-2008 Erwin Coumans  http://continuousphysics.com/Bullet/
00004 
00005 This software is provided 'as-is', without any express or implied warranty.
00006 In no event will the authors be held liable for any damages arising from the
00007 use of this software.
00008 Permission is granted to anyone to use this software for any purpose,
00009 including commercial applications, and to alter it and redistribute it
00010 freely,
00011 subject to the following restrictions:
00012 
00013 1. The origin of this software must not be misrepresented; you must not
00014 claim that you wrote the original software. If you use this software in a
00015 product, an acknowledgment in the product documentation would be appreciated
00016 but is not required.
00017 2. Altered source versions must be plainly marked as such, and must not be
00018 misrepresented as being the original software.
00019 3. This notice may not be removed or altered from any source distribution.
00020 */
00021 
00022 /*
00023 GJK-EPA collision solver by Nathanael Presson, 2008
00024 */
00025 #ifndef _68DA1F85_90B7_4bb0_A705_83B4040A75C6_
00026 #define _68DA1F85_90B7_4bb0_A705_83B4040A75C6_
00027 #include "BulletCollision/CollisionShapes/btConvexShape.h"
00028 
00030 struct  btGjkEpaSolver2
00031 {
00032 struct  sResults
00033     {
00034     enum eStatus
00035         {
00036         Separated,      /* Shapes doesnt penetrate                                              */ 
00037         Penetrating,    /* Shapes are penetrating                                               */ 
00038         GJK_Failed,     /* GJK phase fail, no big issue, shapes are probably just 'touching'    */ 
00039         EPA_Failed      /* EPA phase fail, bigger problem, need to save parameters, and debug   */ 
00040         }       status;
00041     btVector3   witnesses[2];
00042     btVector3   normal;
00043     btScalar    distance;
00044     };
00045 
00046 static int      StackSizeRequirement();
00047 
00048 static bool     Distance(   const btConvexShape* shape0,const btTransform& wtrs0,
00049                             const btConvexShape* shape1,const btTransform& wtrs1,
00050                             const btVector3& guess,
00051                             sResults& results);
00052 
00053 static bool     Penetration(const btConvexShape* shape0,const btTransform& wtrs0,
00054                             const btConvexShape* shape1,const btTransform& wtrs1,
00055                             const btVector3& guess,
00056                             sResults& results,
00057                             bool usemargins=true);
00058 #ifndef __SPU__
00059 static btScalar SignedDistance( const btVector3& position,
00060                                 btScalar margin,
00061                                 const btConvexShape* shape,
00062                                 const btTransform& wtrs,
00063                                 sResults& results);
00064                             
00065 static bool     SignedDistance( const btConvexShape* shape0,const btTransform& wtrs0,
00066                                 const btConvexShape* shape1,const btTransform& wtrs1,
00067                                 const btVector3& guess,
00068                                 sResults& results);
00069 #endif //__SPU__
00070 
00071 };
00072 
00073 #endif