45 template<
typename _Scalar>
52 using Base::operator*;
72 template<
typename Derived>
75 inline AngleAxis(
const QuaternionType& q) { *
this = q; }
77 template<
typename Derived>
80 Scalar angle()
const {
return m_angle; }
81 Scalar& angle() {
return m_angle; }
83 const Vector3& axis()
const {
return m_axis; }
84 Vector3& axis() {
return m_axis; }
88 {
return QuaternionType(*
this) * QuaternionType(other); }
91 inline QuaternionType
operator* (
const QuaternionType& other)
const 92 {
return QuaternionType(*
this) * other; }
96 {
return a * QuaternionType(b); }
99 inline Matrix3
operator* (
const Matrix3& other)
const 100 {
return toRotationMatrix() * other; }
108 {
return toRotationMatrix() * other; }
114 AngleAxis& operator=(
const QuaternionType& q);
115 template<
typename Derived>
118 template<
typename Derived>
120 Matrix3 toRotationMatrix(
void)
const;
127 template<
typename NewScalarType>
132 template<
typename OtherScalarType>
135 m_axis = other.axis().template cast<Scalar>();
136 m_angle =
Scalar(other.angle());
144 {
return m_axis.isApprox(other.m_axis, prec) && ei_isApprox(m_angle,other.m_angle, prec); }
157 template<
typename Scalar>
160 Scalar n2 = q.
vec().squaredNorm();
161 if (n2 < precision<Scalar>()*precision<Scalar>())
168 m_angle = 2*std::acos(q.
w());
169 m_axis = q.
vec() / ei_sqrt(n2);
176 template<
typename Scalar>
177 template<
typename Derived>
182 return *
this = QuaternionType(mat);
187 template<
typename Scalar>
192 Vector3 sin_axis = ei_sin(m_angle) * m_axis;
193 Scalar c = ei_cos(m_angle);
194 Vector3 cos1_axis = (
Scalar(1)-c) * m_axis;
197 tmp = cos1_axis.x() * m_axis.y();
198 res.coeffRef(0,1) = tmp - sin_axis.z();
199 res.coeffRef(1,0) = tmp + sin_axis.z();
201 tmp = cos1_axis.x() * m_axis.z();
202 res.coeffRef(0,2) = tmp + sin_axis.y();
203 res.coeffRef(2,0) = tmp - sin_axis.y();
205 tmp = cos1_axis.y() * m_axis.z();
206 res.coeffRef(1,2) = tmp - sin_axis.x();
207 res.coeffRef(2,1) = tmp + sin_axis.x();
209 res.diagonal() = (cos1_axis.cwise() * m_axis).cwise() + c;
AngleAxis< float > AngleAxisf
single precision angle-axis type
Definition: AngleAxis.h:149
Definition: gtest_unittest.cc:5031
Definition: XprHelper.h:393
AngleAxis & operator=(const QuaternionType &q)
Set *this from a quaternion.
Definition: AngleAxis.h:158
AngleAxis inverse() const
Definition: AngleAxis.h:111
bool isApprox(const AngleAxis &other, typename NumTraits< Scalar >::Real prec=precision< Scalar >()) const
Definition: AngleAxis.h:143
internal::cast_return_type< AngleAxis, AngleAxis< NewScalarType > >::type cast() const
Definition: AngleAxis.h:128
iterative scaling algorithm to equilibrate rows and column norms in matrices
Definition: TestIMU_Common.h:87
Holds information about the various numeric (i.e.
Definition: NumTraits.h:88
const internal::permut_matrix_product_retval< PermutationDerived, Derived, OnTheRight > operator*(const MatrixBase< Derived > &matrix, const PermutationBase< PermutationDerived > &permutation)
Definition: PermutationMatrix.h:539
const Block< const Coefficients, 3, 1 > vec() const
Definition: Quaternion.h:87
AngleAxis(const QuaternionType &q)
Constructs and initialize the angle-axis rotation from a quaternion q.
Definition: AngleAxis.h:75
AngleAxis(Scalar angle, const MatrixBase< Derived > &axis)
Constructs and initialize the angle-axis rotation from an angle in radian and an axis which must be n...
Definition: AngleAxis.h:73
AngleAxis< double > AngleAxisd
double precision angle-axis type
Definition: AngleAxis.h:152
AngleAxis()
Default constructor without initialization.
Definition: AngleAxis.h:69
Common base class for compact rotation representations.
Definition: ForwardDeclarations.h:231
_Scalar Scalar
the scalar type of the coefficients
Definition: AngleAxis.h:56
Scalar w() const
Definition: Quaternion.h:75
Definition: Quaternion.h:47
AngleAxis(const AngleAxis< OtherScalarType > &other)
Copy constructor with scalar type conversion.
Definition: AngleAxis.h:133
The matrix class, also used for vectors and row-vectors.
Definition: Matrix.h:127
AngleAxis(const MatrixBase< Derived > &m)
Constructs and initialize the angle-axis rotation from a 3x3 rotation matrix.
Definition: AngleAxis.h:78
Base class for all dense matrices, vectors, and expressions.
Definition: MatrixBase.h:48
Definition: ForwardDeclarations.h:235
Matrix3 toRotationMatrix(void) const
Constructs and.
Definition: AngleAxis.h:189
double Scalar
Common scalar type.
Definition: FlexibleKalmanBase.h:48