10#ifndef EIGEN_ANGLEAXIS_H
11#define EIGEN_ANGLEAXIS_H
42template<
typename _Scalar>
struct traits<AngleAxis<_Scalar> >
44 typedef _Scalar Scalar;
48template<
typename _Scalar>
55 using Base::operator*;
78 template<
typename Derived>
83 template<
typename Derived>
92 const Vector3&
axis()
const {
return m_axis; }
97 Vector3&
axis() {
return m_axis; }
101 {
return QuaternionType(*
this) * QuaternionType(other); }
104 inline QuaternionType
operator* (
const QuaternionType& other)
const
105 {
return QuaternionType(*
this) * other; }
109 {
return a * QuaternionType(b); }
115 template<
class QuatDerived>
117 template<
typename Derived>
120 template<
typename Derived>
129 template<
typename NewScalarType>
130 inline typename internal::cast_return_type<AngleAxis,AngleAxis<NewScalarType> >::type
cast()
const
131 {
return typename internal::cast_return_type<AngleAxis,AngleAxis<NewScalarType> >::type(*
this); }
134 template<
typename OtherScalarType>
147 bool isApprox(
const AngleAxis& other,
const typename NumTraits<Scalar>::Real& prec = NumTraits<Scalar>::dummy_precision())
const
148 {
return m_axis.isApprox(other.m_axis, prec) && internal::isApprox(m_angle,other.m_angle, prec); }
164template<
typename Scalar>
165template<
typename QuatDerived>
173 if (n2 < NumTraits<Scalar>::dummy_precision()*NumTraits<Scalar>::dummy_precision())
181 m_axis = q.
vec() / sqrt(n2);
188template<
typename Scalar>
189template<
typename Derived>
194 return *
this = QuaternionType(mat);
200template<
typename Scalar>
201template<
typename Derived>
204 return *
this = QuaternionType(mat);
209template<
typename Scalar>
210typename AngleAxis<Scalar>::Matrix3
216 Vector3 sin_axis = sin(m_angle) * m_axis;
218 Vector3 cos1_axis = (
Scalar(1)-c) * m_axis;
221 tmp = cos1_axis.x() * m_axis.y();
222 res.coeffRef(0,1) = tmp - sin_axis.z();
223 res.coeffRef(1,0) = tmp + sin_axis.z();
225 tmp = cos1_axis.x() * m_axis.z();
226 res.coeffRef(0,2) = tmp + sin_axis.y();
227 res.coeffRef(2,0) = tmp - sin_axis.y();
229 tmp = cos1_axis.y() * m_axis.z();
230 res.coeffRef(1,2) = tmp - sin_axis.x();
231 res.coeffRef(2,1) = tmp + sin_axis.x();
Represents a 3D rotation as a rotation angle around an arbitrary 3D axis.
Definition AngleAxis.h:50
Matrix3 toRotationMatrix(void) const
Definition AngleAxis.h:211
AngleAxis()
Definition AngleAxis.h:72
AngleAxis(const MatrixBase< Derived > &m)
Definition AngleAxis.h:84
bool isApprox(const AngleAxis &other, const typename NumTraits< Scalar >::Real &prec=NumTraits< Scalar >::dummy_precision()) const
Definition AngleAxis.h:147
internal::cast_return_type< AngleAxis, AngleAxis< NewScalarType > >::type cast() const
Definition AngleAxis.h:130
QuaternionType operator*(const AngleAxis &other) const
Definition AngleAxis.h:100
Scalar angle() const
Definition AngleAxis.h:87
Scalar & angle()
Definition AngleAxis.h:89
AngleAxis(const QuaternionBase< QuatDerived > &q)
Definition AngleAxis.h:81
const Vector3 & axis() const
Definition AngleAxis.h:92
Vector3 & axis()
Definition AngleAxis.h:97
AngleAxis inverse() const
Definition AngleAxis.h:112
AngleAxis(const AngleAxis< OtherScalarType > &other)
Definition AngleAxis.h:135
_Scalar Scalar
Definition AngleAxis.h:59
AngleAxis(const Scalar &angle, const MatrixBase< Derived > &axis)
Definition AngleAxis.h:79
Base class for all dense matrices, vectors, and expressions.
Definition MatrixBase.h:50
const CwiseBinaryOp< internal::scalar_product_op< typename Matrix< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols > ::Scalar, typename OtherDerived ::Scalar >, const Matrix< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols >, const OtherDerived > cwiseProduct(const Eigen::MatrixBase< OtherDerived > &other) const
Definition MatrixBase.h:23
static const BasisReturnType UnitX()
Definition CwiseNullaryOp.h:829
MatrixBase< Matrix< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols > >::template DiagonalIndexReturnType< Index >::Type diagonal()
Definition Diagonal.h:221
The matrix class, also used for vectors and row-vectors.
Definition Matrix.h:129
Base class for quaternion expressions.
Definition Quaternion.h:36
Scalar w() const
Definition Quaternion.h:66
const VectorBlock< const Coefficients, 3 > vec() const
Definition Quaternion.h:78
The quaternion class used to represent 3D orientations and rotations.
Definition Quaternion.h:227
Common base class for compact rotation representations.
Definition RotationBase.h:30
AngleAxis< double > AngleAxisd
Definition AngleAxis.h:156
AngleAxis< float > AngleAxisf
Definition AngleAxis.h:153