remove std::copysign

This commit is contained in:
Xuchen Han
2019-10-12 19:19:11 -07:00
parent a7222d8a9f
commit 30238b2fbc
2 changed files with 8 additions and 5 deletions

View File

@@ -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

View File

@@ -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;
}