diff options
author | Gael Guennebaud <g.gael@free.fr> | 2019-12-03 14:51:14 +0100 |
---|---|---|
committer | Gael Guennebaud <g.gael@free.fr> | 2019-12-03 14:51:14 +0100 |
commit | 6358599ecbe23a8ba1829dea21e532aa85aab932 (patch) | |
tree | fdb4ca1fa1f87bace7c56cd24dda33cad5d7b561 /Eigen/src/Geometry/Quaternion.h | |
parent | 7745f69013b5e4c93c1ffe6ba3173456d45c7222 (diff) |
Fix QuaternionBase::cast for quaternion map and wrapper.
Diffstat (limited to 'Eigen/src/Geometry/Quaternion.h')
-rw-r--r-- | Eigen/src/Geometry/Quaternion.h | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/Eigen/src/Geometry/Quaternion.h b/Eigen/src/Geometry/Quaternion.h index faea62f17..73b28ae34 100644 --- a/Eigen/src/Geometry/Quaternion.h +++ b/Eigen/src/Geometry/Quaternion.h @@ -169,16 +169,31 @@ class QuaternionBase : public RotationBase<Derived, 3> /** return the result vector of \a v through the rotation*/ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Vector3 _transformVector(const Vector3& v) const; + #ifdef EIGEN_PARSED_BY_DOXYGEN /** \returns \c *this with scalar type casted to \a NewScalarType * * Note that if \a NewScalarType is equal to the current scalar type of \c *this * then this function smartly returns a const reference to \c *this. */ template<typename NewScalarType> - EIGEN_DEVICE_FUNC inline typename internal::cast_return_type<Derived,Quaternion<NewScalarType> >::type cast() const + EIGEN_DEVICE_FUNC inline typename internal::cast_return_type<Derived,Quaternion<NewScalarType> >::type cast() const; + + #else + + template<typename NewScalarType> + EIGEN_DEVICE_FUNC inline + typename internal::enable_if<internal::is_same<Scalar,NewScalarType>::value,const Derived&>::type cast() const + { + return derived(); + } + + template<typename NewScalarType> + EIGEN_DEVICE_FUNC inline + typename internal::enable_if<!internal::is_same<Scalar,NewScalarType>::value,Quaternion<NewScalarType> >::type cast() const { - return typename internal::cast_return_type<Derived,Quaternion<NewScalarType> >::type(derived()); + return Quaternion<NewScalarType>(coeffs().template cast<NewScalarType>()); } + #endif #ifdef EIGEN_QUATERNIONBASE_PLUGIN # include EIGEN_QUATERNIONBASE_PLUGIN |