Geometry/Quaternion.h
Go to the documentation of this file.
1 // This file is part of Eigen, a lightweight C++ template library
2 // for linear algebra.
3 //
4 // Copyright (C) 2008-2010 Gael Guennebaud <gael.guennebaud@inria.fr>
5 // Copyright (C) 2009 Mathieu Gautier <mathieu.gautier@cea.fr>
6 //
7 // This Source Code Form is subject to the terms of the Mozilla
8 // Public License v. 2.0. If a copy of the MPL was not distributed
9 // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
10 
11 #ifndef EIGEN_QUATERNION_H
12 #define EIGEN_QUATERNION_H
13 namespace Eigen {
14 
15 
16 /***************************************************************************
17 * Definition of QuaternionBase<Derived>
18 * The implementation is at the end of the file
19 ***************************************************************************/
20 
21 namespace internal {
22 template<typename Other,
23  int OtherRows=Other::RowsAtCompileTime,
24  int OtherCols=Other::ColsAtCompileTime>
26 }
27 
34 template<class Derived>
35 class QuaternionBase : public RotationBase<Derived, 3>
36 {
38 public:
39  using Base::operator*;
40  using Base::derived;
41 
45  enum {
47  };
48 
49  // typedef typename Matrix<Scalar,4,1> Coefficients;
56 
57 
58 
60  inline Scalar x() const { return this->derived().coeffs().coeff(0); }
62  inline Scalar y() const { return this->derived().coeffs().coeff(1); }
64  inline Scalar z() const { return this->derived().coeffs().coeff(2); }
66  inline Scalar w() const { return this->derived().coeffs().coeff(3); }
67 
69  inline Scalar& x() { return this->derived().coeffs().coeffRef(0); }
71  inline Scalar& y() { return this->derived().coeffs().coeffRef(1); }
73  inline Scalar& z() { return this->derived().coeffs().coeffRef(2); }
75  inline Scalar& w() { return this->derived().coeffs().coeffRef(3); }
76 
78  inline const VectorBlock<const Coefficients,3> vec() const { return coeffs().template head<3>(); }
79 
81  inline VectorBlock<Coefficients,3> vec() { return coeffs().template head<3>(); }
82 
84  inline const typename internal::traits<Derived>::Coefficients& coeffs() const { return derived().coeffs(); }
85 
87  inline typename internal::traits<Derived>::Coefficients& coeffs() { return derived().coeffs(); }
88 
90  template<class OtherDerived> EIGEN_STRONG_INLINE Derived& operator=(const QuaternionBase<OtherDerived>& other);
91 
92 // disabled this copy operator as it is giving very strange compilation errors when compiling
93 // test_stdvector with GCC 4.4.2. This looks like a GCC bug though, so feel free to re-enable it if it's
94 // useful; however notice that we already have the templated operator= above and e.g. in MatrixBase
95 // we didn't have to add, in addition to templated operator=, such a non-templated copy operator.
96 // Derived& operator=(const QuaternionBase& other)
97 // { return operator=<Derived>(other); }
98 
99  Derived& operator=(const AngleAxisType& aa);
100  template<class OtherDerived> Derived& operator=(const MatrixBase<OtherDerived>& m);
101 
105  static inline Quaternion<Scalar> Identity() { return Quaternion<Scalar>(1, 0, 0, 0); }
106 
109  inline QuaternionBase& setIdentity() { coeffs() << 0, 0, 0, 1; return *this; }
110 
114  inline Scalar squaredNorm() const { return coeffs().squaredNorm(); }
115 
119  inline Scalar norm() const { return coeffs().norm(); }
120 
123  inline void normalize() { coeffs().normalize(); }
126  inline Quaternion<Scalar> normalized() const { return Quaternion<Scalar>(coeffs().normalized()); }
127 
133  template<class OtherDerived> inline Scalar dot(const QuaternionBase<OtherDerived>& other) const { return coeffs().dot(other.coeffs()); }
134 
135  template<class OtherDerived> Scalar angularDistance(const QuaternionBase<OtherDerived>& other) const;
136 
138  Matrix3 toRotationMatrix() const;
139 
141  template<typename Derived1, typename Derived2>
142  Derived& setFromTwoVectors(const MatrixBase<Derived1>& a, const MatrixBase<Derived2>& b);
143 
144  template<class OtherDerived> EIGEN_STRONG_INLINE Quaternion<Scalar> operator* (const QuaternionBase<OtherDerived>& q) const;
145  template<class OtherDerived> EIGEN_STRONG_INLINE Derived& operator*= (const QuaternionBase<OtherDerived>& q);
146 
148  Quaternion<Scalar> inverse() const;
149 
152 
157  template<class OtherDerived> Quaternion<Scalar> slerp(const Scalar& t, const QuaternionBase<OtherDerived>& other) const;
158 
163  template<class OtherDerived>
164  bool isApprox(const QuaternionBase<OtherDerived>& other, const RealScalar& prec = NumTraits<Scalar>::dummy_precision()) const
165  { return coeffs().isApprox(other.coeffs(), prec); }
166 
168  EIGEN_STRONG_INLINE Vector3 _transformVector(Vector3 v) const;
169 
175  template<typename NewScalarType>
177  {
178  return typename internal::cast_return_type<Derived,Quaternion<NewScalarType> >::type(derived());
179  }
180 
181 #ifdef EIGEN_QUATERNIONBASE_PLUGIN
182 # include EIGEN_QUATERNIONBASE_PLUGIN
183 #endif
184 };
185 
186 /***************************************************************************
187 * Definition/implementation of Quaternion<Scalar>
188 ***************************************************************************/
189 
213 namespace internal {
214 template<typename _Scalar,int _Options>
215 struct traits<Quaternion<_Scalar,_Options> >
216 {
218  typedef _Scalar Scalar;
220  enum{
222  Flags = IsAligned ? (AlignedBit | LvalueBit) : LvalueBit
223  };
224 };
225 }
226 
227 template<typename _Scalar, int _Options>
228 class Quaternion : public QuaternionBase<Quaternion<_Scalar,_Options> >
229 {
232 
233 public:
234  typedef _Scalar Scalar;
235 
237  using Base::operator*=;
238 
239  typedef typename internal::traits<Quaternion>::Coefficients Coefficients;
240  typedef typename Base::AngleAxisType AngleAxisType;
241 
243  inline Quaternion() {}
244 
252  inline Quaternion(const Scalar& w, const Scalar& x, const Scalar& y, const Scalar& z) : m_coeffs(x, y, z, w){}
253 
255  inline Quaternion(const Scalar* data) : m_coeffs(data) {}
256 
258  template<class Derived> EIGEN_STRONG_INLINE Quaternion(const QuaternionBase<Derived>& other) { this->Base::operator=(other); }
259 
261  explicit inline Quaternion(const AngleAxisType& aa) { *this = aa; }
262 
267  template<typename Derived>
268  explicit inline Quaternion(const MatrixBase<Derived>& other) { *this = other; }
269 
271  template<typename OtherScalar, int OtherOptions>
272  explicit inline Quaternion(const Quaternion<OtherScalar, OtherOptions>& other)
273  { m_coeffs = other.coeffs().template cast<Scalar>(); }
274 
275  template<typename Derived1, typename Derived2>
276  static Quaternion FromTwoVectors(const MatrixBase<Derived1>& a, const MatrixBase<Derived2>& b);
277 
278  inline Coefficients& coeffs() { return m_coeffs;}
279  inline const Coefficients& coeffs() const { return m_coeffs;}
280 
282 
283 protected:
284  Coefficients m_coeffs;
285 
286 #ifndef EIGEN_PARSED_BY_DOXYGEN
288  {
289  EIGEN_STATIC_ASSERT( (_Options & DontAlign) == _Options,
290  INVALID_MATRIX_TEMPLATE_PARAMETERS)
291  }
292 #endif
293 };
294 
301 
302 /***************************************************************************
303 * Specialization of Map<Quaternion<Scalar>>
304 ***************************************************************************/
305 
306 namespace internal {
307  template<typename _Scalar, int _Options>
308  struct traits<Map<Quaternion<_Scalar>, _Options> > : traits<Quaternion<_Scalar, (int(_Options)&Aligned)==Aligned ? AutoAlign : DontAlign> >
309  {
311  };
312 }
313 
314 namespace internal {
315  template<typename _Scalar, int _Options>
316  struct traits<Map<const Quaternion<_Scalar>, _Options> > : traits<Quaternion<_Scalar, (int(_Options)&Aligned)==Aligned ? AutoAlign : DontAlign> >
317  {
320  enum {
321  Flags = TraitsBase::Flags & ~LvalueBit
322  };
323  };
324 }
325 
337 template<typename _Scalar, int _Options>
338 class Map<const Quaternion<_Scalar>, _Options >
339  : public QuaternionBase<Map<const Quaternion<_Scalar>, _Options> >
340 {
342 
343  public:
344  typedef _Scalar Scalar;
347  using Base::operator*=;
348 
355  EIGEN_STRONG_INLINE Map(const Scalar* coeffs) : m_coeffs(coeffs) {}
356 
357  inline const Coefficients& coeffs() const { return m_coeffs;}
358 
359  protected:
360  const Coefficients m_coeffs;
361 };
362 
374 template<typename _Scalar, int _Options>
375 class Map<Quaternion<_Scalar>, _Options >
376  : public QuaternionBase<Map<Quaternion<_Scalar>, _Options> >
377 {
379 
380  public:
381  typedef _Scalar Scalar;
384  using Base::operator*=;
385 
392  EIGEN_STRONG_INLINE Map(Scalar* coeffs) : m_coeffs(coeffs) {}
393 
394  inline Coefficients& coeffs() { return m_coeffs; }
395  inline const Coefficients& coeffs() const { return m_coeffs; }
396 
397  protected:
398  Coefficients m_coeffs;
399 };
400 
409 typedef Map<Quaternion<float>, Aligned> QuaternionMapAlignedf;
412 typedef Map<Quaternion<double>, Aligned> QuaternionMapAlignedd;
413 
414 /***************************************************************************
415 * Implementation of QuaternionBase methods
416 ***************************************************************************/
417 
418 // Generic Quaternion * Quaternion product
419 // This product can be specialized for a given architecture via the Arch template argument.
420 namespace internal {
421 template<int Arch, class Derived1, class Derived2, typename Scalar, int _Options> struct quat_product
422 {
424  return Quaternion<Scalar>
425  (
426  a.w() * b.w() - a.x() * b.x() - a.y() * b.y() - a.z() * b.z(),
427  a.w() * b.x() + a.x() * b.w() + a.y() * b.z() - a.z() * b.y(),
428  a.w() * b.y() + a.y() * b.w() + a.z() * b.x() - a.x() * b.z(),
429  a.w() * b.z() + a.z() * b.w() + a.x() * b.y() - a.y() * b.x()
430  );
431  }
432 };
433 }
434 
436 template <class Derived>
437 template <class OtherDerived>
440 {
442  YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY)
443  return internal::quat_product<Architecture::Target, Derived, OtherDerived,
446 }
447 
449 template <class Derived>
450 template <class OtherDerived>
452 {
453  derived() = derived() * other.derived();
454  return derived();
455 }
456 
464 template <class Derived>
467 {
468  // Note that this algorithm comes from the optimization by hand
469  // of the conversion to a Matrix followed by a Matrix/Vector product.
470  // It appears to be much faster than the common algorithm found
471  // in the litterature (30 versus 39 flops). It also requires two
472  // Vector3 as temporaries.
473  Vector3 uv = this->vec().cross(v);
474  uv += uv;
475  return v + this->w() * uv + this->vec().cross(uv);
476 }
477 
478 template<class Derived>
480 {
481  coeffs() = other.coeffs();
482  return derived();
483 }
484 
485 template<class Derived>
486 template<class OtherDerived>
488 {
489  coeffs() = other.coeffs();
490  return derived();
491 }
492 
495 template<class Derived>
497 {
498  using std::cos;
499  using std::sin;
500  Scalar ha = Scalar(0.5)*aa.angle(); // Scalar(0.5) to suppress precision loss warnings
501  this->w() = cos(ha);
502  this->vec() = sin(ha) * aa.axis();
503  return derived();
504 }
505 
512 template<class Derived>
513 template<class MatrixDerived>
515 {
517  YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY)
519  return derived();
520 }
521 
525 template<class Derived>
526 inline typename QuaternionBase<Derived>::Matrix3
528 {
529  // NOTE if inlined, then gcc 4.2 and 4.4 get rid of the temporary (not gcc 4.3 !!)
530  // if not inlined then the cost of the return by value is huge ~ +35%,
531  // however, not inlining this function is an order of magnitude slower, so
532  // it has to be inlined, and so the return by value is not an issue
533  Matrix3 res;
534 
535  const Scalar tx = Scalar(2)*this->x();
536  const Scalar ty = Scalar(2)*this->y();
537  const Scalar tz = Scalar(2)*this->z();
538  const Scalar twx = tx*this->w();
539  const Scalar twy = ty*this->w();
540  const Scalar twz = tz*this->w();
541  const Scalar txx = tx*this->x();
542  const Scalar txy = ty*this->x();
543  const Scalar txz = tz*this->x();
544  const Scalar tyy = ty*this->y();
545  const Scalar tyz = tz*this->y();
546  const Scalar tzz = tz*this->z();
547 
548  res.coeffRef(0,0) = Scalar(1)-(tyy+tzz);
549  res.coeffRef(0,1) = txy-twz;
550  res.coeffRef(0,2) = txz+twy;
551  res.coeffRef(1,0) = txy+twz;
552  res.coeffRef(1,1) = Scalar(1)-(txx+tzz);
553  res.coeffRef(1,2) = tyz-twx;
554  res.coeffRef(2,0) = txz-twy;
555  res.coeffRef(2,1) = tyz+twx;
556  res.coeffRef(2,2) = Scalar(1)-(txx+tyy);
557 
558  return res;
559 }
560 
571 template<class Derived>
572 template<typename Derived1, typename Derived2>
574 {
575  using std::max;
576  using std::sqrt;
577  Vector3 v0 = a.normalized();
578  Vector3 v1 = b.normalized();
579  Scalar c = v1.dot(v0);
580 
581  // if dot == -1, vectors are nearly opposites
582  // => accuraletly compute the rotation axis by computing the
583  // intersection of the two planes. This is done by solving:
584  // x^T v0 = 0
585  // x^T v1 = 0
586  // under the constraint:
587  // ||x|| = 1
588  // which yields a singular value problem
589  if (c < Scalar(-1)+NumTraits<Scalar>::dummy_precision())
590  {
591  c = max<Scalar>(c,-1);
592  Matrix<Scalar,2,3> m; m << v0.transpose(), v1.transpose();
594  Vector3 axis = svd.matrixV().col(2);
595 
596  Scalar w2 = (Scalar(1)+c)*Scalar(0.5);
597  this->w() = sqrt(w2);
598  this->vec() = axis * sqrt(Scalar(1) - w2);
599  return derived();
600  }
601  Vector3 axis = v0.cross(v1);
602  Scalar s = sqrt((Scalar(1)+c)*Scalar(2));
603  Scalar invs = Scalar(1)/s;
604  this->vec() = axis * invs;
605  this->w() = s * Scalar(0.5);
606 
607  return derived();
608 }
609 
610 
621 template<typename Scalar, int Options>
622 template<typename Derived1, typename Derived2>
624 {
625  Quaternion quat;
626  quat.setFromTwoVectors(a, b);
627  return quat;
628 }
629 
630 
637 template <class Derived>
639 {
640  // FIXME should this function be called multiplicativeInverse and conjugate() be called inverse() or opposite() ??
641  Scalar n2 = this->squaredNorm();
642  if (n2 > 0)
643  return Quaternion<Scalar>(conjugate().coeffs() / n2);
644  else
645  {
646  // return an invalid result to flag the error
647  return Quaternion<Scalar>(Coefficients::Zero());
648  }
649 }
650 
657 template <class Derived>
660 {
661  return Quaternion<Scalar>(this->w(),-this->x(),-this->y(),-this->z());
662 }
663 
667 template <class Derived>
668 template <class OtherDerived>
669 inline typename internal::traits<Derived>::Scalar
671 {
672  using std::acos;
673  using std::abs;
674  double d = abs(this->dot(other));
675  if (d>=1.0)
676  return Scalar(0);
677  return static_cast<Scalar>(2 * acos(d));
678 }
679 
683 template <class Derived>
684 template <class OtherDerived>
687 {
688  using std::acos;
689  using std::sin;
690  using std::abs;
691  static const Scalar one = Scalar(1) - NumTraits<Scalar>::epsilon();
692  Scalar d = this->dot(other);
693  Scalar absD = abs(d);
694 
695  Scalar scale0;
696  Scalar scale1;
697 
698  if(absD>=one)
699  {
700  scale0 = Scalar(1) - t;
701  scale1 = t;
702  }
703  else
704  {
705  // theta is the angle between the 2 quaternions
706  Scalar theta = acos(absD);
707  Scalar sinTheta = sin(theta);
708 
709  scale0 = sin( ( Scalar(1) - t ) * theta) / sinTheta;
710  scale1 = sin( ( t * theta) ) / sinTheta;
711  }
712  if(d<0) scale1 = -scale1;
713 
714  return Quaternion<Scalar>(scale0 * coeffs() + scale1 * other.coeffs());
715 }
716 
717 namespace internal {
718 
719 // set from a rotation matrix
720 template<typename Other>
721 struct quaternionbase_assign_impl<Other,3,3>
722 {
723  typedef typename Other::Scalar Scalar;
724  typedef DenseIndex Index;
725  template<class Derived> static inline void run(QuaternionBase<Derived>& q, const Other& mat)
726  {
727  using std::sqrt;
728  // This algorithm comes from "Quaternion Calculus and Fast Animation",
729  // Ken Shoemake, 1987 SIGGRAPH course notes
730  Scalar t = mat.trace();
731  if (t > Scalar(0))
732  {
733  t = sqrt(t + Scalar(1.0));
734  q.w() = Scalar(0.5)*t;
735  t = Scalar(0.5)/t;
736  q.x() = (mat.coeff(2,1) - mat.coeff(1,2)) * t;
737  q.y() = (mat.coeff(0,2) - mat.coeff(2,0)) * t;
738  q.z() = (mat.coeff(1,0) - mat.coeff(0,1)) * t;
739  }
740  else
741  {
742  DenseIndex i = 0;
743  if (mat.coeff(1,1) > mat.coeff(0,0))
744  i = 1;
745  if (mat.coeff(2,2) > mat.coeff(i,i))
746  i = 2;
747  DenseIndex j = (i+1)%3;
748  DenseIndex k = (j+1)%3;
749 
750  t = sqrt(mat.coeff(i,i)-mat.coeff(j,j)-mat.coeff(k,k) + Scalar(1.0));
751  q.coeffs().coeffRef(i) = Scalar(0.5) * t;
752  t = Scalar(0.5)/t;
753  q.w() = (mat.coeff(k,j)-mat.coeff(j,k))*t;
754  q.coeffs().coeffRef(j) = (mat.coeff(j,i)+mat.coeff(i,j))*t;
755  q.coeffs().coeffRef(k) = (mat.coeff(k,i)+mat.coeff(i,k))*t;
756  }
757  }
758 };
759 
760 // set from a vector of coefficients assumed to be a quaternion
761 template<typename Other>
762 struct quaternionbase_assign_impl<Other,4,1>
763 {
764  typedef typename Other::Scalar Scalar;
765  template<class Derived> static inline void run(QuaternionBase<Derived>& q, const Other& vec)
766  {
767  q.coeffs() = vec;
768  }
769 };
770 
771 } // end namespace internal
772 
773 } // end namespace Eigen
774 
775 #endif // EIGEN_QUATERNION_H
d
internal::traits< Derived >::Coefficients Coefficients
QuaternionBase< Quaternion< _Scalar, _Options > > Base
Scalar dot(const QuaternionBase< OtherDerived > &other) const
#define EIGEN_STRONG_INLINE
static void run(QuaternionBase< Derived > &q, const Other &vec)
static Matrix< Scalar, 2, 2 > toRotationMatrix(const Scalar &s)
#define EIGEN_INHERIT_ASSIGNMENT_EQUAL_OPERATOR(Derived)
NumTraits< Scalar >::Real RealScalar
A matrix or vector expression mapping an existing array of data.
Definition: Map.h:104
Matrix< Scalar, 3, 1 > Vector3
const unsigned int LvalueBit
Definition: Constants.h:131
XmlRpcServer s
Definition: LDLT.h:16
EIGEN_STRONG_INLINE Quaternion< Scalar > operator*(const QuaternionBase< OtherDerived > &q) const
const VectorBlock< const Coefficients, 3 > vec() const
internal::cast_return_type< Derived, Quaternion< NewScalarType > >::type cast() const
const internal::traits< Derived >::Coefficients & coeffs() const
Holds information about the various numeric (i.e. scalar) types allowed by Eigen. ...
Definition: NumTraits.h:88
const internal::permut_matrix_product_retval< PermutationDerived, Derived, OnTheRight > operator*(const MatrixBase< Derived > &matrix, const PermutationBase< PermutationDerived > &permutation)
#define EIGEN_STATIC_ASSERT(CONDITION, MSG)
Definition: StaticAssert.h:111
Quaternion(const Quaternion< OtherScalar, OtherOptions > &other)
AngleAxis< Scalar > AngleAxisType
Coefficients & coeffs()
static Quaternion< Scalar > Identity()
TFSIMD_FORCE_INLINE Quaternion slerp(const Quaternion &q1, const Quaternion &q2, const tfScalar &t)
const Vector3 & axis() const
Quaternion< Scalar > slerp(const Scalar &t, const QuaternionBase< OtherDerived > &other) const
Derived & setFromTwoVectors(const MatrixBase< Derived1 > &a, const MatrixBase< Derived2 > &b)
EIGEN_STRONG_INLINE const CwiseUnaryOp< internal::scalar_abs_op< Scalar >, const Derived > abs() const
const unsigned int AlignedBit
Definition: Constants.h:147
const CwiseUnaryOp< internal::scalar_inverse_op< Scalar >, const Derived > inverse() const
Expression of a fixed-size or dynamic-size sub-vector.
EIGEN_STRONG_INLINE Derived & operator*=(const QuaternionBase< OtherDerived > &q)
static EIGEN_STRONG_INLINE void _check_template_params()
internal::traits< Derived >::Coefficients & coeffs()
traits< Quaternion< _Scalar,(int(_Options)&Aligned)==Aligned?AutoAlign:DontAlign > > TraitsBase
Quaternion(const MatrixBase< Derived > &other)
EIGEN_STRONG_INLINE Scalar & coeffRef(Index rowId, Index colId)
EIGEN_STRONG_INLINE Quaternion(const QuaternionBase< Derived > &other)
Quaternion(const Scalar &w, const Scalar &x, const Scalar &y, const Scalar &z)
bool isApprox(const QuaternionBase< OtherDerived > &other, const RealScalar &prec=NumTraits< Scalar >::dummy_precision()) const
const PlainObject normalized() const
Definition: Dot.h:139
#define EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF(NeedsToAlign)
Common base class for compact rotation representations.
Scalar angularDistance(const QuaternionBase< OtherDerived > &other) const
Quaternion< Scalar > conjugate() const
TFSIMD_FORCE_INLINE const tfScalar & x() const
const CwiseUnaryOp< internal::scalar_sin_op< Scalar >, const Derived > sin() const
ConjugateReturnType conjugate() const
Base class for quaternion expressions.
internal::traits< Map >::Coefficients Coefficients
static EIGEN_STRONG_INLINE Quaternion< Scalar > run(const QuaternionBase< Derived1 > &a, const QuaternionBase< Derived2 > &b)
void axis(float size)
TFSIMD_FORCE_INLINE tfScalar dot(const Quaternion &q1, const Quaternion &q2)
static Quaternion FromTwoVectors(const MatrixBase< Derived1 > &a, const MatrixBase< Derived2 > &b)
QuaternionBase< Map< const Quaternion< _Scalar >, _Options > > Base
TFSIMD_FORCE_INLINE const tfScalar & z() const
Quaternion< Scalar > inverse() const
EIGEN_DEFAULT_DENSE_INDEX_TYPE DenseIndex
Definition: XprHelper.h:27
Map< Quaternion< float >, 0 > QuaternionMapf
TFSIMD_FORCE_INLINE const tfScalar & w() const
const Scalar & y
The quaternion class used to represent 3D orientations and rotations.
const Coefficients & coeffs() const
RotationBase< Derived, 3 > Base
Map< Quaternion< double >, 0 > QuaternionMapd
Two-sided Jacobi SVD decomposition of a rectangular matrix.
Matrix3 toRotationMatrix() const
EIGEN_STRONG_INLINE Vector3 _transformVector(Vector3 v) const
Map< Quaternion< float >, Aligned > QuaternionMapAlignedf
const CwiseUnaryOp< internal::scalar_cos_op< Scalar >, const Derived > cos() const
Quaternion(const AngleAxisType &aa)
QuaternionBase & setIdentity()
Quaternion< double > Quaterniond
Quaternion< Scalar > normalized() const
Quaternion(const Scalar *data)
const CwiseUnaryOp< internal::scalar_sqrt_op< Scalar >, const Derived > sqrt() const
internal::traits< Map >::Coefficients Coefficients
Matrix< Scalar, 3, 3 > Matrix3
VectorBlock< Coefficients, 3 > vec()
const CwiseUnaryOp< internal::scalar_acos_op< Scalar >, const Derived > acos() const
Quaternion< float > Quaternionf
internal::traits< Derived >::Scalar Scalar
EIGEN_STRONG_INLINE QuaternionBase< Derived > & operator=(const QuaternionBase< Derived > &other)
Base class for all dense matrices, vectors, and expressions.
Definition: MatrixBase.h:48
Represents a 3D rotation as a rotation angle around an arbitrary 3D axis.
const MatrixVType & matrixV() const
Definition: JacobiSVD.h:618
Map< Quaternion< double >, Aligned > QuaternionMapAlignedd
static void run(QuaternionBase< Derived > &q, const Other &mat)
QuaternionBase< Map< Quaternion< _Scalar >, _Options > > Base
Quaternion & setFromTwoVectors(const MatrixBase< Derived1 > &a, const MatrixBase< Derived2 > &b)


tuw_aruco
Author(s): Lukas Pfeifhofer
autogenerated on Mon Jun 10 2019 15:40:56