aboutsummaryrefslogtreecommitdiffhomepage
path: root/Eigen
diff options
context:
space:
mode:
authorGravatar Christoph Hertzberg <chtz@informatik.uni-bremen.de>2011-01-27 09:14:22 -0500
committerGravatar Christoph Hertzberg <chtz@informatik.uni-bremen.de>2011-01-27 09:14:22 -0500
commit0aa752fc4fff4541c831ec7d4a12c566a71da56b (patch)
tree9975eddd8ed21db102b70b008199cd0705d1533b /Eigen
parent9ccd16609cc100c0749692e90b9ac353b3faf153 (diff)
add quaternion Options, add unaligned possibility
Diffstat (limited to 'Eigen')
-rw-r--r--Eigen/src/Core/util/ForwardDeclarations.h2
-rw-r--r--Eigen/src/Geometry/Quaternion.h28
2 files changed, 19 insertions, 11 deletions
diff --git a/Eigen/src/Core/util/ForwardDeclarations.h b/Eigen/src/Core/util/ForwardDeclarations.h
index a516a7094..1fdc55b0f 100644
--- a/Eigen/src/Core/util/ForwardDeclarations.h
+++ b/Eigen/src/Core/util/ForwardDeclarations.h
@@ -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;
diff --git a/Eigen/src/Geometry/Quaternion.h b/Eigen/src/Geometry/Quaternion.h
index d9b34a385..ecf839335 100644
--- a/Eigen/src/Geometry/Quaternion.h
+++ b/Eigen/src/Geometry/Quaternion.h
@@ -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