| [1963] | 1 | /* | 
|---|
|  | 2 | Bullet Continuous Collision Detection and Physics Library | 
|---|
|  | 3 | Copyright (c) 2003-2006 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 use of this software. | 
|---|
|  | 7 | Permission is granted to anyone to use this software for any purpose, | 
|---|
|  | 8 | including commercial applications, and to alter it and redistribute it freely, | 
|---|
|  | 9 | subject to the following restrictions: | 
|---|
|  | 10 |  | 
|---|
|  | 11 | 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. | 
|---|
|  | 12 | 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. | 
|---|
|  | 13 | 3. This notice may not be removed or altered from any source distribution. | 
|---|
|  | 14 | */ | 
|---|
|  | 15 |  | 
|---|
| [8393] | 16 | #ifndef BT_SOLVE_2LINEAR_CONSTRAINT_H | 
|---|
|  | 17 | #define BT_SOLVE_2LINEAR_CONSTRAINT_H | 
|---|
| [1963] | 18 |  | 
|---|
|  | 19 | #include "LinearMath/btMatrix3x3.h" | 
|---|
|  | 20 | #include "LinearMath/btVector3.h" | 
|---|
|  | 21 |  | 
|---|
|  | 22 |  | 
|---|
|  | 23 | class btRigidBody; | 
|---|
|  | 24 |  | 
|---|
|  | 25 |  | 
|---|
|  | 26 |  | 
|---|
|  | 27 | /// constraint class used for lateral tyre friction. | 
|---|
|  | 28 | class   btSolve2LinearConstraint | 
|---|
|  | 29 | { | 
|---|
|  | 30 | btScalar        m_tau; | 
|---|
|  | 31 | btScalar        m_damping; | 
|---|
|  | 32 |  | 
|---|
|  | 33 | public: | 
|---|
|  | 34 |  | 
|---|
|  | 35 | btSolve2LinearConstraint(btScalar tau,btScalar damping) | 
|---|
|  | 36 | { | 
|---|
|  | 37 | m_tau = tau; | 
|---|
|  | 38 | m_damping = damping; | 
|---|
|  | 39 | } | 
|---|
|  | 40 | // | 
|---|
|  | 41 | // solve unilateral constraint (equality, direct method) | 
|---|
|  | 42 | // | 
|---|
|  | 43 | void resolveUnilateralPairConstraint( | 
|---|
|  | 44 | btRigidBody* body0, | 
|---|
|  | 45 | btRigidBody* body1, | 
|---|
|  | 46 |  | 
|---|
|  | 47 | const btMatrix3x3& world2A, | 
|---|
|  | 48 | const btMatrix3x3& world2B, | 
|---|
|  | 49 |  | 
|---|
|  | 50 | const btVector3& invInertiaADiag, | 
|---|
|  | 51 | const btScalar invMassA, | 
|---|
|  | 52 | const btVector3& linvelA,const btVector3& angvelA, | 
|---|
|  | 53 | const btVector3& rel_posA1, | 
|---|
|  | 54 | const btVector3& invInertiaBDiag, | 
|---|
|  | 55 | const btScalar invMassB, | 
|---|
|  | 56 | const btVector3& linvelB,const btVector3& angvelB, | 
|---|
|  | 57 | const btVector3& rel_posA2, | 
|---|
|  | 58 |  | 
|---|
|  | 59 | btScalar depthA, const btVector3& normalA, | 
|---|
|  | 60 | const btVector3& rel_posB1,const btVector3& rel_posB2, | 
|---|
|  | 61 | btScalar depthB, const btVector3& normalB, | 
|---|
|  | 62 | btScalar& imp0,btScalar& imp1); | 
|---|
|  | 63 |  | 
|---|
|  | 64 |  | 
|---|
|  | 65 | // | 
|---|
|  | 66 | // solving 2x2 lcp problem (inequality, direct solution ) | 
|---|
|  | 67 | // | 
|---|
|  | 68 | void resolveBilateralPairConstraint( | 
|---|
|  | 69 | btRigidBody* body0, | 
|---|
|  | 70 | btRigidBody* body1, | 
|---|
|  | 71 | const btMatrix3x3& world2A, | 
|---|
|  | 72 | const btMatrix3x3& world2B, | 
|---|
|  | 73 |  | 
|---|
|  | 74 | const btVector3& invInertiaADiag, | 
|---|
|  | 75 | const btScalar invMassA, | 
|---|
|  | 76 | const btVector3& linvelA,const btVector3& angvelA, | 
|---|
|  | 77 | const btVector3& rel_posA1, | 
|---|
|  | 78 | const btVector3& invInertiaBDiag, | 
|---|
|  | 79 | const btScalar invMassB, | 
|---|
|  | 80 | const btVector3& linvelB,const btVector3& angvelB, | 
|---|
|  | 81 | const btVector3& rel_posA2, | 
|---|
|  | 82 |  | 
|---|
|  | 83 | btScalar depthA, const btVector3& normalA, | 
|---|
|  | 84 | const btVector3& rel_posB1,const btVector3& rel_posB2, | 
|---|
|  | 85 | btScalar depthB, const btVector3& normalB, | 
|---|
|  | 86 | btScalar& imp0,btScalar& imp1); | 
|---|
|  | 87 |  | 
|---|
|  | 88 | /* | 
|---|
|  | 89 | void resolveAngularConstraint(  const btMatrix3x3& invInertiaAWS, | 
|---|
|  | 90 | const btScalar invMassA, | 
|---|
|  | 91 | const btVector3& linvelA,const btVector3& angvelA, | 
|---|
|  | 92 | const btVector3& rel_posA1, | 
|---|
|  | 93 | const btMatrix3x3& invInertiaBWS, | 
|---|
|  | 94 | const btScalar invMassB, | 
|---|
|  | 95 | const btVector3& linvelB,const btVector3& angvelB, | 
|---|
|  | 96 | const btVector3& rel_posA2, | 
|---|
|  | 97 |  | 
|---|
|  | 98 | btScalar depthA, const btVector3& normalA, | 
|---|
|  | 99 | const btVector3& rel_posB1,const btVector3& rel_posB2, | 
|---|
|  | 100 | btScalar depthB, const btVector3& normalB, | 
|---|
|  | 101 | btScalar& imp0,btScalar& imp1); | 
|---|
|  | 102 |  | 
|---|
|  | 103 | */ | 
|---|
|  | 104 |  | 
|---|
|  | 105 | }; | 
|---|
|  | 106 |  | 
|---|
| [8393] | 107 | #endif //BT_SOLVE_2LINEAR_CONSTRAINT_H | 
|---|