From fb8acf2f9cf2c9cdc56a43401c1fd2063f53cf0d Mon Sep 17 00:00:00 2001
From: Florent Lamiraux <florent@laas.fr>
Date: Thu, 16 May 2019 15:04:46 +0200
Subject: [PATCH] Improve initialization of nan vector.

---
 include/hpp/fcl/collision_data.h | 2 +-
 src/narrowphase/details.h        | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/include/hpp/fcl/collision_data.h b/include/hpp/fcl/collision_data.h
index 9641f723..88ed5d23 100644
--- a/include/hpp/fcl/collision_data.h
+++ b/include/hpp/fcl/collision_data.h
@@ -348,7 +348,7 @@ public:
                  std::numeric_limits<FCL_REAL>::max()):
   min_distance(min_distance_), o1(NULL), o2(NULL), b1(NONE), b2(NONE)
   {
-    Vec3f nan; nan << sqrt (-1), sqrt (-1), sqrt (-1);
+    Vec3f nan (Vec3f::Constant(std::numeric_limits<FCL_REAL>::quiet_NaN()));
     nearest_points [0] = nearest_points [1] = normal = nan;
   }
 
diff --git a/src/narrowphase/details.h b/src/narrowphase/details.h
index dea627e4..ee654943 100644
--- a/src/narrowphase/details.h
+++ b/src/narrowphase/details.h
@@ -351,7 +351,8 @@ namespace fcl {
       assert (radius >= 0);
       Vec3f p1_to_center = center - P1;
       FCL_REAL distance_from_plane = p1_to_center.dot(normal);
-      Vec3f closest_point; closest_point << sqrt (-1), sqrt (-1), sqrt (-1);
+      Vec3f closest_point
+        (Vec3f::Constant(std::numeric_limits<FCL_REAL>::quiet_NaN()));
       FCL_REAL min_distance_sqr, distance_sqr;
 
       if(distance_from_plane < 0) {
-- 
GitLab