10#ifndef EIGEN_ANGLEAXIS_H
11#define EIGEN_ANGLEAXIS_H
14#include "./InternalHeaderCheck.h"
45template <
typename Scalar_>
46struct traits<AngleAxis<Scalar_> > {
47 typedef Scalar_ Scalar;
51template <
typename Scalar_>
56 using Base::operator*;
77 template <
typename Derived>
83 template <
typename QuatDerived>
88 template <
typename Derived>
99 EIGEN_DEVICE_FUNC
const Vector3&
axis()
const {
return m_axis; }
104 EIGEN_DEVICE_FUNC Vector3&
axis() {
return m_axis; }
108 return QuaternionType(*
this) * QuaternionType(other);
112 EIGEN_DEVICE_FUNC
inline QuaternionType
operator*(
const QuaternionType& other)
const {
113 return QuaternionType(*
this) * other;
117 friend EIGEN_DEVICE_FUNC
inline QuaternionType
operator*(
const QuaternionType& a,
const AngleAxis& b) {
118 return a * QuaternionType(b);
124 template <
class QuatDerived>
126 template <
typename Derived>
129 template <
typename Derived>
138 template <
typename NewScalarType>
139 EIGEN_DEVICE_FUNC
inline typename internal::cast_return_type<AngleAxis, AngleAxis<NewScalarType> >::type
cast()
141 return typename internal::cast_return_type<AngleAxis, AngleAxis<NewScalarType> >::type(*
this);
145 template <
typename OtherScalarType>
157 EIGEN_DEVICE_FUNC
bool isApprox(
const AngleAxis& other,
const typename NumTraits<Scalar>::Real& prec =
158 NumTraits<Scalar>::dummy_precision())
const {
159 return m_axis.isApprox(other.m_axis, prec) && internal::isApprox(m_angle, other.m_angle, prec);
176template <
typename Scalar>
177template <
typename QuatDerived>
179 EIGEN_USING_STD(
atan2)
182 if (n < NumTraits<Scalar>::epsilon()) n = q.
vec().stableNorm();
187 m_axis = q.
vec() / n;
197template <
typename Scalar>
198template <
typename Derived>
202 return *
this = QuaternionType(mat);
208template <
typename Scalar>
209template <
typename Derived>
211 return *
this = QuaternionType(mat);
216template <
typename Scalar>
221 Vector3 sin_axis =
sin(m_angle) * m_axis;
223 Vector3 cos1_axis = (
Scalar(1) - c) * m_axis;
226 tmp = cos1_axis.x() * m_axis.y();
227 res.
coeffRef(0, 1) = tmp - sin_axis.z();
228 res.
coeffRef(1, 0) = tmp + sin_axis.z();
230 tmp = cos1_axis.x() * m_axis.z();
231 res.
coeffRef(0, 2) = tmp + sin_axis.y();
232 res.
coeffRef(2, 0) = tmp - sin_axis.y();
234 tmp = cos1_axis.y() * m_axis.z();
235 res.
coeffRef(1, 2) = tmp - sin_axis.x();
236 res.
coeffRef(2, 1) = tmp + sin_axis.x();
238 res.diagonal() = (cos1_axis.cwiseProduct(m_axis)).array() + c;
Represents a 3D rotation as a rotation angle around an arbitrary 3D axis.
Definition AngleAxis.h:52
QuaternionType operator*(const QuaternionType &other) const
Definition AngleAxis.h:112
AngleAxis(const AngleAxis< OtherScalarType > &other)
Definition AngleAxis.h:146
Scalar_ Scalar
Definition AngleAxis.h:60
QuaternionType operator*(const AngleAxis &other) const
Definition AngleAxis.h:107
Scalar & angle()
Definition AngleAxis.h:96
Vector3 & axis()
Definition AngleAxis.h:104
AngleAxis(const QuaternionBase< QuatDerived > &q)
Definition AngleAxis.h:84
internal::cast_return_type< AngleAxis, AngleAxis< NewScalarType > >::type cast() const
Definition AngleAxis.h:139
AngleAxis(const Scalar &angle, const MatrixBase< Derived > &axis)
Definition AngleAxis.h:78
AngleAxis(const MatrixBase< Derived > &m)
Definition AngleAxis.h:89
AngleAxis inverse() const
Definition AngleAxis.h:122
const Vector3 & axis() const
Definition AngleAxis.h:99
AngleAxis()
Definition AngleAxis.h:71
bool isApprox(const AngleAxis &other, const typename NumTraits< Scalar >::Real &prec=NumTraits< Scalar >::dummy_precision()) const
Definition AngleAxis.h:157
friend QuaternionType operator*(const QuaternionType &a, const AngleAxis &b)
Definition AngleAxis.h:117
Matrix3 toRotationMatrix(void) const
Definition AngleAxis.h:217
Scalar angle() const
Definition AngleAxis.h:94
const std::enable_if_t< std::is_same< typename LhsDerived::Scalar, typename RhsDerived::Scalar >::value, Eigen::CwiseBinaryOp< Eigen::internal::scalar_atan2_op< typename LhsDerived::Scalar, typename RhsDerived::Scalar >, const LhsDerived, const RhsDerived > > atan2(const Eigen::ArrayBase< LhsDerived > &x, const Eigen::ArrayBase< RhsDerived > &exponents)
Definition GlobalFunctions.h:209
Base class for all dense matrices, vectors, and expressions.
Definition MatrixBase.h:52
The matrix class, also used for vectors and row-vectors.
Definition Matrix.h:186
constexpr Scalar & coeffRef(Index rowId, Index colId)
Definition PlainObjectBase.h:191
Base class for quaternion expressions.
Definition Quaternion.h:35
const VectorBlock< const Coefficients, 3 > vec() const
Definition Quaternion.h:78
constexpr CoeffReturnType w() const
Definition Quaternion.h:66
The quaternion class used to represent 3D orientations and rotations.
Definition Quaternion.h:308
Common base class for compact rotation representations.
Definition RotationBase.h:32
AngleAxis< float > AngleAxisf
Definition AngleAxis.h:165
AngleAxis< double > AngleAxisd
Definition AngleAxis.h:168
Namespace containing all symbols from the Eigen library.
Definition B01_Experimental.dox:1
const Eigen::CwiseUnaryOp< Eigen::internal::scalar_cos_op< typename Derived::Scalar >, const Derived > cos(const Eigen::ArrayBase< Derived > &x)
const Eigen::CwiseUnaryOp< Eigen::internal::scalar_abs_op< typename Derived::Scalar >, const Derived > abs(const Eigen::ArrayBase< Derived > &x)
const Eigen::CwiseUnaryOp< Eigen::internal::scalar_sin_op< typename Derived::Scalar >, const Derived > sin(const Eigen::ArrayBase< Derived > &x)