Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btSequentialImpulseConstraintSolver.h @ 11768

Last change on this file since 11768 was 8393, checked in by rgrieder, 14 years ago

Updated Bullet from v2.77 to v2.78.
(I'm not going to make a branch for that since the update from 2.74 to 2.77 hasn't been tested that much either).

You will HAVE to do a complete RECOMPILE! I tested with MSVC and MinGW and they both threw linker errors at me.

  • Property svn:eol-style set to native
File size: 6.5 KB
RevLine 
[1963]1/*
2Bullet Continuous Collision Detection and Physics Library
3Copyright (c) 2003-2006 Erwin Coumans  http://continuousphysics.com/Bullet/
4
5This software is provided 'as-is', without any express or implied warranty.
6In no event will the authors be held liable for any damages arising from the use of this software.
7Permission is granted to anyone to use this software for any purpose,
8including commercial applications, and to alter it and redistribute it freely,
9subject to the following restrictions:
10
111. 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.
122. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
133. This notice may not be removed or altered from any source distribution.
14*/
15
[8393]16#ifndef BT_SEQUENTIAL_IMPULSE_CONSTRAINT_SOLVER_H
17#define BT_SEQUENTIAL_IMPULSE_CONSTRAINT_SOLVER_H
[1963]18
19#include "btConstraintSolver.h"
20class btIDebugDraw;
21#include "btContactConstraint.h"
22#include "btSolverBody.h"
23#include "btSolverConstraint.h"
[8351]24#include "btTypedConstraint.h"
25#include "BulletCollision/NarrowPhaseCollision/btManifoldPoint.h"
[1963]26
[2882]27///The btSequentialImpulseConstraintSolver is a fast SIMD implementation of the Projected Gauss Seidel (iterative LCP) method.
[1963]28class btSequentialImpulseConstraintSolver : public btConstraintSolver
29{
[2882]30protected:
[1963]31
[2882]32        btConstraintArray                       m_tmpSolverContactConstraintPool;
33        btConstraintArray                       m_tmpSolverNonContactConstraintPool;
34        btConstraintArray                       m_tmpSolverContactFrictionConstraintPool;
[1963]35        btAlignedObjectArray<int>       m_orderTmpConstraintPool;
36        btAlignedObjectArray<int>       m_orderFrictionConstraintPool;
[8351]37        btAlignedObjectArray<btTypedConstraint::btConstraintInfo1> m_tmpConstraintSizesPool;
[1963]38
[8351]39        void setupFrictionConstraint(   btSolverConstraint& solverConstraint, const btVector3& normalAxis,btRigidBody* solverBodyA,btRigidBody* solverBodyIdB,
40                                                                        btManifoldPoint& cp,const btVector3& rel_pos1,const btVector3& rel_pos2,
41                                                                        btCollisionObject* colObj0,btCollisionObject* colObj1, btScalar relaxation, 
42                                                                        btScalar desiredVelocity=0., btScalar cfmSlip=0.);
43
44        btSolverConstraint&     addFrictionConstraint(const btVector3& normalAxis,btRigidBody* solverBodyA,btRigidBody* solverBodyB,int frictionIndex,btManifoldPoint& cp,const btVector3& rel_pos1,const btVector3& rel_pos2,btCollisionObject* colObj0,btCollisionObject* colObj1, btScalar relaxation, btScalar desiredVelocity=0., btScalar cfmSlip=0.);
[1963]45       
[8351]46        void setupContactConstraint(btSolverConstraint& solverConstraint, btCollisionObject* colObj0, btCollisionObject* colObj1, btManifoldPoint& cp, 
47                                                                const btContactSolverInfo& infoGlobal, btVector3& vel, btScalar& rel_vel, btScalar& relaxation, 
48                                                                btVector3& rel_pos1, btVector3& rel_pos2);
49
50        void setFrictionConstraintImpulse( btSolverConstraint& solverConstraint, btRigidBody* rb0, btRigidBody* rb1, 
51                                                                                 btManifoldPoint& cp, const btContactSolverInfo& infoGlobal);
52
[1963]53        ///m_btSeed2 is used for re-arranging the constraint rows. improves convergence/quality of friction
54        unsigned long   m_btSeed2;
55
[8351]56//      void    initSolverBody(btSolverBody* solverBody, btCollisionObject* collisionObject);
[2882]57        btScalar restitutionCurve(btScalar rel_vel, btScalar restitution);
58
59        void    convertContact(btPersistentManifold* manifold,const btContactSolverInfo& infoGlobal);
60
[8351]61
62        void    resolveSplitPenetrationSIMD(
63        btRigidBody& body1,
64        btRigidBody& body2,
65        const btSolverConstraint& contactConstraint);
66
[2882]67        void    resolveSplitPenetrationImpulseCacheFriendly(
[8351]68        btRigidBody& body1,
69        btRigidBody& body2,
70        const btSolverConstraint& contactConstraint);
[2882]71
72        //internal method
73        int     getOrInitSolverBody(btCollisionObject& body);
74
[8351]75        void    resolveSingleConstraintRowGeneric(btRigidBody& body1,btRigidBody& body2,const btSolverConstraint& contactConstraint);
[2882]76
[8351]77        void    resolveSingleConstraintRowGenericSIMD(btRigidBody& body1,btRigidBody& body2,const btSolverConstraint& contactConstraint);
[2882]78       
[8351]79        void    resolveSingleConstraintRowLowerLimit(btRigidBody& body1,btRigidBody& body2,const btSolverConstraint& contactConstraint);
[2882]80       
[8351]81        void    resolveSingleConstraintRowLowerLimitSIMD(btRigidBody& body1,btRigidBody& body2,const btSolverConstraint& contactConstraint);
[2882]82               
[8351]83protected:
84        static btRigidBody& getFixedBody();
85       
86        virtual void solveGroupCacheFriendlySplitImpulseIterations(btCollisionObject** bodies,int numBodies,btPersistentManifold** manifoldPtr, int numManifolds,btTypedConstraint** constraints,int numConstraints,const btContactSolverInfo& infoGlobal,btIDebugDraw* debugDrawer,btStackAlloc* stackAlloc);
87        virtual btScalar solveGroupCacheFriendlyFinish(btCollisionObject** bodies ,int numBodies,btPersistentManifold** manifoldPtr, int numManifolds,btTypedConstraint** constraints,int numConstraints,const btContactSolverInfo& infoGlobal,btIDebugDraw* debugDrawer,btStackAlloc* stackAlloc);
88        btScalar solveSingleIteration(int iteration, btCollisionObject** bodies ,int numBodies,btPersistentManifold** manifoldPtr, int numManifolds,btTypedConstraint** constraints,int numConstraints,const btContactSolverInfo& infoGlobal,btIDebugDraw* debugDrawer,btStackAlloc* stackAlloc);
89
90        virtual btScalar solveGroupCacheFriendlySetup(btCollisionObject** bodies,int numBodies,btPersistentManifold** manifoldPtr, int numManifolds,btTypedConstraint** constraints,int numConstraints,const btContactSolverInfo& infoGlobal,btIDebugDraw* debugDrawer,btStackAlloc* stackAlloc);
91        virtual btScalar solveGroupCacheFriendlyIterations(btCollisionObject** bodies,int numBodies,btPersistentManifold** manifoldPtr, int numManifolds,btTypedConstraint** constraints,int numConstraints,const btContactSolverInfo& infoGlobal,btIDebugDraw* debugDrawer,btStackAlloc* stackAlloc);
92
93
[1963]94public:
95
96       
97        btSequentialImpulseConstraintSolver();
[2882]98        virtual ~btSequentialImpulseConstraintSolver();
[1963]99
[2882]100        virtual btScalar solveGroup(btCollisionObject** bodies,int numBodies,btPersistentManifold** manifold,int numManifolds,btTypedConstraint** constraints,int numConstraints,const btContactSolverInfo& info, btIDebugDraw* debugDrawer, btStackAlloc* stackAlloc,btDispatcher* dispatcher);
[1963]101       
102
[8351]103       
[1963]104        ///clear internal cached data and reset random seed
105        virtual void    reset();
106       
107        unsigned long btRand2();
108
109        int btRandInt2 (int n);
110
111        void    setRandSeed(unsigned long seed)
112        {
113                m_btSeed2 = seed;
114        }
115        unsigned long   getRandSeed() const
116        {
117                return m_btSeed2;
118        }
119
120};
121
122#ifndef BT_PREFER_SIMD
123typedef btSequentialImpulseConstraintSolver btSequentialImpulseConstraintSolverPrefered;
124#endif
125
126
[8393]127#endif //BT_SEQUENTIAL_IMPULSE_CONSTRAINT_SOLVER_H
[1963]128
Note: See TracBrowser for help on using the repository browser.