AGXDynamics  2.31.1.0
btGjkEpa2.h
Go to the documentation of this file.
1 /*
2 Copyright 2007-2021. Algoryx Simulation AB.
3 
4 All AGX source code, intellectual property, documentation, sample code,
5 tutorials, scene files and technical white papers, are copyrighted, proprietary
6 and confidential material of Algoryx Simulation AB. You may not download, read,
7 store, distribute, publish, copy or otherwise disseminate, use or expose this
8 material unless having a written signed agreement with Algoryx Simulation AB, or having been
9 advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10 valid commercial license from Algoryx Simulation AB.
11 
12 Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13 from using this software, unless otherwise stated in written agreements with
14 Algoryx Simulation AB.
15 */
16 
17 /*
18 This source code has been taken and modified by Algoryx Simulation AB
19 from the source and under the license given below.
20 */
21 
22 /*
23 Bullet Continuous Collision Detection and Physics Library
24 Copyright (c) 2003-2008 Erwin Coumans http://continuousphysics.com/Bullet/
25 
26 This software is provided 'as-is', without any express or implied warranty.
27 In no event will the authors be held liable for any damages arising from the
28 use of this software.
29 Permission is granted to anyone to use this software for any purpose,
30 including commercial applications, and to alter it and redistribute it
31 freely,
32 subject to the following restrictions:
33 
34 1. The origin of this software must not be misrepresented; you must not
35 claim that you wrote the original software. If you use this software in a
36 product, an acknowledgment in the product documentation would be appreciated
37 but is not required.
38 2. Altered source versions must be plainly marked as such, and must not be
39 misrepresented as being the original software.
40 3. This notice may not be removed or altered from any source distribution.
41 */
42 
43 /*
44 GJK-EPA collision solver by Nathanael Presson, 2008
45 */
46 #ifndef BT_GJK_EPA2_H
47 #define BT_GJK_EPA2_H
48 
49 #include <agx/macros.h>
50 
52 
53 //#include <agxCollide/bullet/LinearMath/btVector3.h>
54 #include <agx/Vec3.h>
55 #include <agx/AffineMatrix4x4.h>
56 
57 namespace agxCollide
58 {
59  class InitGjkEpa {
60  public:
61  friend class Space;
62  static void init();
63  };
64 
65  class Shape;
66 }
67 
69 struct btGjkEpaSolver2
70 {
71  struct GjkEpaResults
72  {
73  enum eStatus
74  {
75  Separated, /* Shapes do not penetrate */
76  Penetrating, /* Shapes are penetrating */
77  GJK_Failed, /* GJK phase fail, no big issue, shapes are probably just 'touching' */
78  EPA_Failed /* EPA phase fail, bigger problem, need to save parameters, and debug */
79  } status;
80  agx::Vec3 witnesses[2];
81  agx::Vec3 normal;
82  agx::Real distance;
83  };
84 
85  AGXPHYSICS_EXPORT static bool distance( const agxCollide::Shape* shape0, const agx::AffineMatrix4x4& transform0,
86  const agxCollide::Shape* shape1, const agx::AffineMatrix4x4& transform1,
87  const agx::Vec3& guess, GjkEpaResults& results);
88 
89  AGXPHYSICS_EXPORT static bool penetration(const agxCollide::Shape* shape0, const agx::AffineMatrix4x4& transform0,
90  const agxCollide::Shape* shape1, const agx::AffineMatrix4x4& transform1,
91  const agx::Vec3& guess, GjkEpaResults& results, const agx::Real epaAccuracy = agx::Real(1e-6));
92 };
93 
95 
96 
97 #endif //BT_GJK_EPA2_H
98 
void AGXPHYSICS_EXPORT init()
Initialize agx.
Base class for a shape.
Definition: Shape.h:53
agxCollide namespace consists of a set of classes for handling geometric intersection tests including...
#define AGXPHYSICS_EXPORT
double Real
Definition: Real.h:42
#define DOXYGEN_END_INTERNAL_BLOCK()
Definition: Object.h:102
#define DOXYGEN_START_INTERNAL_BLOCK()
Definition: Object.h:101