Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/physics/src/bullet/BulletDynamics/ConstraintSolver/btTypedConstraint.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.7 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 TYPED_CONSTRAINT_H
17#define TYPED_CONSTRAINT_H
18
19class btRigidBody;
20#include "LinearMath/btScalar.h"
21
22enum btTypedConstraintType
23{
24        POINT2POINT_CONSTRAINT_TYPE,
25        HINGE_CONSTRAINT_TYPE,
26        CONETWIST_CONSTRAINT_TYPE,
27        D6_CONSTRAINT_TYPE,
28        VEHICLE_CONSTRAINT_TYPE,
29        SLIDER_CONSTRAINT_TYPE
30};
31
32///TypedConstraint is the baseclass for Bullet constraints and vehicles
33class btTypedConstraint
34{
35        int     m_userConstraintType;
36        int     m_userConstraintId;
37
38        btTypedConstraintType m_constraintType;
39
40        btTypedConstraint&      operator=(btTypedConstraint&    other)
41        {
42                btAssert(0);
43                (void) other;
44                return *this;
45        }
46
47protected:
48        btRigidBody&    m_rbA;
49        btRigidBody&    m_rbB;
50        btScalar        m_appliedImpulse;
51
52
53public:
54
55        btTypedConstraint(btTypedConstraintType type);
56        virtual ~btTypedConstraint() {};
57        btTypedConstraint(btTypedConstraintType type, btRigidBody& rbA);
58
59        btTypedConstraint(btTypedConstraintType type, btRigidBody& rbA,btRigidBody& rbB);
60
61        virtual void    buildJacobian() = 0;
62
63        virtual void    solveConstraint(btScalar        timeStep) = 0;
64
65        const btRigidBody& getRigidBodyA() const
66        {
67                return m_rbA;
68        }
69        const btRigidBody& getRigidBodyB() const
70        {
71                return m_rbB;
72        }
73
74        btRigidBody& getRigidBodyA() 
75        {
76                return m_rbA;
77        }
78        btRigidBody& getRigidBodyB()
79        {
80                return m_rbB;
81        }
82
83        int getUserConstraintType() const
84        {
85                return m_userConstraintType ;
86        }
87
88        void    setUserConstraintType(int userConstraintType)
89        {
90                m_userConstraintType = userConstraintType;
91        };
92
93        void    setUserConstraintId(int uid)
94        {
95                m_userConstraintId = uid;
96        }
97       
98        int getUserConstraintId() const
99        {
100                return m_userConstraintId;
101        }
102
103        int getUid() const
104        {
105                return m_userConstraintId;   
106        } 
107
108        btScalar        getAppliedImpulse() const
109        {
110                return m_appliedImpulse;
111        }
112
113        btTypedConstraintType getConstraintType () const
114        {
115                return m_constraintType;
116        }
117
118};
119
120#endif //TYPED_CONSTRAINT_H
Note: See TracBrowser for help on using the repository browser.