Back to index

supertuxkart  0.5+dfsg1
Public Member Functions | Public Attributes | Protected Attributes | Private Attributes
btPoint2PointConstraint Class Reference

point to point constraint between two rigidbodies each with a pivotpoint that descibes the 'ballsocket' location in local space More...

#include <btPoint2PointConstraint.h>

Inheritance diagram for btPoint2PointConstraint:
Inheritance graph
[legend]
Collaboration diagram for btPoint2PointConstraint:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 btPoint2PointConstraint (btRigidBody &rbA, btRigidBody &rbB, const btVector3 &pivotInA, const btVector3 &pivotInB)
 btPoint2PointConstraint (btRigidBody &rbA, const btVector3 &pivotInA)
 btPoint2PointConstraint ()
virtual void buildJacobian ()
virtual void solveConstraint (btScalar timeStep)
void updateRHS (btScalar timeStep)
void setPivotA (const btVector3 &pivotA)
void setPivotB (const btVector3 &pivotB)
const btVector3getPivotInA () const
const btVector3getPivotInB () const
const btRigidBodygetRigidBodyA () const
btRigidBodygetRigidBodyA ()
const btRigidBodygetRigidBodyB () const
btRigidBodygetRigidBodyB ()
int getUserConstraintType () const
void setUserConstraintType (int userConstraintType)
void setUserConstraintId (int uid)
int getUserConstraintId () const
int getUid () const
btScalar getAppliedImpulse () const
btTypedConstraintType getConstraintType () const

Public Attributes

btConstraintSetting m_setting

Protected Attributes

btRigidBodym_rbA
btRigidBodym_rbB
btScalar m_appliedImpulse

Private Attributes

btJacobianEntry m_jac [3]
btVector3 m_pivotInA
btVector3 m_pivotInB

Detailed Description

point to point constraint between two rigidbodies each with a pivotpoint that descibes the 'ballsocket' location in local space

Definition at line 37 of file btPoint2PointConstraint.h.


Constructor & Destructor Documentation

btPoint2PointConstraint::btPoint2PointConstraint ( btRigidBody rbA,
btRigidBody rbB,
const btVector3 pivotInA,
const btVector3 pivotInB 
)

Definition at line 28 of file btPoint2PointConstraint.cpp.


Member Function Documentation

btScalar btTypedConstraint::getAppliedImpulse ( ) const [inline, inherited]

Definition at line 108 of file btTypedConstraint.h.

       {
              return m_appliedImpulse;
       }

Definition at line 113 of file btTypedConstraint.h.

       {
              return m_constraintType;
       }

Here is the caller graph for this function:

Definition at line 76 of file btPoint2PointConstraint.h.

       {
              return m_pivotInA;
       }

Here is the caller graph for this function:

Definition at line 81 of file btPoint2PointConstraint.h.

       {
              return m_pivotInB;
       }

Here is the caller graph for this function:

const btRigidBody& btTypedConstraint::getRigidBodyA ( ) const [inline, inherited]

Reimplemented in btGeneric6DofConstraint, btSliderConstraint, btConeTwistConstraint, and btHingeConstraint.

Definition at line 65 of file btTypedConstraint.h.

       {
              return m_rbA;
       }

Here is the caller graph for this function:

Definition at line 74 of file btTypedConstraint.h.

       {
              return m_rbA;
       }
const btRigidBody& btTypedConstraint::getRigidBodyB ( ) const [inline, inherited]

Reimplemented in btGeneric6DofConstraint, btSliderConstraint, btConeTwistConstraint, and btHingeConstraint.

Definition at line 69 of file btTypedConstraint.h.

       {
              return m_rbB;
       }

Here is the caller graph for this function:

Definition at line 78 of file btTypedConstraint.h.

       {
              return m_rbB;
       }
int btTypedConstraint::getUid ( ) const [inline, inherited]

Definition at line 103 of file btTypedConstraint.h.

       {
              return m_userConstraintId;   
       } 
int btTypedConstraint::getUserConstraintId ( ) const [inline, inherited]

Definition at line 98 of file btTypedConstraint.h.

       {
              return m_userConstraintId;
       }
int btTypedConstraint::getUserConstraintType ( ) const [inline, inherited]

Definition at line 83 of file btTypedConstraint.h.

       {
              return m_userConstraintType ;
       }
void btPoint2PointConstraint::setPivotA ( const btVector3 pivotA) [inline]

Definition at line 66 of file btPoint2PointConstraint.h.

       {
              m_pivotInA = pivotA;
       }
void btPoint2PointConstraint::setPivotB ( const btVector3 pivotB) [inline]

Definition at line 71 of file btPoint2PointConstraint.h.

       {
              m_pivotInB = pivotB;
       }

Here is the caller graph for this function:

void btTypedConstraint::setUserConstraintId ( int  uid) [inline, inherited]

Definition at line 93 of file btTypedConstraint.h.

       {
              m_userConstraintId = uid;
       }
void btTypedConstraint::setUserConstraintType ( int  userConstraintType) [inline, inherited]

Definition at line 88 of file btTypedConstraint.h.

       {
              m_userConstraintType = userConstraintType;
       };
void btPoint2PointConstraint::solveConstraint ( btScalar  timeStep) [virtual]

Implements btTypedConstraint.

Definition at line 65 of file btPoint2PointConstraint.cpp.

{
       btVector3 pivotAInW = m_rbA.getCenterOfMassTransform()*m_pivotInA;
       btVector3 pivotBInW = m_rbB.getCenterOfMassTransform()*m_pivotInB;


       btVector3 normal(0,0,0);
       

//     btVector3 angvelA = m_rbA.getCenterOfMassTransform().getBasis().transpose() * m_rbA.getAngularVelocity();
//     btVector3 angvelB = m_rbB.getCenterOfMassTransform().getBasis().transpose() * m_rbB.getAngularVelocity();

       for (int i=0;i<3;i++)
       {             
              normal[i] = 1;
              btScalar jacDiagABInv = btScalar(1.) / m_jac[i].getDiagonal();

              btVector3 rel_pos1 = pivotAInW - m_rbA.getCenterOfMassPosition(); 
              btVector3 rel_pos2 = pivotBInW - m_rbB.getCenterOfMassPosition();
              //this jacobian entry could be re-used for all iterations
              
              btVector3 vel1 = m_rbA.getVelocityInLocalPoint(rel_pos1);
              btVector3 vel2 = m_rbB.getVelocityInLocalPoint(rel_pos2);
              btVector3 vel = vel1 - vel2;
              
              btScalar rel_vel;
              rel_vel = normal.dot(vel);

       /*
              //velocity error (first order error)
              btScalar rel_vel = m_jac[i].getRelativeVelocity(m_rbA.getLinearVelocity(),angvelA,
                                                                                                  m_rbB.getLinearVelocity(),angvelB);
       */
       
              //positional error (zeroth order error)
              btScalar depth = -(pivotAInW - pivotBInW).dot(normal); //this is the error projected on the normal
              
              btScalar impulse = depth*m_setting.m_tau/timeStep  * jacDiagABInv -  m_setting.m_damping * rel_vel * jacDiagABInv;
              m_appliedImpulse+=impulse;
              btVector3 impulse_vector = normal * impulse;
              m_rbA.applyImpulse(impulse_vector, pivotAInW - m_rbA.getCenterOfMassPosition());
              m_rbB.applyImpulse(-impulse_vector, pivotBInW - m_rbB.getCenterOfMassPosition());
              
              normal[i] = 0;
       }
}

Here is the call graph for this function:

Definition at line 112 of file btPoint2PointConstraint.cpp.

{
       (void)timeStep;

}

Member Data Documentation

Definition at line 50 of file btTypedConstraint.h.

Definition at line 42 of file btPoint2PointConstraint.h.

Definition at line 44 of file btPoint2PointConstraint.h.

Definition at line 45 of file btPoint2PointConstraint.h.

btRigidBody& btTypedConstraint::m_rbA [protected, inherited]

Definition at line 48 of file btTypedConstraint.h.

btRigidBody& btTypedConstraint::m_rbB [protected, inherited]

Definition at line 49 of file btTypedConstraint.h.

Definition at line 51 of file btPoint2PointConstraint.h.


The documentation for this class was generated from the following files: