From a387f34922bb5d27a36d0271f1a6a562f9c7f917 Mon Sep 17 00:00:00 2001
From: Lucile Remigy <lremigy@laas.fr>
Date: Thu, 29 Aug 2019 14:51:29 +0200
Subject: [PATCH] merge of matrix_3f.h and vec_3h.h in types.h

---
 CMakeLists.txt                           |  1 +
 include/hpp/fcl/BV/AABB.h                |  3 +-
 include/hpp/fcl/BV/BV_node.h             |  3 +-
 include/hpp/fcl/BV/OBB.h                 |  4 +-
 include/hpp/fcl/BV/RSS.h                 |  3 +-
 include/hpp/fcl/BV/kDOP.h                |  2 +-
 include/hpp/fcl/collision.h              |  2 +-
 include/hpp/fcl/collision_data.h         |  2 +-
 include/hpp/fcl/math/matrix_3f.h         | 33 +-------
 include/hpp/fcl/math/tools.h             |  5 +-
 include/hpp/fcl/math/transform.h         |  6 +-
 include/hpp/fcl/math/types.h             | 95 ++++++++++++++++++++++++
 include/hpp/fcl/math/vec_3f.h            | 36 +--------
 include/hpp/fcl/mesh_loader/loader.h     |  2 +-
 include/hpp/fcl/shape/geometric_shapes.h |  2 +-
 test/test_fcl_math.cpp                   |  3 +-
 16 files changed, 117 insertions(+), 85 deletions(-)
 create mode 100644 include/hpp/fcl/math/types.h

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3fc08c34..bc580e7f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -128,6 +128,7 @@ SET(${PROJECT_NAME}_HEADERS
   include/hpp/fcl/distance.h
   include/hpp/fcl/math/matrix_3f.h
   include/hpp/fcl/math/vec_3f.h
+  include/hpp/fcl/math/types.h
   include/hpp/fcl/math/tools.h
   include/hpp/fcl/math/transform.h
   include/hpp/fcl/traversal/details/traversal.h
diff --git a/include/hpp/fcl/BV/AABB.h b/include/hpp/fcl/BV/AABB.h
index 49dcaadf..6ea903ad 100644
--- a/include/hpp/fcl/BV/AABB.h
+++ b/include/hpp/fcl/BV/AABB.h
@@ -39,8 +39,7 @@
 #define HPP_FCL_AABB_H
 
 #include <stdexcept>
-#include <hpp/fcl/math/vec_3f.h>
-#include <hpp/fcl/math/matrix_3f.h>
+#include <hpp/fcl/math/types.h>
 
 namespace hpp
 {
diff --git a/include/hpp/fcl/BV/BV_node.h b/include/hpp/fcl/BV/BV_node.h
index 5889b740..08dbbf8b 100644
--- a/include/hpp/fcl/BV/BV_node.h
+++ b/include/hpp/fcl/BV/BV_node.h
@@ -39,8 +39,7 @@
 #ifndef HPP_FCL_BV_NODE_H
 #define HPP_FCL_BV_NODE_H
 
-#include <hpp/fcl/math/vec_3f.h>
-#include <hpp/fcl/math/matrix_3f.h>
+#include <hpp/fcl/math/types.h>
 
 #include <hpp/fcl/BV/BV.h>
 #include <iostream>
diff --git a/include/hpp/fcl/BV/OBB.h b/include/hpp/fcl/BV/OBB.h
index 028f011e..437f6595 100644
--- a/include/hpp/fcl/BV/OBB.h
+++ b/include/hpp/fcl/BV/OBB.h
@@ -38,9 +38,7 @@
 #ifndef HPP_FCL_OBB_H
 #define HPP_FCL_OBB_H
 
-
-#include <hpp/fcl/math/vec_3f.h>
-#include <hpp/fcl/math/matrix_3f.h>
+#include <hpp/fcl/math/types.h>
 
 namespace hpp
 {
diff --git a/include/hpp/fcl/BV/RSS.h b/include/hpp/fcl/BV/RSS.h
index 53d3ca3c..a2c0111d 100644
--- a/include/hpp/fcl/BV/RSS.h
+++ b/include/hpp/fcl/BV/RSS.h
@@ -39,8 +39,7 @@
 #define HPP_FCL_RSS_H
 
 #include <stdexcept>
-#include <hpp/fcl/math/vec_3f.h>
-#include <hpp/fcl/math/matrix_3f.h>
+#include <hpp/fcl/math/types.h>
 #include <boost/math/constants/constants.hpp>
 
 namespace hpp
diff --git a/include/hpp/fcl/BV/kDOP.h b/include/hpp/fcl/BV/kDOP.h
index 80f8d211..43c6db09 100644
--- a/include/hpp/fcl/BV/kDOP.h
+++ b/include/hpp/fcl/BV/kDOP.h
@@ -39,7 +39,7 @@
 #define HPP_FCL_KDOP_H
 
 #include <stdexcept>
-#include <hpp/fcl/math/matrix_3f.h>
+#include <hpp/fcl/math/types.h>
 
 namespace hpp
 {
diff --git a/include/hpp/fcl/collision.h b/include/hpp/fcl/collision.h
index f673494d..700e3234 100644
--- a/include/hpp/fcl/collision.h
+++ b/include/hpp/fcl/collision.h
@@ -39,7 +39,7 @@
 #ifndef HPP_FCL_COLLISION_H
 #define HPP_FCL_COLLISION_H
 
-#include <hpp/fcl/math/vec_3f.h>
+#include <hpp/fcl/math/types.h>
 #include <hpp/fcl/collision_object.h>
 #include <hpp/fcl/collision_data.h>
 
diff --git a/include/hpp/fcl/collision_data.h b/include/hpp/fcl/collision_data.h
index 88ed5d23..64dd24ff 100644
--- a/include/hpp/fcl/collision_data.h
+++ b/include/hpp/fcl/collision_data.h
@@ -41,7 +41,7 @@
 
 #include <hpp/fcl/collision_object.h>
 
-#include <hpp/fcl/math/vec_3f.h>
+#include <hpp/fcl/math/types.h>
 #include <vector>
 #include <set>
 #include <limits>
diff --git a/include/hpp/fcl/math/matrix_3f.h b/include/hpp/fcl/math/matrix_3f.h
index 9026a222..3c60bb44 100644
--- a/include/hpp/fcl/math/matrix_3f.h
+++ b/include/hpp/fcl/math/matrix_3f.h
@@ -38,34 +38,9 @@
 #ifndef HPP_FCL_MATRIX_3F_H
 #define HPP_FCL_MATRIX_3F_H
 
-#include <hpp/fcl/math/vec_3f.h>
+# warning "This file is deprecated. Include <hpp/fcl/math/types.h> instead."
 
-namespace hpp
-{
-namespace fcl
-{
+// List of equivalent includes.
+# include <hpp/fcl/math/types.h>
 
-  typedef Eigen::Matrix<FCL_REAL, 3, 3> Matrix3f;
-
-/// @brief Class for variance matrix in 3d
-class Variance3f
-{
-public:
-  /// @brief Variation matrix
-  Matrix3f Sigma;
-
-  /// @brief Variations along the eign axes
-  Matrix3f::Scalar sigma[3];
-
-  /// @brief Eigen axes of the variation matrix
-  Vec3f axis[3];
-
-};
-
-}
-
-
-
-} // namespace hpp
-
-#endif
+#endif
\ No newline at end of file
diff --git a/include/hpp/fcl/math/tools.h b/include/hpp/fcl/math/tools.h
index f1778661..8ad8a7ab 100644
--- a/include/hpp/fcl/math/tools.h
+++ b/include/hpp/fcl/math/tools.h
@@ -197,8 +197,6 @@ void eigen(const Eigen::MatrixBase<Derived>& m, typename Derived::Scalar dout[3]
   return;
 }
 
-
-
 template<typename Derived, typename OtherDerived>
 bool isEqual(const Eigen::MatrixBase<Derived>& lhs, const Eigen::MatrixBase<OtherDerived>& rhs, const FCL_REAL tol = std::numeric_limits<FCL_REAL>::epsilon()*100)
 {
@@ -206,7 +204,6 @@ bool isEqual(const Eigen::MatrixBase<Derived>& lhs, const Eigen::MatrixBase<Othe
 }
 
 }
-
 } // namespace hpp
 
-#endif
+#endif
\ No newline at end of file
diff --git a/include/hpp/fcl/math/transform.h b/include/hpp/fcl/math/transform.h
index 1787918d..b3aa7832 100644
--- a/include/hpp/fcl/math/transform.h
+++ b/include/hpp/fcl/math/transform.h
@@ -39,7 +39,7 @@
 #ifndef HPP_FCL_TRANSFORM_H
 #define HPP_FCL_TRANSFORM_H
 
-#include <hpp/fcl/math/matrix_3f.h>
+#include <hpp/fcl/math/types.h>
 #include <boost/thread/mutex.hpp>
 
 namespace hpp
@@ -126,8 +126,6 @@ public:
     R.setIdentity();
   }
 
-
-
   /// @brief operator = 
   Transform3f& operator = (const Transform3f& tf)
   {
@@ -262,8 +260,8 @@ public:
   }
 
 };
-}
 
+}
 } // namespace hpp
 
 #endif
diff --git a/include/hpp/fcl/math/types.h b/include/hpp/fcl/math/types.h
new file mode 100644
index 00000000..3b14ccf9
--- /dev/null
+++ b/include/hpp/fcl/math/types.h
@@ -0,0 +1,95 @@
+/*
+ * Software License Agreement (BSD License)
+ *
+ *  Copyright (c) 2011-2014, Willow Garage, Inc.
+ *  Copyright (c) 2014-2015, Open Source Robotics Foundation
+ *  All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions
+ *  are met:
+ *
+ *   * Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *   * Redistributions in binary form must reproduce the above
+ *     copyright notice, this list of conditions and the following
+ *     disclaimer in the documentation and/or other materials provided
+ *     with the distribution.
+ *   * Neither the name of Open Source Robotics Foundation nor the names of its
+ *     contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ *  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ *  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ *  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ *  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ *  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ *  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ *  POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** \author Joseph Mirabel */
+
+#ifndef HPP_FCL_MATH_TYPES_H
+#define HPP_FCL_MATH_TYPES_H
+
+#include <hpp/fcl/data_types.h>
+
+#include <Eigen/Core>
+#include <Eigen/Geometry>
+#include <hpp/fcl/math/tools.h>
+
+#include <cmath>
+#include <iostream>
+#include <limits>
+
+namespace hpp
+{
+namespace fcl
+{
+  typedef Eigen::Matrix<FCL_REAL, 3, 1> Vec3f;
+}
+
+#ifdef HPP_FCL_HAVE_OCTOMAP
+  #define OCTOMAP_VERSION_AT_LEAST(x,y,z) \
+    (OCTOMAP_MAJOR_VERSION > x || (OCTOMAP_MAJOR_VERSION >= x && \
+    (OCTOMAP_MINOR_VERSION > y || (OCTOMAP_MINOR_VERSION >= y && \
+    OCTOMAP_PATCH_VERSION >= z))))
+
+  #define OCTOMAP_VERSION_AT_MOST(x,y,z) \
+    (OCTOMAP_MAJOR_VERSION < x || (OCTOMAP_MAJOR_VERSION <= x && \
+    (OCTOMAP_MINOR_VERSION < y || (OCTOMAP_MINOR_VERSION <= y && \
+    OCTOMAP_PATCH_VERSION <= z))))
+#endif // HPP_FCL_HAVE_OCTOMAP
+}
+
+namespace hpp
+{
+namespace fcl 
+{
+  typedef Eigen::Matrix<FCL_REAL, 3, 3> Matrix3f;
+
+/// @brief Class for variance matrix in 3d
+class Variance3f
+{
+public:
+  /// @brief Variation matrix
+  Matrix3f Sigma;
+
+  /// @brief Variations along the eign axes
+  Matrix3f::Scalar sigma[3];
+
+  /// @brief Eigen axes of the variation matrix
+  Vec3f axis[3];
+
+};
+
+}
+} // namespace hpp
+
+#endif
\ No newline at end of file
diff --git a/include/hpp/fcl/math/vec_3f.h b/include/hpp/fcl/math/vec_3f.h
index a45a9202..9d41c14f 100644
--- a/include/hpp/fcl/math/vec_3f.h
+++ b/include/hpp/fcl/math/vec_3f.h
@@ -38,37 +38,9 @@
 #ifndef HPP_FCL_VEC_3F_H
 #define HPP_FCL_VEC_3F_H
 
-#include <hpp/fcl/data_types.h>
+# warning "This file is deprecated. Include <hpp/fcl/math/types.h> instead."
 
-#include <Eigen/Core>
-#include <Eigen/Geometry>
-#include <hpp/fcl/math/tools.h>
+// List of equivalent includes.
+# include <hpp/fcl/math/types.h>
 
-#include <cmath>
-#include <iostream>
-#include <limits>
-
-
-namespace hpp
-{
-namespace fcl
-{
-  typedef Eigen::Matrix<FCL_REAL, 3, 1> Vec3f;
-}
-
-
-
-} // namespace hpp
-
-#ifdef HPP_FCL_HAVE_OCTOMAP
-  #define OCTOMAP_VERSION_AT_LEAST(x,y,z) \
-    (OCTOMAP_MAJOR_VERSION > x || (OCTOMAP_MAJOR_VERSION >= x && \
-    (OCTOMAP_MINOR_VERSION > y || (OCTOMAP_MINOR_VERSION >= y && \
-    OCTOMAP_PATCH_VERSION >= z))))
-
-  #define OCTOMAP_VERSION_AT_MOST(x,y,z) \
-    (OCTOMAP_MAJOR_VERSION < x || (OCTOMAP_MAJOR_VERSION <= x && \
-    (OCTOMAP_MINOR_VERSION < y || (OCTOMAP_MINOR_VERSION <= y && \
-    OCTOMAP_PATCH_VERSION <= z))))
-#endif // HPP_FCL_HAVE_OCTOMAP
-#endif
+#endif
\ No newline at end of file
diff --git a/include/hpp/fcl/mesh_loader/loader.h b/include/hpp/fcl/mesh_loader/loader.h
index 01ba842b..c24f9035 100644
--- a/include/hpp/fcl/mesh_loader/loader.h
+++ b/include/hpp/fcl/mesh_loader/loader.h
@@ -40,7 +40,7 @@
 #include <boost/shared_ptr.hpp>
 #include <hpp/fcl/fwd.hh>
 #include <hpp/fcl/config.hh>
-#include <hpp/fcl/math/vec_3f.h>
+#include <hpp/fcl/math/types.h>
 #include <hpp/fcl/collision_object.h>
 
 namespace hpp
diff --git a/include/hpp/fcl/shape/geometric_shapes.h b/include/hpp/fcl/shape/geometric_shapes.h
index 87723bbd..586fa826 100644
--- a/include/hpp/fcl/shape/geometric_shapes.h
+++ b/include/hpp/fcl/shape/geometric_shapes.h
@@ -42,7 +42,7 @@
 #include <boost/math/constants/constants.hpp>
 
 #include <hpp/fcl/collision_object.h>
-#include <hpp/fcl/math/vec_3f.h>
+#include <hpp/fcl/math/types.h>
 #include <string.h>
 
 namespace hpp
diff --git a/test/test_fcl_math.cpp b/test/test_fcl_math.cpp
index a82721b1..117ec04f 100644
--- a/test/test_fcl_math.cpp
+++ b/test/test_fcl_math.cpp
@@ -39,8 +39,7 @@
 #include <boost/test/unit_test.hpp>
 #include <boost/utility/binary.hpp>
 
-#include <hpp/fcl/math/vec_3f.h>
-#include <hpp/fcl/math/matrix_3f.h>
+#include <hpp/fcl/math/types.h>
 #include <hpp/fcl/math/transform.h>
 
 #include <hpp/fcl/intersect.h>
-- 
GitLab