Back to index

supertuxkart  0.5+dfsg1
btOdeTypedJoint.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 2007-09-09
00017 Added support for typed joints by Francisco León
00018 email: projectileman@yahoo.com
00019 http://gimpact.sf.net
00020 */
00021 
00022 #ifndef TYPED_JOINT_H
00023 #define TYPED_JOINT_H
00024 
00025 #include "btOdeJoint.h"
00026 #include "BulletDynamics/ConstraintSolver/btPoint2PointConstraint.h"
00027 #include "BulletDynamics/ConstraintSolver/btGeneric6DofConstraint.h"
00028 
00029 struct btOdeSolverBody;
00030 
00031 class btOdeTypedJoint : public btOdeJoint
00032 {
00033 public:
00034        btTypedConstraint * m_constraint;
00035        int           m_index;
00036        bool   m_swapBodies;
00037        btOdeSolverBody* m_body0;
00038        btOdeSolverBody* m_body1;
00039 
00040        btOdeTypedJoint(){}
00041        btOdeTypedJoint(
00042               btTypedConstraint * constraint,
00043               int index,bool swap,btOdeSolverBody* body0,btOdeSolverBody* body1):
00044                      m_constraint(constraint),
00045                      m_index(index),
00046                      m_swapBodies(swap),
00047                      m_body0(body0),
00048                      m_body1(body1)
00049        {
00050        }
00051 
00052        virtual void GetInfo1(Info1 *info);
00053        virtual void GetInfo2(Info2 *info);
00054 };
00055 
00056 
00057 
00058 class OdeP2PJoint : public btOdeTypedJoint
00059 {
00060 protected:
00061        inline btPoint2PointConstraint * getP2PConstraint()
00062        {
00063               return static_cast<btPoint2PointConstraint * >(m_constraint);
00064        }
00065 public:
00066 
00067        OdeP2PJoint() {};
00068 
00069        OdeP2PJoint(btTypedConstraint* constraint,int index,bool swap,btOdeSolverBody* body0,btOdeSolverBody* body1);
00070 
00071        //btOdeJoint interface for solver
00072 
00073        virtual void GetInfo1(Info1 *info);
00074 
00075        virtual void GetInfo2(Info2 *info);
00076 };
00077 
00078 
00079 class OdeD6Joint : public btOdeTypedJoint
00080 {
00081 protected:
00082        inline btGeneric6DofConstraint * getD6Constraint()
00083        {
00084               return static_cast<btGeneric6DofConstraint * >(m_constraint);
00085        }
00086 
00087        int setLinearLimits(Info2 *info);
00088        int setAngularLimits(Info2 *info, int row_offset);
00089 
00090 public:
00091 
00092        OdeD6Joint() {};
00093 
00094        OdeD6Joint(btTypedConstraint* constraint,int index,bool swap,btOdeSolverBody* body0,btOdeSolverBody* body1);
00095 
00096        //btOdeJoint interface for solver
00097 
00098        virtual void GetInfo1(Info1 *info);
00099 
00100        virtual void GetInfo2(Info2 *info);
00101 };
00102 
00104 
00105 int bt_get_limit_motor_info2(
00106        btRotationalLimitMotor * limot,
00107        btRigidBody * body0, btRigidBody * body1,
00108        btOdeJoint::Info2 *info, int row, btVector3& ax1, int rotational);
00109 
00110 #endif //CONTACT_JOINT_H
00111