Differential D1739 Diff 5899 extern/bullet2/src/BulletDynamics/ConstraintSolver/btGeneric6DofConstraint.h
Changeset View
Changeset View
Standalone View
Standalone View
extern/bullet2/src/BulletDynamics/ConstraintSolver/btGeneric6DofConstraint.h
| Show First 20 Lines • Show All 105 Lines • ▼ Show 20 Lines | m_stopCFM = limot.m_stopCFM; | ||||
| m_currentLimit = limot.m_currentLimit; | m_currentLimit = limot.m_currentLimit; | ||||
| m_currentLimitError = limot.m_currentLimitError; | m_currentLimitError = limot.m_currentLimitError; | ||||
| m_enableMotor = limot.m_enableMotor; | m_enableMotor = limot.m_enableMotor; | ||||
| } | } | ||||
| //! Is limited | //! Is limited | ||||
| bool isLimited() | bool isLimited() const | ||||
| { | { | ||||
| if(m_loLimit > m_hiLimit) return false; | if(m_loLimit > m_hiLimit) return false; | ||||
| return true; | return true; | ||||
| } | } | ||||
| //! Need apply correction | //! Need apply correction | ||||
| bool needApplyTorques() | bool needApplyTorques() const | ||||
| { | { | ||||
| if(m_currentLimit == 0 && m_enableMotor == false) return false; | if(m_currentLimit == 0 && m_enableMotor == false) return false; | ||||
| return true; | return true; | ||||
| } | } | ||||
| //! calculates error | //! calculates error | ||||
| /*! | /*! | ||||
| calculates m_currentLimit and m_currentLimitError. | calculates m_currentLimit and m_currentLimitError. | ||||
| ▲ Show 20 Lines • Show All 72 Lines • ▼ Show 20 Lines | bool m_enableMotor[3]; | ||||
| //! Test limit | //! Test limit | ||||
| /*! | /*! | ||||
| - free means upper < lower, | - free means upper < lower, | ||||
| - locked means upper == lower | - locked means upper == lower | ||||
| - limited means upper > lower | - limited means upper > lower | ||||
| - limitIndex: first 3 are linear, next 3 are angular | - limitIndex: first 3 are linear, next 3 are angular | ||||
| */ | */ | ||||
| inline bool isLimited(int limitIndex) | inline bool isLimited(int limitIndex) const | ||||
| { | { | ||||
| return (m_upperLimit[limitIndex] >= m_lowerLimit[limitIndex]); | return (m_upperLimit[limitIndex] >= m_lowerLimit[limitIndex]); | ||||
| } | } | ||||
| inline bool needApplyForce(int limitIndex) | inline bool needApplyForce(int limitIndex) const | ||||
| { | { | ||||
| if(m_currentLimit[limitIndex] == 0 && m_enableMotor[limitIndex] == false) return false; | if(m_currentLimit[limitIndex] == 0 && m_enableMotor[limitIndex] == false) return false; | ||||
| return true; | return true; | ||||
| } | } | ||||
| int testLimitValue(int limitIndex, btScalar test_value); | int testLimitValue(int limitIndex, btScalar test_value); | ||||
| btScalar solveLinearAxis( | btScalar solveLinearAxis( | ||||
| ▲ Show 20 Lines • Show All 229 Lines • ▼ Show 20 Lines | public: | ||||
| */ | */ | ||||
| bool testAngularLimitMotor(int axis_index); | bool testAngularLimitMotor(int axis_index); | ||||
| void setLinearLowerLimit(const btVector3& linearLower) | void setLinearLowerLimit(const btVector3& linearLower) | ||||
| { | { | ||||
| m_linearLimits.m_lowerLimit = linearLower; | m_linearLimits.m_lowerLimit = linearLower; | ||||
| } | } | ||||
| void getLinearLowerLimit(btVector3& linearLower) | void getLinearLowerLimit(btVector3& linearLower) const | ||||
| { | { | ||||
| linearLower = m_linearLimits.m_lowerLimit; | linearLower = m_linearLimits.m_lowerLimit; | ||||
| } | } | ||||
| void setLinearUpperLimit(const btVector3& linearUpper) | void setLinearUpperLimit(const btVector3& linearUpper) | ||||
| { | { | ||||
| m_linearLimits.m_upperLimit = linearUpper; | m_linearLimits.m_upperLimit = linearUpper; | ||||
| } | } | ||||
| void getLinearUpperLimit(btVector3& linearUpper) | void getLinearUpperLimit(btVector3& linearUpper) const | ||||
| { | { | ||||
| linearUpper = m_linearLimits.m_upperLimit; | linearUpper = m_linearLimits.m_upperLimit; | ||||
| } | } | ||||
| void setAngularLowerLimit(const btVector3& angularLower) | void setAngularLowerLimit(const btVector3& angularLower) | ||||
| { | { | ||||
| for(int i = 0; i < 3; i++) | for(int i = 0; i < 3; i++) | ||||
| m_angularLimits[i].m_loLimit = btNormalizeAngle(angularLower[i]); | m_angularLimits[i].m_loLimit = btNormalizeAngle(angularLower[i]); | ||||
| } | } | ||||
| void getAngularLowerLimit(btVector3& angularLower) | void getAngularLowerLimit(btVector3& angularLower) const | ||||
| { | { | ||||
| for(int i = 0; i < 3; i++) | for(int i = 0; i < 3; i++) | ||||
| angularLower[i] = m_angularLimits[i].m_loLimit; | angularLower[i] = m_angularLimits[i].m_loLimit; | ||||
| } | } | ||||
| void setAngularUpperLimit(const btVector3& angularUpper) | void setAngularUpperLimit(const btVector3& angularUpper) | ||||
| { | { | ||||
| for(int i = 0; i < 3; i++) | for(int i = 0; i < 3; i++) | ||||
| m_angularLimits[i].m_hiLimit = btNormalizeAngle(angularUpper[i]); | m_angularLimits[i].m_hiLimit = btNormalizeAngle(angularUpper[i]); | ||||
| } | } | ||||
| void getAngularUpperLimit(btVector3& angularUpper) | void getAngularUpperLimit(btVector3& angularUpper) const | ||||
| { | { | ||||
| for(int i = 0; i < 3; i++) | for(int i = 0; i < 3; i++) | ||||
| angularUpper[i] = m_angularLimits[i].m_hiLimit; | angularUpper[i] = m_angularLimits[i].m_hiLimit; | ||||
| } | } | ||||
| //! Retrieves the angular limit informacion | //! Retrieves the angular limit informacion | ||||
| btRotationalLimitMotor * getRotationalLimitMotor(int index) | btRotationalLimitMotor * getRotationalLimitMotor(int index) | ||||
| { | { | ||||
| Show All 25 Lines | public: | ||||
| //! Test limit | //! Test limit | ||||
| /*! | /*! | ||||
| - free means upper < lower, | - free means upper < lower, | ||||
| - locked means upper == lower | - locked means upper == lower | ||||
| - limited means upper > lower | - limited means upper > lower | ||||
| - limitIndex: first 3 are linear, next 3 are angular | - limitIndex: first 3 are linear, next 3 are angular | ||||
| */ | */ | ||||
| bool isLimited(int limitIndex) | bool isLimited(int limitIndex) const | ||||
| { | { | ||||
| if(limitIndex<3) | if(limitIndex<3) | ||||
| { | { | ||||
| return m_linearLimits.isLimited(limitIndex); | return m_linearLimits.isLimited(limitIndex); | ||||
| } | } | ||||
| return m_angularLimits[limitIndex-3].isLimited(); | return m_angularLimits[limitIndex-3].isLimited(); | ||||
| } | } | ||||
| virtual void calcAnchorPos(void); // overridable | virtual void calcAnchorPos(void); // overridable | ||||
| int get_limit_motor_info2( btRotationalLimitMotor * limot, | int get_limit_motor_info2( btRotationalLimitMotor * limot, | ||||
| const btTransform& transA,const btTransform& transB,const btVector3& linVelA,const btVector3& linVelB,const btVector3& angVelA,const btVector3& angVelB, | const btTransform& transA,const btTransform& transB,const btVector3& linVelA,const btVector3& linVelB,const btVector3& angVelA,const btVector3& angVelB, | ||||
| btConstraintInfo2 *info, int row, btVector3& ax1, int rotational, int rotAllowed = false); | btConstraintInfo2 *info, int row, btVector3& ax1, int rotational, int rotAllowed = false); | ||||
| // access for UseFrameOffset | // access for UseFrameOffset | ||||
| bool getUseFrameOffset() { return m_useOffsetForConstraintFrame; } | bool getUseFrameOffset() const { return m_useOffsetForConstraintFrame; } | ||||
| void setUseFrameOffset(bool frameOffsetOnOff) { m_useOffsetForConstraintFrame = frameOffsetOnOff; } | void setUseFrameOffset(bool frameOffsetOnOff) { m_useOffsetForConstraintFrame = frameOffsetOnOff; } | ||||
| bool getUseLinearReferenceFrameA() const { return m_useLinearReferenceFrameA; } | |||||
| void setUseLinearReferenceFrameA(bool linearReferenceFrameA) { m_useLinearReferenceFrameA = linearReferenceFrameA; } | |||||
| ///override the default global value of a parameter (such as ERP or CFM), optionally provide the axis (0..5). | ///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. | ///If no axis is provided, it uses the default axis for this constraint. | ||||
| virtual void setParam(int num, btScalar value, int axis = -1); | virtual void setParam(int num, btScalar value, int axis = -1); | ||||
| ///return the local value of parameter | ///return the local value of parameter | ||||
| virtual btScalar getParam(int num, int axis = -1) const; | virtual btScalar getParam(int num, int axis = -1) const; | ||||
| void setAxis( const btVector3& axis1, const btVector3& axis2); | void setAxis( const btVector3& axis1, const btVector3& axis2); | ||||
| virtual int getFlags() const | |||||
| { | |||||
| return m_flags; | |||||
| } | |||||
| virtual int calculateSerializeBufferSize() const; | virtual int calculateSerializeBufferSize() const; | ||||
| ///fills the dataBuffer and returns the struct name (and 0 on failure) | ///fills the dataBuffer and returns the struct name (and 0 on failure) | ||||
| virtual const char* serialize(void* dataBuffer, btSerializer* serializer) const; | virtual const char* serialize(void* dataBuffer, btSerializer* serializer) const; | ||||
| }; | }; | ||||
| ▲ Show 20 Lines • Show All 70 Lines • Show Last 20 Lines | |||||