10 #ifndef EIGEN_ANGLEAXIS_H 11 #define EIGEN_ANGLEAXIS_H 48 template<
typename _Scalar>
55 using Base::operator*;
78 template<
typename Derived>
83 template<
typename Derived>
86 Scalar
angle()
const {
return m_angle; }
87 Scalar&
angle() {
return m_angle; }
89 const Vector3&
axis()
const {
return m_axis; }
90 Vector3&
axis() {
return m_axis; }
94 {
return QuaternionType(*
this) * QuaternionType(other); }
97 inline QuaternionType
operator* (
const QuaternionType& other)
const 98 {
return QuaternionType(*
this) * other; }
102 {
return a * QuaternionType(b); }
108 template<
class QuatDerived>
110 template<
typename Derived>
113 template<
typename Derived>
122 template<
typename NewScalarType>
127 template<
typename OtherScalarType>
130 m_axis = other.
axis().template cast<Scalar>();
131 m_angle = Scalar(other.
angle());
157 template<
typename Scalar>
158 template<
typename QuatDerived>
165 Scalar n2 = q.
vec().squaredNorm();
173 m_angle = Scalar(2)*
acos((min)((max)(Scalar(-1),q.
w()),Scalar(1)));
181 template<
typename Scalar>
182 template<
typename Derived>
187 return *
this = QuaternionType(mat);
193 template<
typename Scalar>
194 template<
typename Derived>
197 return *
this = QuaternionType(mat);
202 template<
typename Scalar>
209 Vector3 sin_axis =
sin(m_angle) * m_axis;
210 Scalar c =
cos(m_angle);
211 Vector3 cos1_axis = (Scalar(1)-c) * m_axis;
214 tmp = cos1_axis.x() * m_axis.y();
215 res.
coeffRef(0,1) = tmp - sin_axis.z();
216 res.
coeffRef(1,0) = tmp + sin_axis.z();
218 tmp = cos1_axis.x() * m_axis.z();
219 res.
coeffRef(0,2) = tmp + sin_axis.y();
220 res.
coeffRef(2,0) = tmp - sin_axis.y();
222 tmp = cos1_axis.y() * m_axis.z();
223 res.
coeffRef(1,2) = tmp - sin_axis.x();
224 res.
coeffRef(2,1) = tmp + sin_axis.x();
226 res.diagonal() = (cos1_axis.cwiseProduct(m_axis)).array() + c;
233 #endif // EIGEN_ANGLEAXIS_H AngleAxis< float > AngleAxisf
USING_NAMESPACE_ACADO IntermediateState sin(const Expression &arg)
IntermediateState sqrt(const Expression &arg)
AngleAxis(const Scalar &angle, const MatrixBase< Derived > &axis)
static Matrix< Scalar, 2, 2 > toRotationMatrix(const Scalar &s)
AngleAxis & operator=(const QuaternionType &q)
AngleAxis & fromRotationMatrix(const MatrixBase< Derived > &m)
Matrix< Scalar, 3, 3 > Matrix3
iterative scaling algorithm to equilibrate rows and column norms in matrices
const VectorBlock< const Coefficients, 3 > vec() const
Holds information about the various numeric (i.e. scalar) types allowed by Eigen. ...
const internal::permut_matrix_product_retval< PermutationDerived, Derived, OnTheRight > operator*(const MatrixBase< Derived > &matrix, const PermutationBase< PermutationDerived > &permutation)
static const AngleAxis Identity()
const Vector3 & axis() const
IntermediateState cos(const Expression &arg)
bool isApprox(const AngleAxis &other, const typename NumTraits< Scalar >::Real &prec=NumTraits< Scalar >::dummy_precision()) const
AngleAxis< double > AngleAxisd
internal::cast_return_type< AngleAxis, AngleAxis< NewScalarType > >::type cast() const
IntermediateState acos(const Expression &arg)
AngleAxis inverse() const
EIGEN_STRONG_INLINE Scalar & coeffRef(Index rowId, Index colId)
bool isApprox(const Scalar &x, const Scalar &y, typename NumTraits< Scalar >::Real precision=NumTraits< Scalar >::dummy_precision())
Common base class for compact rotation representations.
Base class for quaternion expressions.
Matrix< Scalar, 3, 1 > Vector3
Matrix3 toRotationMatrix(void) const
The quaternion class used to represent 3D orientations and rotations.
Quaternion< Scalar > QuaternionType
AngleAxis(const AngleAxis< OtherScalarType > &other)
The matrix class, also used for vectors and row-vectors.
AngleAxis(const QuaternionBase< QuatDerived > &q)
AngleAxis(const MatrixBase< Derived > &m)
Base class for all dense matrices, vectors, and expressions.
Represents a 3D rotation as a rotation angle around an arbitrary 3D axis.
RotationBase< AngleAxis< _Scalar >, 3 > Base