From 4efe83557022e2d96291e2a45241cb02cef1cc75 Mon Sep 17 00:00:00 2001
From: rstrudel <rstrudel@gmail.com>
Date: Fri, 13 Dec 2019 18:36:42 +0100
Subject: [PATCH] Tests: fix bug eigen random functions

---
 test/capsule_capsule.cpp | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/test/capsule_capsule.cpp b/test/capsule_capsule.cpp
index 89cb9f00..a7248bac 100644
--- a/test/capsule_capsule.cpp
+++ b/test/capsule_capsule.cpp
@@ -80,8 +80,8 @@ BOOST_AUTO_TEST_CASE(collision_capsule_capsule_trivial)
     Eigen::Vector3d p1 = Eigen::Vector3d::Random()*(2.*radius);
     Eigen::Vector3d p2 = Eigen::Vector3d::Random()*(2.*radius);
     
-    Eigen::Matrix3d rot1 = Eigen::Quaterniond::UnitRandom().toRotationMatrix();
-    Eigen::Matrix3d rot2 = Eigen::Quaterniond::UnitRandom().toRotationMatrix();
+    Eigen::Matrix3d rot1 = Eigen::Quaterniond(Eigen::Vector4d::Random().normalized()).toRotationMatrix();
+    Eigen::Matrix3d rot2 = Eigen::Quaterniond(Eigen::Vector4d::Random().normalized()).toRotationMatrix();
 
     tf1.setTranslation(p1); tf1.setRotation(rot1);
     tf2.setTranslation(p2); tf2.setRotation(rot2);
@@ -124,7 +124,7 @@ BOOST_AUTO_TEST_CASE(collision_capsule_capsule_aligned)
   
   for(int i = 0; i < num_tests; ++i)
   {
-    Eigen::Matrix3d rot = Eigen::Quaterniond::UnitRandom().toRotationMatrix();
+    Eigen::Matrix3d rot = Eigen::Quaterniond(Eigen::Vector4d::Random().normalized()).toRotationMatrix();
 
     tf1.setTranslation(p1); tf1.setRotation(rot);
     tf2.setTranslation(p2_no_collision); tf2.setRotation(rot);
@@ -144,7 +144,7 @@ BOOST_AUTO_TEST_CASE(collision_capsule_capsule_aligned)
   Eigen::Vector3d p2_with_collision = Eigen::Vector3d(0.,0.,std::min(length/2.,radius)*(1.-1e-2));
   for(int i = 0; i < num_tests; ++i)
   {
-    Eigen::Matrix3d rot = Eigen::Quaterniond::UnitRandom().toRotationMatrix();
+    Eigen::Matrix3d rot = Eigen::Quaterniond(Eigen::Vector4d::Random().normalized()).toRotationMatrix();
 
     tf1.setTranslation(p1); tf1.setRotation(rot);
     tf2.setTranslation(p2_with_collision); tf2.setRotation(rot);
-- 
GitLab