@@ -1581,16 +1581,18 @@ TYPED_TEST(Momentum_ErrorFunctionsTest, FixedAxisDiffErrorL2_GradientsAndJacobia
15811581 const Skeleton& skeleton = character.skeleton ;
15821582 const ParameterTransformT<T> transform = character.parameterTransform .cast <T>();
15831583
1584+ Random<> rng (10455 );
1585+
15841586 // create constraints
15851587 FixedAxisDiffErrorFunctionT<T> errorFunction (skeleton, character.parameterTransform );
15861588 const T TEST_WEIGHT_VALUE = 4.5 ;
15871589 {
15881590 SCOPED_TRACE (" FixedAxisDiffL2 Constraint Test" );
15891591 std::vector<FixedAxisDataT<T>> cl{
15901592 FixedAxisDataT<T>(
1591- uniform<Vector3<T>>(-1 , 1 ), uniform<Vector3<T>>(-1 , 1 ), 2 , TEST_WEIGHT_VALUE),
1593+ rng. uniform <Vector3<T>>(-1 , 1 ), rng. uniform <Vector3<T>>(-1 , 1 ), 2 , TEST_WEIGHT_VALUE),
15921594 FixedAxisDataT<T>(
1593- uniform<Vector3<T>>(-1 , 1 ), uniform<Vector3<T>>(-1 , 1 ), 1 , TEST_WEIGHT_VALUE)};
1595+ rng. uniform <Vector3<T>>(-1 , 1 ), rng. uniform <Vector3<T>>(-1 , 1 ), 1 , TEST_WEIGHT_VALUE)};
15941596 errorFunction.setConstraints (cl);
15951597
15961598 TEST_GRADIENT_AND_JACOBIAN (
@@ -1601,9 +1603,9 @@ TYPED_TEST(Momentum_ErrorFunctionsTest, FixedAxisDiffErrorL2_GradientsAndJacobia
16011603 Eps<T>(5e-2f , 5e-6 ));
16021604 for (size_t i = 0 ; i < 10 ; i++) {
16031605 ModelParametersT<T> parameters =
1604- uniform<VectorX<T>>(transform.numAllModelParameters (), -1 , 1 );
1606+ rng. uniform <VectorX<T>>(transform.numAllModelParameters (), -1 , 1 );
16051607 TEST_GRADIENT_AND_JACOBIAN (
1606- T, &errorFunction, parameters, character, Eps<T>(8e -2f , 5e-6 ), Eps<T>(1e-6f , 1e-7 ));
1608+ T, &errorFunction, parameters, character, Eps<T>(9e -2f , 5e-6 ), Eps<T>(1e-6f , 1e-7 ));
16071609 }
16081610 }
16091611}
@@ -1615,16 +1617,18 @@ TYPED_TEST(Momentum_ErrorFunctionsTest, FixedAxisCosErrorL2_GradientsAndJacobian
16151617 const Character character = createTestCharacter ();
16161618 const Skeleton& skeleton = character.skeleton ;
16171619
1620+ Random<> rng (43926 );
1621+
16181622 // create constraints
16191623 FixedAxisCosErrorFunctionT<T> errorFunction (skeleton, character.parameterTransform );
16201624 const T TEST_WEIGHT_VALUE = 4.5 ;
16211625 {
16221626 SCOPED_TRACE (" FixedAxisCosL2 Constraint Test" );
16231627 std::vector<FixedAxisDataT<T>> cl{
16241628 FixedAxisDataT<T>(
1625- uniform<Vector3<T>>(-1 , 1 ), uniform<Vector3<T>>(-1 , 1 ), 2 , TEST_WEIGHT_VALUE),
1629+ rng. uniform <Vector3<T>>(-1 , 1 ), rng. uniform <Vector3<T>>(-1 , 1 ), 2 , TEST_WEIGHT_VALUE),
16261630 FixedAxisDataT<T>(
1627- uniform<Vector3<T>>(-1 , 1 ), uniform<Vector3<T>>(-1 , 1 ), 1 , TEST_WEIGHT_VALUE)};
1631+ rng. uniform <Vector3<T>>(-1 , 1 ), rng. uniform <Vector3<T>>(-1 , 1 ), 1 , TEST_WEIGHT_VALUE)};
16281632 errorFunction.setConstraints (cl);
16291633
16301634 TEST_GRADIENT_AND_JACOBIAN (
@@ -1635,7 +1639,7 @@ TYPED_TEST(Momentum_ErrorFunctionsTest, FixedAxisCosErrorL2_GradientsAndJacobian
16351639 Eps<T>(2e-2f , 1e-4 ));
16361640 for (size_t i = 0 ; i < 10 ; i++) {
16371641 ModelParametersT<T> parameters =
1638- uniform<VectorX<T>>(character.parameterTransform .numAllModelParameters (), -1 , 1 );
1642+ rng. uniform <VectorX<T>>(character.parameterTransform .numAllModelParameters (), -1 , 1 );
16391643 TEST_GRADIENT_AND_JACOBIAN (
16401644 T, &errorFunction, parameters, character, Eps<T>(5e-2f , 1e-4 ), Eps<T>(1e-6f , 1e-7 ));
16411645 }
@@ -1650,14 +1654,16 @@ TYPED_TEST(Momentum_ErrorFunctionsTest, FixedAxisAngleErrorL2_GradientsAndJacobi
16501654 const Skeleton& skeleton = character.skeleton ;
16511655 const ParameterTransformT<T> transform = character.parameterTransform .cast <T>();
16521656
1657+ Random<> rng (37482 );
1658+
16531659 // create constraints
16541660 FixedAxisAngleErrorFunctionT<T> errorFunction (skeleton, character.parameterTransform );
16551661 const T TEST_WEIGHT_VALUE = 4.5 ;
16561662 {
16571663 SCOPED_TRACE (" FixedAxisAngleL2 Constraint Test" );
16581664 std::vector<FixedAxisDataT<T>> cl{
16591665 FixedAxisDataT<T>(
1660- uniform<Vector3<T>>(-1 , 1 ), uniform<Vector3<T>>(-1 , 1 ), 2 , TEST_WEIGHT_VALUE),
1666+ rng. uniform <Vector3<T>>(-1 , 1 ), rng. uniform <Vector3<T>>(-1 , 1 ), 2 , TEST_WEIGHT_VALUE),
16611667 // corner case when the angle is close to zero
16621668 FixedAxisDataT<T>(
16631669 Vector3<T>::UnitY (), Vector3<T>(1e-16 , 1 + 1e-16 , 1e-16 ), 1 , TEST_WEIGHT_VALUE),
@@ -1684,7 +1690,7 @@ TYPED_TEST(Momentum_ErrorFunctionsTest, FixedAxisAngleErrorL2_GradientsAndJacobi
16841690 }
16851691 for (size_t i = 0 ; i < 10 ; i++) {
16861692 ModelParametersT<T> parameters =
1687- uniform<VectorX<T>>(transform.numAllModelParameters (), -1 , 1 );
1693+ rng. uniform <VectorX<T>>(transform.numAllModelParameters (), -1 , 1 );
16881694 TEST_GRADIENT_AND_JACOBIAN (
16891695 T, &errorFunction, parameters, character, Eps<T>(2e-1f , 5e-5 ), Eps<T>(1e-6f , 1e-7 ));
16901696 }
0 commit comments