Back to index

supertuxkart  0.5+dfsg1
btPoint2PointConstraint.h
Go to the documentation of this file.
00001 /*
00002 Bullet Continuous Collision Detection and Physics Library
00003 Copyright (c) 2003-2006 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 use of this software.
00007 Permission is granted to anyone to use this software for any purpose, 
00008 including commercial applications, and to alter it and redistribute it freely, 
00009 subject to the following restrictions:
00010 
00011 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.
00012 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
00013 3. This notice may not be removed or altered from any source distribution.
00014 */
00015 
00016 #ifndef POINT2POINTCONSTRAINT_H
00017 #define POINT2POINTCONSTRAINT_H
00018 
00019 #include "LinearMath/btVector3.h"
00020 #include "btJacobianEntry.h"
00021 #include "btTypedConstraint.h"
00022 
00023 class btRigidBody;
00024 
00025 struct btConstraintSetting
00026 {
00027        btConstraintSetting()       :
00028               m_tau(btScalar(0.3)),
00029               m_damping(btScalar(1.))
00030        {
00031        }
00032        btScalar             m_tau;
00033        btScalar             m_damping;
00034 };
00035 
00037 class btPoint2PointConstraint : public btTypedConstraint
00038 {
00039 #ifdef IN_PARALLELL_SOLVER
00040 public:
00041 #endif
00042        btJacobianEntry      m_jac[3]; //3 orthogonal linear constraints
00043        
00044        btVector3     m_pivotInA;
00045        btVector3     m_pivotInB;
00046        
00047        
00048        
00049 public:
00050 
00051        btConstraintSetting  m_setting;
00052 
00053        btPoint2PointConstraint(btRigidBody& rbA,btRigidBody& rbB, const btVector3& pivotInA,const btVector3& pivotInB);
00054 
00055        btPoint2PointConstraint(btRigidBody& rbA,const btVector3& pivotInA);
00056 
00057        btPoint2PointConstraint();
00058 
00059        virtual void  buildJacobian();
00060 
00061 
00062        virtual       void   solveConstraint(btScalar    timeStep);
00063 
00064        void   updateRHS(btScalar   timeStep);
00065 
00066        void   setPivotA(const btVector3& pivotA)
00067        {
00068               m_pivotInA = pivotA;
00069        }
00070 
00071        void   setPivotB(const btVector3& pivotB)
00072        {
00073               m_pivotInB = pivotB;
00074        }
00075 
00076        const btVector3& getPivotInA() const
00077        {
00078               return m_pivotInA;
00079        }
00080 
00081        const btVector3& getPivotInB() const
00082        {
00083               return m_pivotInB;
00084        }
00085 
00086 
00087 };
00088 
00089 #endif //POINT2POINTCONSTRAINT_H