diff --git a/CMakeLists.txt b/CMakeLists.txt index 3fc08c3492e503ee4bcf2bd798519441e603411a..bc580e7f027f9c1eb9b5296f6080a4276bb918b5 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 49dcaadf7acfc7d9e1c454011d62d64eed29fc66..6ea903ad2c31eb961384babb81c384d4efe38dc2 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 5889b740367f4b97b7424e71af45642c92c3c458..08dbbf8bd1ba82f1f0ed1208d7e9bcbc277c1912 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 028f011e459aa1db1a3202ce37d3daf0826d7e96..437f65957ff952380157b893a705782accd70999 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 53d3ca3ca4620597fa601f474e19bc6ff136d21c..a2c0111da817b431e877aeb690a2f0533678d8b3 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 80f8d21182f88b8b278267b0cc988821cc0d7a41..43c6db0972d0a52e58b45bee08b82be8a1765c5b 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 f673494defbe47ff01b4217928990d7cbf84bd8f..700e3234233199340514c8e2a90de0d5396ad8b8 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 88ed5d23949ef53f4c8a54375fa72c6f069d589d..64dd24ff505fabbfc34271b1f56cfa6c99cd2087 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 9026a222a8e7d20cf0cc1b9739eef6f5739f7aa5..3c60bb44b1f3c6c4f2b080be1791ba0eb59b03ed 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 f1778661adb077b93698b1ffd66b03b92e7273b8..8ad8a7abc3d1b82df20d475fafdfb2b14057972a 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 1787918d043af292fb7c715574631fe7fbe761fa..b3aa78323b8a15bdbfba9047909d49944fe1e9d8 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 0000000000000000000000000000000000000000..3b14ccf98b383597718f5fa2f2fa60c7f5942eb7 --- /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 a45a92028e575bbecec8fde1e5e2bd7825d0c7fd..9d41c14f8fa9a8daaf0cf97bd7d90da811d4fe9a 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 01ba842bfbdf5250eaae191ac6895c48f1ff218e..c24f90357ce684892be44bcd94b45b4d590aae94 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 87723bbd4df6a1b9b5cb5fb1aff37bc337c0e27f..586fa82645b3a74d4f88960b7d1a8048b5b5639a 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 a82721b1f5a2e5d3579ee2e86ed5c398d66a02d1..117ec04fb09ad2e94cab9414db3c5adc25d80b0d 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>