Changeset 8393 for code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btTypedConstraint.h
- Timestamp:
- May 3, 2011, 5:07:42 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btTypedConstraint.h
r8351 r8393 14 14 */ 15 15 16 #ifndef TYPED_CONSTRAINT_H17 #define TYPED_CONSTRAINT_H16 #ifndef BT_TYPED_CONSTRAINT_H 17 #define BT_TYPED_CONSTRAINT_H 18 18 19 19 class btRigidBody; 20 20 #include "LinearMath/btScalar.h" 21 21 #include "btSolverConstraint.h" 22 #include "BulletCollision/NarrowPhaseCollision/btPersistentManifold.h"23 22 24 23 class btSerializer; 25 24 25 //Don't change any of the existing enum values, so add enum types at the end for serialization compatibility 26 26 enum btTypedConstraintType 27 27 { 28 POINT2POINT_CONSTRAINT_TYPE= MAX_CONTACT_MANIFOLD_TYPE+1,28 POINT2POINT_CONSTRAINT_TYPE=3, 29 29 HINGE_CONSTRAINT_TYPE, 30 30 CONETWIST_CONSTRAINT_TYPE, 31 31 D6_CONSTRAINT_TYPE, 32 32 SLIDER_CONSTRAINT_TYPE, 33 CONTACT_CONSTRAINT_TYPE 33 CONTACT_CONSTRAINT_TYPE, 34 D6_SPRING_CONSTRAINT_TYPE, 35 MAX_CONSTRAINT_TYPE 34 36 }; 35 37 … … 60 62 void* m_userConstraintPtr; 61 63 }; 64 65 btScalar m_breakingImpulseThreshold; 66 bool m_isEnabled; 67 62 68 63 69 bool m_needsFeedback; … … 154 160 } 155 161 162 163 btScalar getBreakingImpulseThreshold() const 164 { 165 return m_breakingImpulseThreshold; 166 } 167 168 void setBreakingImpulseThreshold(btScalar threshold) 169 { 170 m_breakingImpulseThreshold = threshold; 171 } 172 173 bool isEnabled() const 174 { 175 return m_isEnabled; 176 } 177 178 void setEnabled(bool enabled) 179 { 180 m_isEnabled=enabled; 181 } 182 183 156 184 ///internal method used by the constraint solver, don't use them directly 157 185 virtual void solveConstraintObsolete(btRigidBody& /*bodyA*/,btRigidBody& /*bodyB*/,btScalar /*timeStep*/) {}; … … 312 340 313 341 314 315 #endif //TYPED_CONSTRAINT_H 342 class btAngularLimit 343 { 344 private: 345 btScalar 346 m_center, 347 m_halfRange, 348 m_softness, 349 m_biasFactor, 350 m_relaxationFactor, 351 m_correction, 352 m_sign; 353 354 bool 355 m_solveLimit; 356 357 public: 358 /// Default constructor initializes limit as inactive, allowing free constraint movement 359 btAngularLimit() 360 :m_center(0.0f), 361 m_halfRange(-1.0f), 362 m_softness(0.9f), 363 m_biasFactor(0.3f), 364 m_relaxationFactor(1.0f), 365 m_correction(0.0f), 366 m_sign(0.0f), 367 m_solveLimit(false) 368 {} 369 370 /// Sets all limit's parameters. 371 /// When low > high limit becomes inactive. 372 /// When high - low > 2PI limit is ineffective too becouse no angle can exceed the limit 373 void set(btScalar low, btScalar high, btScalar _softness = 0.9f, btScalar _biasFactor = 0.3f, btScalar _relaxationFactor = 1.0f); 374 375 /// Checks conastaint angle against limit. If limit is active and the angle violates the limit 376 /// correction is calculated. 377 void test(const btScalar angle); 378 379 /// Returns limit's softness 380 inline btScalar getSoftness() const 381 { 382 return m_softness; 383 } 384 385 /// Returns limit's bias factor 386 inline btScalar getBiasFactor() const 387 { 388 return m_biasFactor; 389 } 390 391 /// Returns limit's relaxation factor 392 inline btScalar getRelaxationFactor() const 393 { 394 return m_relaxationFactor; 395 } 396 397 /// Returns correction value evaluated when test() was invoked 398 inline btScalar getCorrection() const 399 { 400 return m_correction; 401 } 402 403 /// Returns sign value evaluated when test() was invoked 404 inline btScalar getSign() const 405 { 406 return m_sign; 407 } 408 409 /// Gives half of the distance between min and max limit angle 410 inline btScalar getHalfRange() const 411 { 412 return m_halfRange; 413 } 414 415 /// Returns true when the last test() invocation recognized limit violation 416 inline bool isLimit() const 417 { 418 return m_solveLimit; 419 } 420 421 /// Checks given angle against limit. If limit is active and angle doesn't fit it, the angle 422 /// returned is modified so it equals to the limit closest to given angle. 423 void fit(btScalar& angle) const; 424 425 /// Returns correction value multiplied by sign value 426 btScalar getError() const; 427 428 btScalar getLow() const; 429 430 btScalar getHigh() const; 431 432 }; 433 434 435 436 #endif //BT_TYPED_CONSTRAINT_H
Note: See TracChangeset
for help on using the changeset viewer.