Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/physics/src/bullet/BulletDynamics/ConstraintSolver/btPoint2PointConstraint.h @ 1963

Last change on this file since 1963 was 1963, checked in by rgrieder, 16 years ago

Added Bullet physics engine.

  • Property svn:eol-style set to native
File size: 2.3 KB
Line 
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
16#ifndef POINT2POINTCONSTRAINT_H
17#define POINT2POINTCONSTRAINT_H
18
19#include "LinearMath/btVector3.h"
20#include "btJacobianEntry.h"
21#include "btTypedConstraint.h"
22
23class btRigidBody;
24
25struct  btConstraintSetting
26{
27        btConstraintSetting()   :
28                m_tau(btScalar(0.3)),
29                m_damping(btScalar(1.)),
30                m_impulseClamp(btScalar(0.))
31        {
32        }
33        btScalar                m_tau;
34        btScalar                m_damping;
35        btScalar                m_impulseClamp;
36};
37
38/// point to point constraint between two rigidbodies each with a pivotpoint that descibes the 'ballsocket' location in local space
39class btPoint2PointConstraint : public btTypedConstraint
40{
41#ifdef IN_PARALLELL_SOLVER
42public:
43#endif
44        btJacobianEntry m_jac[3]; //3 orthogonal linear constraints
45       
46        btVector3       m_pivotInA;
47        btVector3       m_pivotInB;
48       
49       
50       
51public:
52
53        btConstraintSetting     m_setting;
54
55        btPoint2PointConstraint(btRigidBody& rbA,btRigidBody& rbB, const btVector3& pivotInA,const btVector3& pivotInB);
56
57        btPoint2PointConstraint(btRigidBody& rbA,const btVector3& pivotInA);
58
59        btPoint2PointConstraint();
60
61        virtual void    buildJacobian();
62
63
64        virtual void    solveConstraint(btScalar        timeStep);
65
66        void    updateRHS(btScalar      timeStep);
67
68        void    setPivotA(const btVector3& pivotA)
69        {
70                m_pivotInA = pivotA;
71        }
72
73        void    setPivotB(const btVector3& pivotB)
74        {
75                m_pivotInB = pivotB;
76        }
77
78        const btVector3& getPivotInA() const
79        {
80                return m_pivotInA;
81        }
82
83        const btVector3& getPivotInB() const
84        {
85                return m_pivotInB;
86        }
87
88
89};
90
91#endif //POINT2POINTCONSTRAINT_H
Note: See TracBrowser for help on using the repository browser.