Skip to content
Snippets Groups Projects
Commit 5741939b authored by Joseph Mirabel's avatar Joseph Mirabel Committed by Joseph Mirabel
Browse files

Rename Quaternion3f::Transform to transform_return_type

parent 0cf03ade
No related branches found
No related tags found
No related merge requests found
......@@ -52,7 +52,22 @@ private:
typedef Eigen::Matrix<FCL_REAL, 4, 1> Vec4f;
typedef typename Vec4f:: FixedSegmentReturnType<3>::Type XYZ_t;
typedef typename Vec4f::ConstFixedSegmentReturnType<3>::Type XYZConst_t;
public:
template<typename Derived> struct transform_return_type {
typedef typename XYZConst_t::cross_product_return_type<Derived>::type Cross_t;
typedef Eigen::CwiseBinaryOp <
Eigen::internal::scalar_sum_op <FCL_REAL>,
const typename Derived::ScalarMultipleReturnType,
const typename Cross_t::ScalarMultipleReturnType >
RightSum_t;
typedef Eigen::CwiseBinaryOp <
Eigen::internal::scalar_sum_op <FCL_REAL>,
const typename XYZConst_t::ScalarMultipleReturnType,
const RightSum_t >
Type;
};
enum {
W = 0,
X = 1,
......@@ -168,24 +183,10 @@ public:
if (n > 0) data *= 1/sqrt(n);
}
template<typename Derived> struct Transform {
typedef typename XYZConst_t::cross_product_return_type<Derived>::type Cross_t;
typedef Eigen::CwiseBinaryOp <
Eigen::internal::scalar_sum_op <FCL_REAL>,
const typename Derived::ScalarMultipleReturnType,
const typename Cross_t::ScalarMultipleReturnType >
RightSum_t;
typedef Eigen::CwiseBinaryOp <
Eigen::internal::scalar_sum_op <FCL_REAL>,
const typename XYZConst_t::ScalarMultipleReturnType,
const RightSum_t >
Type;
};
/// @brief rotate a vector
template<typename Derived>
/*inline Vec3f transform(const Eigen::MatrixBase<Derived>& v) const*/
inline typename Transform<Derived>::Type
inline typename transform_return_type<Derived>::Type
transform(const Eigen::MatrixBase<Derived>& v) const
{
EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(Derived, 3);
......@@ -194,8 +195,8 @@ public:
/*return 2*u.dot(v)*u + (s*s - u.dot(u))*v + 2*s*u.cross(v);*/
const FCL_REAL uDv = u.dot(v);
const FCL_REAL uDu = u.dot(u);
const typename Transform<Derived>::RightSum_t rhs((s*s - uDu)*v, 2*s*u.cross(v.derived()));
return typename Transform<Derived>::Type (2*uDv*u, rhs);
const typename transform_return_type<Derived>::RightSum_t rhs((s*s - uDu)*v, 2*s*u.cross(v.derived()));
return typename transform_return_type<Derived>::Type (2*uDv*u, rhs);
}
bool operator == (const Quaternion3f& other) const
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment