diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2012-05-09 12:33:05 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2012-05-09 12:33:05 +0400 |
commit | 91227ff6d0d49b67f4b332deeb29052502280981 (patch) | |
tree | e7dc3d4cc7baeb759be0f3d8907f6a93107b2fd7 /extern/Eigen3/Eigen/src/Geometry/Quaternion.h | |
parent | e132098599a8562bec7bff9aeaa69a7891d50708 (diff) |
Update Eigen3 library, would be needed for some further integraiton.
Diffstat (limited to 'extern/Eigen3/Eigen/src/Geometry/Quaternion.h')
-rw-r--r-- | extern/Eigen3/Eigen/src/Geometry/Quaternion.h | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/extern/Eigen3/Eigen/src/Geometry/Quaternion.h b/extern/Eigen3/Eigen/src/Geometry/Quaternion.h index 2662d60fed1..9180db67d84 100644 --- a/extern/Eigen3/Eigen/src/Geometry/Quaternion.h +++ b/extern/Eigen3/Eigen/src/Geometry/Quaternion.h @@ -182,10 +182,9 @@ public: template<typename NewScalarType> inline typename internal::cast_return_type<Derived,Quaternion<NewScalarType> >::type cast() const { - return typename internal::cast_return_type<Derived,Quaternion<NewScalarType> >::type( - coeffs().template cast<NewScalarType>()); + return typename internal::cast_return_type<Derived,Quaternion<NewScalarType> >::type(derived()); } - + #ifdef EIGEN_QUATERNIONBASE_PLUGIN # include EIGEN_QUATERNIONBASE_PLUGIN #endif @@ -225,22 +224,25 @@ struct traits<Quaternion<_Scalar,_Options> > typedef _Scalar Scalar; typedef Matrix<_Scalar,4,1,_Options> Coefficients; enum{ - IsAligned = bool(EIGEN_ALIGN) && ((int(_Options)&Aligned)==Aligned), + IsAligned = internal::traits<Coefficients>::Flags & AlignedBit, Flags = IsAligned ? (AlignedBit | LvalueBit) : LvalueBit }; }; } template<typename _Scalar, int _Options> -class Quaternion : public QuaternionBase<Quaternion<_Scalar,_Options> >{ +class Quaternion : public QuaternionBase<Quaternion<_Scalar,_Options> > +{ typedef QuaternionBase<Quaternion<_Scalar,_Options> > Base; + enum { IsAligned = internal::traits<Quaternion>::IsAligned }; + public: typedef _Scalar Scalar; EIGEN_INHERIT_ASSIGNMENT_EQUAL_OPERATOR(Quaternion) using Base::operator*=; - typedef typename internal::traits<Quaternion<Scalar,_Options> >::Coefficients Coefficients; + typedef typename internal::traits<Quaternion>::Coefficients Coefficients; typedef typename Base::AngleAxisType AngleAxisType; /** Default constructor leaving the quaternion uninitialized. */ @@ -271,9 +273,16 @@ public: template<typename Derived> explicit inline Quaternion(const MatrixBase<Derived>& other) { *this = other; } + /** Explicit copy constructor with scalar conversion */ + template<typename OtherScalar, int OtherOptions> + explicit inline Quaternion(const Quaternion<OtherScalar, OtherOptions>& other) + { m_coeffs = other.coeffs().template cast<Scalar>(); } + inline Coefficients& coeffs() { return m_coeffs;} inline const Coefficients& coeffs() const { return m_coeffs;} + EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF(IsAligned) + protected: Coefficients m_coeffs; @@ -673,7 +682,7 @@ QuaternionBase<Derived>::slerp(Scalar t, const QuaternionBase<OtherDerived>& oth Scalar scale0; Scalar scale1; - if (absD>=one) + if(absD>=one) { scale0 = Scalar(1) - t; scale1 = t; @@ -686,9 +695,8 @@ QuaternionBase<Derived>::slerp(Scalar t, const QuaternionBase<OtherDerived>& oth scale0 = internal::sin( ( Scalar(1) - t ) * theta) / sinTheta; scale1 = internal::sin( ( t * theta) ) / sinTheta; - if (d<0) - scale1 = -scale1; } + if(d<0) scale1 = -scale1; return Quaternion<Scalar>(scale0 * coeffs() + scale1 * other.coeffs()); } |