diff options
author | 2011-10-31 09:23:41 -0400 | |
---|---|---|
committer | 2011-10-31 09:23:41 -0400 | |
commit | 9df2f5c9237579bf1221b784ae87ed789237fb1c (patch) | |
tree | 46146f41524b4db59cfd48c0f45e18028162ef9b /Eigen | |
parent | 0609dbeec67df8f681afb34263c1be826831f534 (diff) |
bug #369 - Quaternion alignment is broken
The problem was two-fold:
* missing aligned operator new
* Flags were mis-computed, the Aligned constant was misused
Diffstat (limited to 'Eigen')
-rw-r--r-- | Eigen/src/Geometry/Quaternion.h | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/Eigen/src/Geometry/Quaternion.h b/Eigen/src/Geometry/Quaternion.h index 2662d60fe..7d6be0799 100644 --- a/Eigen/src/Geometry/Quaternion.h +++ b/Eigen/src/Geometry/Quaternion.h @@ -185,7 +185,7 @@ public: return typename internal::cast_return_type<Derived,Quaternion<NewScalarType> >::type( coeffs().template cast<NewScalarType>()); } - + #ifdef EIGEN_QUATERNIONBASE_PLUGIN # include EIGEN_QUATERNIONBASE_PLUGIN #endif @@ -225,22 +225,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. */ @@ -274,6 +277,8 @@ public: 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; |