@@ -90,21 +90,21 @@ void PositionBasedRigidBodyDynamics::computeMatrixK(
9090// ----------------------------------------------------------------------------------------------
9191void PositionBasedRigidBodyDynamics::computeMatrixG (const Quaternionr &q, Eigen::Matrix<Real, 4 , 3 , Eigen::DontAlign> &G)
9292{
93- G (0 , 0 ) = -0.5 *q.x ();
94- G (0 , 1 ) = -0.5 *q.y ();
95- G (0 , 2 ) = -0.5 *q.z ();
93+ G (0 , 0 ) = -static_cast <Real>( 0.5 ) *q.x ();
94+ G (0 , 1 ) = -static_cast <Real>( 0.5 ) *q.y ();
95+ G (0 , 2 ) = -static_cast <Real>( 0.5 ) *q.z ();
9696
97- G (1 , 0 ) = 0.5 *q.w ();
98- G (1 , 1 ) = 0.5 *q.z ();
99- G (1 , 2 ) = -0.5 *q.y ();
97+ G (1 , 0 ) = static_cast <Real>( 0.5 ) *q.w ();
98+ G (1 , 1 ) = static_cast <Real>( 0.5 ) *q.z ();
99+ G (1 , 2 ) = static_cast <Real>( -0.5 ) *q.y ();
100100
101- G (2 , 0 ) = -0.5 *q.z ();
102- G (2 , 1 ) = 0.5 *q.w ();
103- G (2 , 2 ) = 0.5 *q.x ();
101+ G (2 , 0 ) = static_cast <Real>( -0.5 ) *q.z ();
102+ G (2 , 1 ) = static_cast <Real>( 0.5 ) *q.w ();
103+ G (2 , 2 ) = static_cast <Real>( 0.5 ) *q.x ();
104104
105- G (3 , 0 ) = 0.5 *q.y ();
106- G (3 , 1 ) = -0.5 *q.x ();
107- G (3 , 2 ) = 0.5 *q.w ();
105+ G (3 , 0 ) = static_cast <Real>( 0.5 ) *q.y ();
106+ G (3 , 1 ) = static_cast <Real>( -0.5 ) *q.x ();
107+ G (3 , 2 ) = static_cast <Real>( 0.5 ) *q.w ();
108108}
109109
110110// ----------------------------------------------------------------------------------------------
@@ -371,13 +371,13 @@ bool PositionBasedRigidBodyDynamics::solve_DistanceJoint(
371371 Real alpha = 0.0 ;
372372 if (stiffness != 0.0 )
373373 {
374- alpha = 1.0 / (stiffness * dt * dt);
374+ alpha = static_cast <Real>( 1.0 ) / (stiffness * dt * dt);
375375 K += alpha;
376376 }
377377
378378 Real Kinv = 0.0 ;
379379 if (fabs (K) > static_cast <Real>(1e-6 ))
380- Kinv = 1.0 / K;
380+ Kinv = static_cast <Real>( 1.0 ) / K;
381381 else
382382 {
383383 corr_x0.setZero ();
@@ -1609,7 +1609,7 @@ bool PositionBasedRigidBodyDynamics::solve_TargetAngleMotorHingeJoint(
16091609 const Quaternionr tmp = (q0.conjugate () * q1);
16101610 const Vector4r qVec (tmp.w (), tmp.x (), tmp.y (), tmp.z ());
16111611 C.block <3 , 1 >(3 , 0 ) = Pr * qVec;
1612- C (3 , 0 ) -= sin (0.5 *targetAngle);
1612+ C (3 , 0 ) -= sin (static_cast <Real>( 0.5 ) *targetAngle);
16131613
16141614
16151615 const Vector3r r0 = c0 - x0;
@@ -2085,7 +2085,7 @@ bool PositionBasedRigidBodyDynamics::velocitySolve_TargetVelocityMotorHingeJoint
20852085 Real alpha = 0.0 ;
20862086 if (stiffness != 0.0 )
20872087 {
2088- alpha = 1.0 / (stiffness * dt * dt);
2088+ alpha = static_cast <Real>( 1.0 ) / (stiffness * dt * dt);
20892089 K (0 ,0 ) += alpha;
20902090 }
20912091
0 commit comments