Go to the documentation of this file.
11 #ifndef EIGEN_QUATERNION_H
12 #define EIGEN_QUATERNION_H
22 template<
typename Other,
23 int OtherRows=Other::RowsAtCompileTime,
24 int OtherCols=Other::ColsAtCompileTime>
25 struct quaternionbase_assign_impl;
34 template<
class Derived>
35 class QuaternionBase :
public RotationBase<Derived, 3>
40 using Base::operator*;
147 template<
typename Derived1,
typename Derived2>
165 template<
class OtherDerived>
173 template<
class OtherDerived>
181 template<
class OtherDerived>
183 {
return coeffs().isApprox(
other.coeffs(), prec); }
188 #ifdef EIGEN_PARSED_BY_DOXYGEN
194 template<
typename NewScalarType>
199 template<
typename NewScalarType>
206 template<
typename NewScalarType>
216 s <<
q.x() <<
"i + " <<
q.y() <<
"j + " <<
q.z() <<
"k" <<
" + " <<
q.w();
221 #ifdef EIGEN_QUATERNIONBASE_PLUGIN
222 # include EIGEN_QUATERNIONBASE_PLUGIN
259 template<
typename _Scalar,
int _Options>
272 template<
typename _Scalar,
int _Options>
273 class Quaternion :
public QuaternionBase<Quaternion<_Scalar,_Options> >
282 using Base::operator*=;
312 template<
typename Derived>
316 template<
typename OtherScalar,
int OtherOptions>
320 #if EIGEN_HAS_RVALUE_REFERENCES
337 template<
typename Derived1,
typename Derived2>
345 #ifdef EIGEN_QUATERNION_PLUGIN
346 # include EIGEN_QUATERNION_PLUGIN
352 #ifndef EIGEN_PARSED_BY_DOXYGEN
356 INVALID_MATRIX_TEMPLATE_PARAMETERS)
373 template<
typename _Scalar,
int _Options>
374 struct traits<
Map<
Quaternion<_Scalar>, _Options> > : traits<Quaternion<_Scalar, (int(_Options)&Aligned)==Aligned ? AutoAlign : DontAlign> >
381 template<
typename _Scalar,
int _Options>
382 struct traits<
Map<const
Quaternion<_Scalar>, _Options> > :
traits<Quaternion<_Scalar, (int(_Options)&Aligned)==Aligned ? AutoAlign : DontAlign> >
403 template<
typename _Scalar,
int _Options>
405 :
public QuaternionBase<Map<const Quaternion<_Scalar>, _Options> >
413 using Base::operator*=;
440 template<
typename _Scalar,
int _Options>
450 using Base::operator*=;
487 template<
int Arch,
class Derived1,
class Derived2,
typename Scalar>
struct quat_product
492 a.w() *
b.w() -
a.x() *
b.x() -
a.y() *
b.y() -
a.z() *
b.z(),
493 a.w() *
b.x() +
a.x() *
b.w() +
a.y() *
b.z() -
a.z() *
b.y(),
494 a.w() *
b.y() +
a.y() *
b.w() +
a.z() *
b.x() -
a.x() *
b.z(),
495 a.w() *
b.z() +
a.z() *
b.w() +
a.x() *
b.y() -
a.y() *
b.x()
502 template <
class Derived>
503 template <
class OtherDerived>
508 YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY)
514 template <
class Derived>
515 template <
class OtherDerived>
518 derived() = derived() *
other.derived();
529 template <
class Derived>
540 return v + this->
w() * uv + this->vec().cross(uv);
543 template<
class Derived>
546 coeffs() =
other.coeffs();
550 template<
class Derived>
551 template<
class OtherDerived>
554 coeffs() =
other.coeffs();
560 template<
class Derived>
567 this->vec() =
sin(ha) * aa.
axis();
577 template<
class Derived>
578 template<
class MatrixDerived>
582 YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY)
590 template<
class Derived>
601 const Scalar ty =
Scalar(2)*this->
y();
602 const Scalar tz =
Scalar(2)*this->
z();
603 const Scalar twx = tx*this->
w();
604 const Scalar twy = ty*this->
w();
605 const Scalar twz = tz*this->
w();
606 const Scalar txx = tx*this->
x();
607 const Scalar txy = ty*this->
x();
608 const Scalar txz = tz*this->
x();
609 const Scalar tyy = ty*this->
y();
610 const Scalar tyz = tz*this->
y();
611 const Scalar tzz = tz*this->
z();
614 res.coeffRef(0,1) = txy-twz;
615 res.coeffRef(0,2) = txz+twy;
616 res.coeffRef(1,0) = txy+twz;
618 res.coeffRef(1,2) = tyz-twx;
619 res.coeffRef(2,0) = txz-twy;
620 res.coeffRef(2,1) = tyz+twx;
636 template<
class Derived>
637 template<
typename Derived1,
typename Derived2>
661 this->
w() =
sqrt(w2);
668 this->vec() = axis * invs;
678 template<
typename Scalar,
int Options>
684 const Scalar u1 = internal::random<Scalar>(0, 1),
686 u3 = internal::random<Scalar>(0, 2*
EIGEN_PI);
703 template<
typename Scalar,
int Options>
704 template<
typename Derived1,
typename Derived2>
708 quat.setFromTwoVectors(
a,
b);
719 template <
class Derived>
735 template<
int Arch,
class Derived,
typename Scalar>
struct quat_conj
749 template <
class Derived>
761 template <
class Derived>
762 template <
class OtherDerived>
779 template <
class Derived>
780 template <
class OtherDerived>
804 scale0 =
sin( (
Scalar(1) -
t ) * theta) / sinTheta;
805 scale1 =
sin( (
t * theta) ) / sinTheta;
807 if(
d<
Scalar(0)) scale1 = -scale1;
815 template<
typename Other>
831 q.x() = (
mat.coeff(2,1) -
mat.coeff(1,2)) *
t;
832 q.y() = (
mat.coeff(0,2) -
mat.coeff(2,0)) *
t;
833 q.z() = (
mat.coeff(1,0) -
mat.coeff(0,1)) *
t;
838 if (
mat.coeff(1,1) >
mat.coeff(0,0))
840 if (
mat.coeff(2,2) >
mat.coeff(
i,
i))
846 q.coeffs().coeffRef(
i) =
Scalar(0.5) *
t;
850 q.coeffs().coeffRef(k) = (
mat.coeff(k,
i)+
mat.coeff(
i,k))*
t;
856 template<
typename Other>
870 #endif // EIGEN_QUATERNION_H
friend std::ostream & operator<<(std::ostream &s, const QuaternionBase< Derived > &q)
#define EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF(NeedsToAlign)
QuaternionBase< Map< Quaternion< _Scalar >, _Options > > Base
EIGEN_DEVICE_FUNC Quaternion(const Quaternion< OtherScalar, OtherOptions > &other)
Eigen::Quaternion< double, Eigen::DontAlign > Quaternion
#define EIGEN_DEVICE_FUNC
internal::traits< Quaternion >::Coefficients Coefficients
Namespace containing all symbols from the Eigen library.
EIGEN_DEVICE_FUNC Coefficients & coeffs()
static EIGEN_DEVICE_FUNC void run(QuaternionBase< Derived > &q, const Other &a_mat)
EIGEN_DEVICE_FUNC Quaternion(const MatrixBase< Derived > &other)
const AutoDiffScalar< Matrix< typename internal::traits< typename internal::remove_all< DerTypeA >::type >::Scalar, Dynamic, 1 > > atan2(const AutoDiffScalar< DerTypeA > &a, const AutoDiffScalar< DerTypeB > &b)
const EIGEN_DEVICE_FUNC Coefficients & coeffs() const
#define EIGEN_USING_STD(FUNC)
static const double d[K][N]
#define EIGEN_DEFAULT_EMPTY_CONSTRUCTOR_AND_DESTRUCTOR(Derived)
Jet< T, N > sin(const Jet< T, N > &f)
static EIGEN_DEVICE_FUNC Quaternion FromTwoVectors(const MatrixBase< Derived1 > &a, const MatrixBase< Derived2 > &b)
Map< Quaternion< float >, Aligned > QuaternionMapAlignedf
static EIGEN_DEVICE_FUNC void run(QuaternionBase< Derived > &q, const Other &vec)
set noclip points set clip one set noclip two set bar set border lt lw set xdata set ydata set zdata set x2data set y2data set boxwidth set dummy x
EIGEN_DEVICE_FUNC Matrix3 toRotationMatrix() const
EIGEN_DEVICE_FUNC internal::enable_if< internal::is_same< Scalar, NewScalarType >::value, const Derived & >::type cast() const
Represents a 3D rotation as a rotation angle around an arbitrary 3D axis.
const EIGEN_DEVICE_FUNC Derived & derived() const
EIGEN_DEVICE_FUNC Scalar dot(const QuaternionBase< OtherDerived > &other) const
Map< Quaternion< double >, 0 > QuaternionMapd
Coefficients::CoeffReturnType CoeffReturnType
EIGEN_DEVICE_FUNC Quaternion(const Scalar &w, const Scalar &x, const Scalar &y, const Scalar &z)
QuaternionBase< Quaternion< _Scalar, _Options > > Base
EIGEN_DEVICE_FUNC Quaternion< Scalar > inverse() const
EIGEN_DEVICE_FUNC NonConstCoeffReturnType x()
cout<< "Here is the matrix m:"<< endl<< m<< endl;Matrix< ptrdiff_t, 3, 1 > res
EIGEN_DEVICE_FUNC Quaternion< Scalar > slerp(const Scalar &t, const QuaternionBase< OtherDerived > &other) const
cout<< "Here is the matrix m:"<< endl<< m<< endl;JacobiSVD< MatrixXf > svd(m, ComputeThinU|ComputeThinV)
Jet< T, N > acos(const Jet< T, N > &f)
Jet< T, N > cos(const Jet< T, N > &f)
EIGEN_DEVICE_FUNC Scalar angle() const
Scalar EIGEN_BLAS_FUNC() dot(int *n, RealScalar *px, int *incx, RealScalar *py, int *incy)
AngleAxis< Scalar > AngleAxisType
EIGEN_DEVICE_FUNC bool isApprox(const QuaternionBase< OtherDerived > &other, const RealScalar &prec=NumTraits< Scalar >::dummy_precision()) const
EIGEN_DEVICE_FUNC QuaternionBase & setIdentity()
EIGEN_DEVICE_FUNC CoeffReturnType y() const
EIGEN_DEVICE_FUNC internal::enable_if<!internal::is_same< Scalar, NewScalarType >::value, Quaternion< NewScalarType > >::type cast() const
const Coefficients m_coeffs
internal::conditional< bool(internal::traits< Derived >::Flags &LvalueBit), Scalar &, CoeffReturnType >::type NonConstCoeffReturnType
EIGEN_DEVICE_FUNC Quaternion()
const unsigned int LvalueBit
EIGEN_DEVICE_FUNC const Scalar & q
internal::traits< Derived >::Coefficients Coefficients
static EIGEN_DEVICE_FUNC Quaternion UnitRandom()
const EIGEN_DEVICE_FUNC Coefficients & coeffs() const
Common base class for compact rotation representations.
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Vector3 _transformVector(const Vector3 &v) const
#define EIGEN_STRONG_INLINE
EIGEN_DEVICE_FUNC Scalar norm() const
const EIGEN_DEVICE_FUNC internal::traits< Derived >::Coefficients & coeffs() const
Quaternion< float > Quaternionf
const EIGEN_DEVICE_FUNC Coefficients & coeffs() const
EIGEN_DEVICE_FUNC CoeffReturnType z() const
Quaternion< double > Quaterniond
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Map(Scalar *coeffs)
EIGEN_DEVICE_FUNC Scalar squaredNorm() const
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar & coeffRef(Index rowId, Index colId)
EIGEN_DEVICE_FUNC bool operator==(const QuaternionBase< OtherDerived > &other) const
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Quaternion< Scalar > run(const QuaternionBase< Derived > &q)
static EIGEN_STRONG_INLINE void _check_template_params()
Map< const Matrix< _Scalar, 4, 1 >, _Options > Coefficients
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Map(const Scalar *coeffs)
A matrix or vector expression mapping an existing array of data.
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE QuaternionBase< Derived > & operator=(const QuaternionBase< Derived > &other)
#define EIGEN_DEFAULT_COPY_CONSTRUCTOR(CLASS)
EIGEN_DEVICE_FUNC internal::traits< Derived >::Coefficients & coeffs()
EIGEN_DEVICE_FUNC Quaternion< Scalar > conjugate() const
EIGEN_DEVICE_FUNC Coefficients & coeffs()
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Quaternion< Scalar > run(const QuaternionBase< Derived1 > &a, const QuaternionBase< Derived2 > &b)
EIGEN_DEVICE_FUNC ConjugateReturnType conjugate() const
Two-sided Jacobi SVD decomposition of a rectangular matrix.
internal::traits< Derived >::Scalar Scalar
const EIGEN_DEVICE_FUNC Vector3 & axis() const
The quaternion class used to represent 3D orientations and rotations.
detail::enable_if_t<!detail::move_never< T >::value, T > move(object &&obj)
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived & operator*=(const QuaternionBase< OtherDerived > &q)
Matrix< Scalar, 3, 1 > Vector3
Matrix< Scalar, 3, 3 > Matrix3
#define EIGEN_STATIC_ASSERT(CONDITION, MSG)
Map< Quaternion< float >, 0 > QuaternionMapf
Quaternion< _Scalar, _Options > PlainObject
RotationBase< Derived, 3 > Base
Matrix< _Scalar, 4, 1, _Options > Coefficients
EIGEN_DEVICE_FUNC Derived & setFromTwoVectors(const MatrixBase< Derived1 > &a, const MatrixBase< Derived2 > &b)
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Quaternion(const QuaternionBase< Derived > &other)
Expression of a fixed-size or dynamic-size sub-vector.
EIGEN_DEVICE_FUNC bool operator!=(const QuaternionBase< OtherDerived > &other) const
Array< int, Dynamic, 1 > v
EIGEN_DEVICE_FUNC Quaternion< Scalar > normalized() const
QuaternionBase< Map< const Quaternion< _Scalar >, _Options > > Base
EIGEN_DEVICE_FUNC Scalar angularDistance(const QuaternionBase< OtherDerived > &other) const
EIGEN_DEVICE_FUNC NonConstCoeffReturnType y()
EIGEN_DEVICE_FUNC void normalize()
EIGEN_DEVICE_FUNC NonConstCoeffReturnType w()
const EIGEN_DEVICE_FUNC VectorBlock< const Coefficients, 3 > vec() const
EIGEN_DEVICE_FUNC NonConstCoeffReturnType z()
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE internal::enable_if< NumTraits< T >::IsSigned||NumTraits< T >::IsComplex, typename NumTraits< T >::Real >::type abs(const T &x)
EIGEN_DEVICE_FUNC VectorBlock< Coefficients, 3 > vec()
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE T maxi(const T &x, const T &y)
NumTraits< Scalar >::Real RealScalar
Base class for all dense matrices, vectors, and expressions.
EIGEN_DEVICE_FUNC CoeffReturnType w() const
internal::traits< Map >::Coefficients Coefficients
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Quaternion< Scalar > operator*(const QuaternionBase< OtherDerived > &q) const
EIGEN_DEVICE_FUNC Quaternion(const AngleAxisType &aa)
#define EIGEN_NOEXCEPT_IF(x)
EIGEN_DEVICE_FUNC Quaternion(const Scalar *data)
internal::traits< Map >::Coefficients Coefficients
static EIGEN_DEVICE_FUNC Quaternion< Scalar > Identity()
Base::AngleAxisType AngleAxisType
Map< Quaternion< double >, Aligned > QuaternionMapAlignedd
#define EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Derived)
Base class for quaternion expressions.
Holds information about the various numeric (i.e. scalar) types allowed by Eigen.
EIGEN_DEVICE_FUNC CoeffReturnType x() const
Jet< T, N > sqrt(const Jet< T, N > &f)
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
gtsam
Author(s):
autogenerated on Sat Nov 16 2024 04:03:54