Commit 02e3b06b authored by Joseph Mirabel's avatar Joseph Mirabel Committed by Joseph Mirabel
Browse files

Update to changes in hpp-fcl (handle FCL_HAVE_EIGEN flags)

parent ce88911d
......@@ -20,9 +20,12 @@
#ifndef HPP_MODEL_FCL_TO_EIGEN_HH
# define HPP_MODEL_FCL_TO_EIGEN_HH
# include <hpp/fcl/config-fcl.hh>
# include <hpp/fcl/math/transform.h>
# include <hpp/model/fwd.hh>
# if ! FCL_HAVE_EIGEN
inline hpp::model::matrix_t operator* (const hpp::model::matrix_t& m1,
const fcl::Matrix3f& m2)
{
......@@ -60,7 +63,7 @@ inline hpp::model::matrix_t operator* (const fcl::Matrix3f& m1,
namespace hpp {
namespace model {
inline void toEigen (const hpp::model::vector3_t& v,
Eigen::Matrix <value_type, 3, 1>& res)
Eigen::Matrix <value_type, 3, 1>& res)
{
res [0] = v [0]; res [1] = v [1]; res [2] = v [2];
}
......@@ -81,4 +84,20 @@ namespace hpp {
} // namespace model
} // namespace hpp
# else
namespace hpp {
namespace model {
/// For compatibility only
template <typename Derived>
inline void toEigen (const Eigen::MatrixBase<Derived>& v,
Eigen::Ref<matrix_t> res)
{
res = v.derived();
}
} // namespace model
} // namespace hpp
# endif
#endif // HPP_MODEL_FCL_TO_EIGEN_HH
......@@ -35,6 +35,7 @@ using boost::test_tools::output_test_stream;
#include <hpp/util/debug.hh>
#include <hpp/model/configuration.hh>
#include <hpp/model/object-factory.hh>
#include <hpp/model/fcl-to-eigen.hh>
using hpp::model::vector_t;
using hpp::model::vectorIn_t;
......@@ -231,3 +232,21 @@ BOOST_AUTO_TEST_CASE(interpolate)
);
}
}
BOOST_AUTO_TEST_CASE(toEigenFunction)
{
// Compilation check only.
using namespace hpp::model;
vector3_t fcl_v;
matrix3_t fcl_m;
fcl_v.setValue (1);
fcl_m.setValue (3);
vector_t eigen_v(3);
matrix_t eigen_m(3,3);
toEigen (fcl_v, eigen_v);
toEigen (fcl_m, eigen_m);
toEigen (fcl_v, eigen_m.col(0));
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment