add quaternion Options, add unaligned possibility

This commit is contained in:
Christoph Hertzberg 2011-01-27 09:14:22 -05:00
parent 9ccd16609c
commit 0aa752fc4f
2 changed files with 19 additions and 11 deletions

View File

@ -220,7 +220,7 @@ template<typename Scalar> class JacobiRotation;
template<typename Derived, int _Dim> class RotationBase;
template<typename Lhs, typename Rhs> class Cross;
template<typename Derived> class QuaternionBase;
template<typename Scalar> class Quaternion;
template<typename Scalar, int Options = AutoAlign> class Quaternion;
template<typename Scalar> class Rotation2D;
template<typename Scalar> class AngleAxis;
template<typename Scalar,int Dim> class Translation;

View File

@ -215,28 +215,28 @@ public:
*/
namespace internal {
template<typename _Scalar>
struct traits<Quaternion<_Scalar> >
template<typename _Scalar,int _Options>
struct traits<Quaternion<_Scalar,_Options> >
{
typedef Quaternion<_Scalar> PlainObject;
typedef Quaternion<_Scalar,_Options> PlainObject;
typedef _Scalar Scalar;
typedef Matrix<_Scalar,4,1> Coefficients;
typedef Matrix<_Scalar,4,1,_Options> Coefficients;
enum{
PacketAccess = Aligned
PacketAccess = _Options & DontAlign ? Unaligned : Aligned
};
};
}
template<typename _Scalar>
class Quaternion : public QuaternionBase<Quaternion<_Scalar> >{
typedef QuaternionBase<Quaternion<_Scalar> > Base;
template<typename _Scalar, int _Options>
class Quaternion : public QuaternionBase<Quaternion<_Scalar,_Options> >{
typedef QuaternionBase<Quaternion<_Scalar,_Options> > Base;
public:
typedef _Scalar Scalar;
EIGEN_INHERIT_ASSIGNMENT_EQUAL_OPERATOR(Quaternion<Scalar>)
EIGEN_INHERIT_ASSIGNMENT_EQUAL_OPERATOR(Quaternion)
using Base::operator*=;
typedef typename internal::traits<Quaternion<Scalar> >::Coefficients Coefficients;
typedef typename internal::traits<Quaternion<Scalar,_Options> >::Coefficients Coefficients;
typedef typename Base::AngleAxisType AngleAxisType;
/** Default constructor leaving the quaternion uninitialized. */
@ -272,6 +272,14 @@ public:
protected:
Coefficients m_coeffs;
#ifndef EIGEN_PARSED_BY_DOXYGEN
EIGEN_STRONG_INLINE static void _check_template_params()
{
EIGEN_STATIC_ASSERT( (_Options & DontAlign) == _Options,
INVALID_MATRIX_TEMPLATE_PARAMETERS)
}
#endif
};
/** \ingroup Geometry_Module