1 | |
---|
2 | /* |
---|
3 | Bullet Continuous Collision Detection and Physics Library |
---|
4 | Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ |
---|
5 | |
---|
6 | This software is provided 'as-is', without any express or implied warranty. |
---|
7 | In no event will the authors be held liable for any damages arising from the 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 freely, |
---|
10 | subject to the following restrictions: |
---|
11 | |
---|
12 | 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. |
---|
13 | 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. |
---|
14 | 3. This notice may not be removed or altered from any source distribution. |
---|
15 | */ |
---|
16 | |
---|
17 | |
---|
18 | |
---|
19 | |
---|
20 | #ifndef SPU_GJK_PAIR_DETECTOR_H |
---|
21 | #define SPU_GJK_PAIR_DETECTOR_H |
---|
22 | |
---|
23 | |
---|
24 | |
---|
25 | #include "SpuContactResult.h" |
---|
26 | |
---|
27 | |
---|
28 | #include "SpuVoronoiSimplexSolver.h" |
---|
29 | class SpuConvexPenetrationDepthSolver; |
---|
30 | |
---|
31 | /// btGjkPairDetector uses GJK to implement the btDiscreteCollisionDetectorInterface |
---|
32 | class SpuGjkPairDetector |
---|
33 | { |
---|
34 | |
---|
35 | |
---|
36 | btVector3 m_cachedSeparatingAxis; |
---|
37 | const SpuConvexPenetrationDepthSolver* m_penetrationDepthSolver; |
---|
38 | SpuVoronoiSimplexSolver* m_simplexSolver; |
---|
39 | void* m_minkowskiA; |
---|
40 | void* m_minkowskiB; |
---|
41 | int m_shapeTypeA; |
---|
42 | int m_shapeTypeB; |
---|
43 | float m_marginA; |
---|
44 | float m_marginB; |
---|
45 | bool m_ignoreMargin; |
---|
46 | |
---|
47 | |
---|
48 | public: |
---|
49 | |
---|
50 | //some debugging to fix degeneracy problems |
---|
51 | int m_lastUsedMethod; |
---|
52 | int m_curIter; |
---|
53 | int m_degenerateSimplex; |
---|
54 | int m_catchDegeneracies; |
---|
55 | |
---|
56 | |
---|
57 | SpuGjkPairDetector(void* objectA,void* objectB,int m_shapeTypeA, int m_shapeTypeB, float marginA, float marginB, SpuVoronoiSimplexSolver* simplexSolver, const SpuConvexPenetrationDepthSolver* penetrationDepthSolver); |
---|
58 | virtual ~SpuGjkPairDetector() {}; |
---|
59 | |
---|
60 | virtual void getClosestPoints(const SpuClosestPointInput& input,SpuContactResult& output); |
---|
61 | |
---|
62 | void setMinkowskiA(void* minkA) |
---|
63 | { |
---|
64 | m_minkowskiA = minkA; |
---|
65 | } |
---|
66 | |
---|
67 | void setMinkowskiB(void* minkB) |
---|
68 | { |
---|
69 | m_minkowskiB = minkB; |
---|
70 | } |
---|
71 | |
---|
72 | void setCachedSeperatingAxis(const btVector3& seperatingAxis) |
---|
73 | { |
---|
74 | m_cachedSeparatingAxis = seperatingAxis; |
---|
75 | } |
---|
76 | |
---|
77 | void setPenetrationDepthSolver(SpuConvexPenetrationDepthSolver* penetrationDepthSolver) |
---|
78 | { |
---|
79 | m_penetrationDepthSolver = penetrationDepthSolver; |
---|
80 | } |
---|
81 | |
---|
82 | ///don't use setIgnoreMargin, it's for Bullet's internal use |
---|
83 | void setIgnoreMargin(bool ignoreMargin) |
---|
84 | { |
---|
85 | m_ignoreMargin = ignoreMargin; |
---|
86 | } |
---|
87 | |
---|
88 | |
---|
89 | }; |
---|
90 | |
---|
91 | |
---|
92 | |
---|
93 | #endif //SPU_GJK_PAIR_DETECTOR_H |
---|