Blender V2.61 - r43446
|
btConeTwistConstraint can be used to simulate ragdoll joints (upper arm, leg etc) More...
#include <btConeTwistConstraint.h>
Public Member Functions | |
btConeTwistConstraint (btRigidBody &rbA, btRigidBody &rbB, const btTransform &rbAFrame, const btTransform &rbBFrame) | |
btConeTwistConstraint (btRigidBody &rbA, const btTransform &rbAFrame) | |
virtual void | buildJacobian () |
internal method used by the constraint solver, don't use them directly | |
virtual void | getInfo1 (btConstraintInfo1 *info) |
internal method used by the constraint solver, don't use them directly | |
void | getInfo1NonVirtual (btConstraintInfo1 *info) |
virtual void | getInfo2 (btConstraintInfo2 *info) |
internal method used by the constraint solver, don't use them directly | |
void | getInfo2NonVirtual (btConstraintInfo2 *info, const btTransform &transA, const btTransform &transB, const btMatrix3x3 &invInertiaWorldA, const btMatrix3x3 &invInertiaWorldB) |
virtual void | solveConstraintObsolete (btRigidBody &bodyA, btRigidBody &bodyB, btScalar timeStep) |
internal method used by the constraint solver, don't use them directly | |
void | updateRHS (btScalar timeStep) |
const btRigidBody & | getRigidBodyA () const |
const btRigidBody & | getRigidBodyB () const |
void | setAngularOnly (bool angularOnly) |
void | setLimit (int limitIndex, btScalar limitValue) |
void | setLimit (btScalar _swingSpan1, btScalar _swingSpan2, btScalar _twistSpan, btScalar _softness=1.f, btScalar _biasFactor=0.3f, btScalar _relaxationFactor=1.0f) |
const btTransform & | getAFrame () |
const btTransform & | getBFrame () |
int | getSolveTwistLimit () |
int | getSolveSwingLimit () |
btScalar | getTwistLimitSign () |
void | calcAngleInfo () |
void | calcAngleInfo2 (const btTransform &transA, const btTransform &transB, const btMatrix3x3 &invInertiaWorldA, const btMatrix3x3 &invInertiaWorldB) |
btScalar | getSwingSpan1 () |
btScalar | getSwingSpan2 () |
btScalar | getTwistSpan () |
btScalar | getTwistAngle () |
bool | isPastSwingLimit () |
void | setDamping (btScalar damping) |
void | enableMotor (bool b) |
void | setMaxMotorImpulse (btScalar maxMotorImpulse) |
void | setMaxMotorImpulseNormalized (btScalar maxMotorImpulse) |
btScalar | getFixThresh () |
void | setFixThresh (btScalar fixThresh) |
void | setMotorTarget (const btQuaternion &q) |
void | setMotorTargetInConstraintSpace (const btQuaternion &q) |
btVector3 | GetPointForAngle (btScalar fAngleInRadians, btScalar fLength) const |
virtual void | setParam (int num, btScalar value, int axis=-1) |
virtual void | setFrames (const btTransform &frameA, const btTransform &frameB) |
const btTransform & | getFrameOffsetA () const |
const btTransform & | getFrameOffsetB () const |
virtual btScalar | getParam (int num, int axis=-1) const |
return the local value of parameter | |
virtual int | calculateSerializeBufferSize () const |
virtual const char * | serialize (void *dataBuffer, btSerializer *serializer) const |
fills the dataBuffer and returns the struct name (and 0 on failure) | |
Protected Member Functions | |
void | init () |
void | computeConeLimitInfo (const btQuaternion &qCone, btScalar &swingAngle, btVector3 &vSwingAxis, btScalar &swingLimit) |
void | computeTwistLimitInfo (const btQuaternion &qTwist, btScalar &twistAngle, btVector3 &vTwistAxis) |
void | adjustSwingAxisToUseEllipseNormal (btVector3 &vSwingAxis) const |
btConeTwistConstraint can be used to simulate ragdoll joints (upper arm, leg etc)
Definition at line 53 of file btConeTwistConstraint.h.
btConeTwistConstraint::btConeTwistConstraint | ( | btRigidBody & | rbA, |
btRigidBody & | rbB, | ||
const btTransform & | rbAFrame, | ||
const btTransform & | rbBFrame | ||
) |
Definition at line 41 of file btConeTwistConstraint.cpp.
References init().
btConeTwistConstraint::btConeTwistConstraint | ( | btRigidBody & | rbA, |
const btTransform & | rbAFrame | ||
) |
Definition at line 50 of file btConeTwistConstraint.cpp.
References init().
void btConeTwistConstraint::adjustSwingAxisToUseEllipseNormal | ( | btVector3 & | vSwingAxis | ) | const [protected] |
Definition at line 936 of file btConeTwistConstraint.cpp.
References fabs(), grad(), and SIMD_EPSILON.
Referenced by calcAngleInfo2().
void btConeTwistConstraint::buildJacobian | ( | ) | [virtual] |
internal method used by the constraint solver, don't use them directly
Reimplemented from btTypedConstraint.
Definition at line 259 of file btConeTwistConstraint.cpp.
References btPlaneSpace1(), calcAngleInfo2(), btTransform::getBasis(), btRigidBody::getCenterOfMassPosition(), btRigidBody::getCenterOfMassTransform(), btRigidBody::getInvInertiaDiagLocal(), btRigidBody::getInvInertiaTensorWorld(), btRigidBody::getInvMass(), btTransform::getOrigin(), i, btTypedConstraint::m_appliedImpulse, btTypedConstraint::m_rbA, btTypedConstraint::m_rbB, SIMD_EPSILON, and btMatrix3x3::transpose().
Referenced by setFrames().
void btConeTwistConstraint::calcAngleInfo | ( | ) |
Definition at line 532 of file btConeTwistConstraint.cpp.
References btAtan2Fast(), btFabs(), btTransform::getBasis(), btRigidBody::getCenterOfMassTransform(), btMatrix3x3::getColumn(), getRigidBodyA(), getRigidBodyB(), quatRotate(), shortestArcQuat(), and thresh.
void btConeTwistConstraint::calcAngleInfo2 | ( | const btTransform & | transA, |
const btTransform & | transB, | ||
const btMatrix3x3 & | invInertiaWorldA, | ||
const btMatrix3x3 & | invInertiaWorldB | ||
) |
Definition at line 623 of file btConeTwistConstraint.cpp.
References adjustSwingAxisToUseEllipseNormal(), btAtan2(), btCos(), btFuzzyZero(), btSin(), computeAngularImpulseDenominator(), computeConeLimitInfo(), computeTwistLimitInfo(), btQuaternion::getAngle(), btTransform::getBasis(), btMatrix3x3::getColumn(), btTransform::getRotation(), btQuaternion::inverse(), btTransform::inverse(), btQuaternion::normalize(), quatRotate(), shortestArcQuat(), SIMD_EPSILON, and vTwist().
Referenced by buildJacobian(), getInfo1(), and getInfo2NonVirtual().
SIMD_FORCE_INLINE int btConeTwistConstraint::calculateSerializeBufferSize | ( | ) | const [virtual] |
Reimplemented from btTypedConstraint.
Definition at line 318 of file btConeTwistConstraint.h.
void btConeTwistConstraint::computeConeLimitInfo | ( | const btQuaternion & | qCone, |
btScalar & | swingAngle, | ||
btVector3 & | vSwingAxis, | ||
btScalar & | swingLimit | ||
) | [protected] |
Definition at line 816 of file btConeTwistConstraint.cpp.
References fabs(), btQuaternion::getAngle(), norm(), SIMD_EPSILON, and sqrt().
Referenced by calcAngleInfo2(), and setMotorTargetInConstraintSpace().
void btConeTwistConstraint::computeTwistLimitInfo | ( | const btQuaternion & | qTwist, |
btScalar & | twistAngle, | ||
btVector3 & | vTwistAxis | ||
) | [protected] |
Definition at line 912 of file btConeTwistConstraint.cpp.
References btQuaternion::getAngle(), operator-(), SIMD_EPSILON, and SIMD_PI.
Referenced by calcAngleInfo2(), and setMotorTargetInConstraintSpace().
void btConeTwistConstraint::enableMotor | ( | bool | b | ) | [inline] |
Definition at line 250 of file btConeTwistConstraint.h.
const btTransform& btConeTwistConstraint::getAFrame | ( | ) | [inline] |
Definition at line 209 of file btConeTwistConstraint.h.
Referenced by btDiscreteDynamicsWorld::debugDrawConstraint().
const btTransform& btConeTwistConstraint::getBFrame | ( | ) | [inline] |
Definition at line 210 of file btConeTwistConstraint.h.
Referenced by btDiscreteDynamicsWorld::debugDrawConstraint().
btScalar btConeTwistConstraint::getFixThresh | ( | ) | [inline] |
Definition at line 254 of file btConeTwistConstraint.h.
const btTransform& btConeTwistConstraint::getFrameOffsetA | ( | ) | const [inline] |
Definition at line 274 of file btConeTwistConstraint.h.
const btTransform& btConeTwistConstraint::getFrameOffsetB | ( | ) | const [inline] |
Definition at line 279 of file btConeTwistConstraint.h.
void btConeTwistConstraint::getInfo1 | ( | btConstraintInfo1 * | info | ) | [virtual] |
internal method used by the constraint solver, don't use them directly
Implements btTypedConstraint.
Definition at line 78 of file btConeTwistConstraint.cpp.
References calcAngleInfo2(), btRigidBody::getCenterOfMassTransform(), btRigidBody::getInvInertiaTensorWorld(), btTypedConstraint::btConstraintInfo1::m_numConstraintRows, btTypedConstraint::m_rbA, btTypedConstraint::m_rbB, and btTypedConstraint::btConstraintInfo1::nub.
void btConeTwistConstraint::getInfo1NonVirtual | ( | btConstraintInfo1 * | info | ) |
Definition at line 108 of file btConeTwistConstraint.cpp.
References btTypedConstraint::btConstraintInfo1::m_numConstraintRows, and btTypedConstraint::btConstraintInfo1::nub.
void btConeTwistConstraint::getInfo2 | ( | btConstraintInfo2 * | info | ) | [virtual] |
internal method used by the constraint solver, don't use them directly
Implements btTypedConstraint.
Definition at line 117 of file btConeTwistConstraint.cpp.
References btRigidBody::getCenterOfMassTransform(), getInfo2NonVirtual(), btRigidBody::getInvInertiaTensorWorld(), btTypedConstraint::m_rbA, and btTypedConstraint::m_rbB.
void btConeTwistConstraint::getInfo2NonVirtual | ( | btConstraintInfo2 * | info, |
const btTransform & | transA, | ||
const btTransform & | transB, | ||
const btMatrix3x3 & | invInertiaWorldA, | ||
const btMatrix3x3 & | invInertiaWorldB | ||
) |
Definition at line 122 of file btConeTwistConstraint.cpp.
References BT_CONETWIST_FLAGS_ANG_CFM, BT_CONETWIST_FLAGS_LIN_CFM, BT_CONETWIST_FLAGS_LIN_ERP, btAssert, calcAngleInfo2(), btTypedConstraint::btConstraintInfo2::cfm, btTypedConstraint::btConstraintInfo2::erp, btTypedConstraint::btConstraintInfo2::fps, btTransform::getBasis(), btMatrix3x3::getColumn(), btTransform::getOrigin(), btTypedConstraint::btConstraintInfo2::m_constraintError, btTypedConstraint::btConstraintInfo2::m_J1angularAxis, btTypedConstraint::btConstraintInfo2::m_J1linearAxis, btTypedConstraint::btConstraintInfo2::m_J2angularAxis, btTypedConstraint::btConstraintInfo2::m_lowerLimit, btTypedConstraint::btConstraintInfo2::m_upperLimit, p, btTypedConstraint::btConstraintInfo2::rowskip, and SIMD_INFINITY.
Referenced by getInfo2().
btScalar btConeTwistConstraint::getParam | ( | int | num, |
int | axis = -1 |
||
) | const [virtual] |
return the local value of parameter
Implements btTypedConstraint.
Definition at line 1072 of file btConeTwistConstraint.cpp.
References BT_CONETWIST_FLAGS_ANG_CFM, BT_CONETWIST_FLAGS_LIN_CFM, BT_CONETWIST_FLAGS_LIN_ERP, BT_CONSTRAINT_CFM, BT_CONSTRAINT_ERP, BT_CONSTRAINT_STOP_CFM, BT_CONSTRAINT_STOP_ERP, and btAssertConstrParams.
btVector3 btConeTwistConstraint::GetPointForAngle | ( | btScalar | fAngleInRadians, |
btScalar | fLength | ||
) | const |
Definition at line 879 of file btConeTwistConstraint.cpp.
References btCos(), btSin(), fabs(), norm(), quatRotate(), SIMD_EPSILON, and sqrt().
Referenced by btDiscreteDynamicsWorld::debugDrawConstraint().
const btRigidBody& btConeTwistConstraint::getRigidBodyA | ( | ) | const [inline] |
Reimplemented from btTypedConstraint.
Definition at line 148 of file btConeTwistConstraint.h.
References btTypedConstraint::m_rbA.
Referenced by calcAngleInfo(), btDiscreteDynamicsWorld::debugDrawConstraint(), and solveConstraintObsolete().
const btRigidBody& btConeTwistConstraint::getRigidBodyB | ( | ) | const [inline] |
Reimplemented from btTypedConstraint.
Definition at line 152 of file btConeTwistConstraint.h.
References btTypedConstraint::m_rbB.
Referenced by calcAngleInfo(), btDiscreteDynamicsWorld::debugDrawConstraint(), and solveConstraintObsolete().
int btConeTwistConstraint::getSolveSwingLimit | ( | ) | [inline] |
Definition at line 217 of file btConeTwistConstraint.h.
int btConeTwistConstraint::getSolveTwistLimit | ( | ) | [inline] |
Definition at line 212 of file btConeTwistConstraint.h.
btScalar btConeTwistConstraint::getSwingSpan1 | ( | ) | [inline] |
Definition at line 230 of file btConeTwistConstraint.h.
btScalar btConeTwistConstraint::getSwingSpan2 | ( | ) | [inline] |
Definition at line 234 of file btConeTwistConstraint.h.
btScalar btConeTwistConstraint::getTwistAngle | ( | ) | [inline] |
Definition at line 242 of file btConeTwistConstraint.h.
Referenced by btDiscreteDynamicsWorld::debugDrawConstraint().
btScalar btConeTwistConstraint::getTwistLimitSign | ( | ) | [inline] |
Definition at line 222 of file btConeTwistConstraint.h.
btScalar btConeTwistConstraint::getTwistSpan | ( | ) | [inline] |
Definition at line 238 of file btConeTwistConstraint.h.
Referenced by btDiscreteDynamicsWorld::debugDrawConstraint().
void btConeTwistConstraint::init | ( | ) | [protected] |
Definition at line 60 of file btConeTwistConstraint.cpp.
References BT_LARGE_FLOAT, CONETWIST_DEF_FIX_THRESH, and setLimit().
Referenced by btConeTwistConstraint().
bool btConeTwistConstraint::isPastSwingLimit | ( | ) | [inline] |
Definition at line 246 of file btConeTwistConstraint.h.
SIMD_FORCE_INLINE const char * btConeTwistConstraint::serialize | ( | void * | dataBuffer, |
btSerializer * | serializer | ||
) | const [virtual] |
fills the dataBuffer and returns the struct name (and 0 on failure)
Reimplemented from btTypedConstraint.
Definition at line 326 of file btConeTwistConstraint.h.
References btConeTwistConstraintData::m_biasFactor, btConeTwistConstraintData::m_damping, btConeTwistConstraintData::m_limitSoftness, btConeTwistConstraintData::m_rbAFrame, btConeTwistConstraintData::m_rbBFrame, btConeTwistConstraintData::m_relaxationFactor, btConeTwistConstraintData::m_swingSpan1, btConeTwistConstraintData::m_swingSpan2, btConeTwistConstraintData::m_twistSpan, btConeTwistConstraintData::m_typeConstraintData, and btTransform::serializeFloat().
void btConeTwistConstraint::setAngularOnly | ( | bool | angularOnly | ) | [inline] |
Definition at line 157 of file btConeTwistConstraint.h.
void btConeTwistConstraint::setDamping | ( | btScalar | damping | ) | [inline] |
Definition at line 248 of file btConeTwistConstraint.h.
void btConeTwistConstraint::setFixThresh | ( | btScalar | fixThresh | ) | [inline] |
Definition at line 255 of file btConeTwistConstraint.h.
void btConeTwistConstraint::setFrames | ( | const btTransform & | frameA, |
const btTransform & | frameB | ||
) | [virtual] |
Definition at line 1117 of file btConeTwistConstraint.cpp.
References buildJacobian().
void btConeTwistConstraint::setLimit | ( | btScalar | _swingSpan1, |
btScalar | _swingSpan2, | ||
btScalar | _twistSpan, | ||
btScalar | _softness = 1.f , |
||
btScalar | _biasFactor = 0.3f , |
||
btScalar | _relaxationFactor = 1.0f |
||
) | [inline] |
Definition at line 198 of file btConeTwistConstraint.h.
void btConeTwistConstraint::setLimit | ( | int | limitIndex, |
btScalar | limitValue | ||
) | [inline] |
Definition at line 162 of file btConeTwistConstraint.h.
Referenced by init(), and CcdPhysicsEnvironment::setConstraintParam().
void btConeTwistConstraint::setMaxMotorImpulse | ( | btScalar | maxMotorImpulse | ) | [inline] |
Definition at line 251 of file btConeTwistConstraint.h.
void btConeTwistConstraint::setMaxMotorImpulseNormalized | ( | btScalar | maxMotorImpulse | ) | [inline] |
Definition at line 252 of file btConeTwistConstraint.h.
void btConeTwistConstraint::setMotorTarget | ( | const btQuaternion & | q | ) |
Definition at line 970 of file btConeTwistConstraint.cpp.
References btRigidBody::getCenterOfMassTransform(), btTransform::getRotation(), btQuaternion::inverse(), btTransform::inverse(), inverse(), btTypedConstraint::m_rbA, btTypedConstraint::m_rbB, and setMotorTargetInConstraintSpace().
void btConeTwistConstraint::setMotorTargetInConstraintSpace | ( | const btQuaternion & | q | ) |
Definition at line 984 of file btConeTwistConstraint.cpp.
References computeConeLimitInfo(), computeTwistLimitInfo(), fabs(), btQuaternion::inverse(), btQuaternion::normalize(), quatRotate(), shortestArcQuat(), SIMD_EPSILON, and vTwist().
Referenced by setMotorTarget().
void btConeTwistConstraint::setParam | ( | int | num, |
btScalar | value, | ||
int | axis = -1 |
||
) | [virtual] |
override the default global value of a parameter (such as ERP or CFM), optionally provide the axis (0..5). If no axis is provided, it uses the default axis for this constraint.
Implements btTypedConstraint.
Definition at line 1036 of file btConeTwistConstraint.cpp.
References BT_CONETWIST_FLAGS_ANG_CFM, BT_CONETWIST_FLAGS_LIN_CFM, BT_CONETWIST_FLAGS_LIN_ERP, BT_CONSTRAINT_CFM, BT_CONSTRAINT_ERP, BT_CONSTRAINT_STOP_CFM, BT_CONSTRAINT_STOP_ERP, and btAssertConstrParams.
void btConeTwistConstraint::solveConstraintObsolete | ( | btRigidBody & | , |
btRigidBody & | , | ||
btScalar | |||
) | [virtual] |
internal method used by the constraint solver, don't use them directly
solve angular part
Reimplemented from btTypedConstraint.
Definition at line 307 of file btConeTwistConstraint.cpp.
References btAssert, btMax(), btTransformUtil::calculateVelocity(), btRigidBody::computeAngularImpulseDenominator(), dot(), btRigidBody::getCenterOfMassPosition(), btRigidBody::getCenterOfMassTransform(), btRigidBody::getInvInertiaTensorWorld(), btRigidBody::getInvMass(), btTransform::getOrigin(), getRigidBodyA(), getRigidBodyB(), i, btTransformUtil::integrateTransform(), btRigidBody::internalApplyImpulse(), btRigidBody::internalGetAngularVelocity(), btRigidBody::internalGetVelocityInLocalPointObsolete(), btTransform::inverse(), btTypedConstraint::m_appliedImpulse, btTypedConstraint::m_rbA, btTypedConstraint::m_rbB, btTransform::setIdentity(), and SIMD_EPSILON.
void btConeTwistConstraint::updateRHS | ( | btScalar | timeStep | ) |
Definition at line 524 of file btConeTwistConstraint.cpp.