diff --git a/examples/DeformableDemo/GraspDeformable.cpp b/examples/DeformableDemo/GraspDeformable.cpp index 98fb63a8d..ddb47954b 100644 --- a/examples/DeformableDemo/GraspDeformable.cpp +++ b/examples/DeformableDemo/GraspDeformable.cpp @@ -340,7 +340,7 @@ void GraspDeformable::initPhysics() psb->getCollisionShape()->setMargin(0.005); psb->generateBendingConstraints(2); psb->setTotalMass(.01); - psb->setSpringStiffness(5); + psb->setSpringStiffness(10); psb->setDampingCoefficient(0.05); psb->m_cfg.kKHR = 1; // collision hardness with kinematic objects psb->m_cfg.kCHR = 1; // collision hardness with rigid body diff --git a/src/LinearMath/btImplicitQRSVD.h b/src/LinearMath/btImplicitQRSVD.h index 0785a6259..6af525993 100644 --- a/src/LinearMath/btImplicitQRSVD.h +++ b/src/LinearMath/btImplicitQRSVD.h @@ -87,6 +87,12 @@ public: } }; +static inline btScalar copySign(btScalar x, btScalar y) { + if ((x < 0 && y > 0) || (x > 0 && y < 0)) + return -x; + return x; +} + /** Class for givens rotation. Row rotation G*A corresponds to something like @@ -550,14 +556,11 @@ inline void singularValueDecomposition( */ inline btScalar wilkinsonShift(const btScalar a1, const btScalar b1, const btScalar a2) { - using std::sqrt; using std::fabs; - using std::copysign; btScalar d = (btScalar)0.5 * (a1 - a2); btScalar bs = b1 * b1; - - btScalar mu = a2 - copysign(bs / (fabs(d) + sqrt(d * d + bs)), d); + btScalar mu = a2 - copysign(bs / (btFabs(d) + btSqrt(d * d + bs)), d); // T mu = a2 - bs / ( d + sign_d*sqrt (d*d + bs)); return mu; }