Home | History | Annotate | Download | only in Geometry

Lines Matching refs:Quaternion

30   * \brief Base class for quaternion expressions
32 * \sa class Quaternion
102 /** \returns a quaternion representing an identity rotation
105 static inline Quaternion<Scalar> Identity() { return Quaternion<Scalar>(1, 0, 0, 0); }
111 /** \returns the squared norm of the quaternion's coefficients
116 /** \returns the norm of the quaternion's coefficients
121 /** Normalizes the quaternion \c *this
126 inline Quaternion<Scalar> normalized() const { return Quaternion<Scalar>(coeffs().normalized()); }
140 /** \returns the quaternion which transform \a a into \a b through a rotation */
144 template<class OtherDerived> EIGEN_STRONG_INLINE Quaternion<Scalar> operator* (const QuaternionBase<OtherDerived>& q) const;
147 /** \returns the quaternion describing the inverse rotation */
148 Quaternion<Scalar> inverse() const;
150 /** \returns the conjugated quaternion */
151 Quaternion<Scalar> conjugate() const;
157 template<class OtherDerived> Quaternion<Scalar> slerp(Scalar t, const QuaternionBase<OtherDerived>& other) const;
176 inline typename internal::cast_return_type<Derived,Quaternion<NewScalarType> >::type cast() const
178 return typename internal::cast_return_type<Derived,Quaternion<NewScalarType> >::type(derived());
187 * Definition/implementation of Quaternion<Scalar>
192 * \class Quaternion
194 * \brief The quaternion class used to represent 3D orientations and rotations
198 * This class represents a quaternion \f$ w+xi+yj+zk \f$ that is a convenient representation of
214 struct traits<Quaternion<_Scalar,_Options> >
216 typedef Quaternion<_Scalar,_Options> PlainObject;
227 class Quaternion : public QuaternionBase<Quaternion<_Scalar,_Options> >
229 typedef QuaternionBase<Quaternion<_Scalar,_Options> > Base;
230 enum { IsAligned = internal::traits<Quaternion>::IsAligned };
235 EIGEN_INHERIT_ASSIGNMENT_EQUAL_OPERATOR(Quaternion)
238 typedef typename internal::traits<Quaternion>::Coefficients Coefficients;
241 /** Default constructor leaving the quaternion uninitialized. */
242 inline Quaternion() {}
244 /** Constructs and initializes the quaternion \f$ w+xi+yj+zk \f$ from
251 inline Quaternion(Scalar w, Scalar x, Scalar y, Scalar z) : m_coeffs(x, y, z, w){}
253 /** Constructs and initialize a quaternion from the array data */
254 inline Quaternion(const Scalar* data) : m_coeffs(data) {}
257 template<class Derived> EIGEN_STRONG_INLINE Quaternion(const QuaternionBase<Derived>& other) { this->Base::operator=(other); }
259 /** Constructs and initializes a quaternion from the angle-axis \a aa */
260 explicit inline Quaternion(const AngleAxisType& aa) { *this = aa; }
262 /** Constructs and initializes a quaternion from either:
264 * - a 4D vector expression representing quaternion coefficients.
267 explicit inline Quaternion(const MatrixBase<Derived>& other) { *this = other; }
271 explicit inline Quaternion(const Quaternion<OtherScalar, OtherOptions>& other)
275 static Quaternion FromTwoVectors(const MatrixBase<Derived1>& a, const MatrixBase<Derived2>& b);
295 * single precision quaternion type */
296 typedef Quaternion<float> Quaternionf;
298 * double precision quaternion type */
299 typedef Quaternion<double> Quaterniond;
302 * Specialization of Map<Quaternion<Scalar>>
307 struct traits<Map<Quaternion<_Scalar>, _Options> >:
308 traits<Quaternion<_Scalar, _Options> >
313 typedef traits<Quaternion<_Scalar, _Options> > TraitsBase;
324 struct traits<Map<const Quaternion<_Scalar>, _Options> >:
325 traits<Quaternion<_Scalar> >
330 typedef traits<Quaternion<_Scalar, _Options> > TraitsBase;
338 /** \brief Quaternion expression mapping a constant memory buffer
340 * \param _Scalar the type of the Quaternion coefficients
343 * This is a specialization of class Map for Quaternion. This class allows to view
344 * a 4 scalar memory buffer as an Eigen's Quaternion object.
346 * \sa class Map, class Quaternion, class QuaternionBase
349 class Map<const Quaternion<_Scalar>, _Options >
350 : public QuaternionBase<Map<const Quaternion<_Scalar>, _Options> >
352 typedef QuaternionBase<Map<const Quaternion<_Scalar>, _Options> > Base;
360 /** Constructs a Mapped Quaternion object from the pointer \a coeffs
362 * The pointer \a coeffs must reference the four coeffecients of Quaternion in the following order:
374 /** \brief Expression of a quaternion from a memory buffer
376 * \param _Scalar the type of the Quaternion coefficients
379 * This is a specialization of class Map for Quaternion. This class allows to view
380 * a 4 scalar memory buffer as an Eigen's Quaternion object.
382 * \sa class Map, class Quaternion, class QuaternionBase
385 class Map<Quaternion<_Scalar>, _Options >
386 : public QuaternionBase<Map<Quaternion<_Scalar>, _Options> >
388 typedef QuaternionBase<Map<Quaternion<_Scalar>, _Options> > Base;
396 /** Constructs a Mapped Quaternion object from the pointer \a coeffs
398 * The pointer \a coeffs must reference the four coeffecients of Quaternion in the following order:
412 * Map an unaligned array of single precision scalar as a quaternion */
413 typedef Map<Quaternion<float>, 0> QuaternionMapf;
415 * Map an unaligned array of double precision scalar as a quaternion */
416 typedef Map<Quaternion<double>, 0> QuaternionMapd;
418 * Map a 16-bits aligned array of double precision scalars as a quaternion */
419 typedef Map<Quaternion<float>, Aligned> QuaternionMapAlignedf;
421 * Map a 16-bits aligned array of double precision scalars as a quaternion */
422 typedef Map<Quaternion<double>, Aligned> QuaternionMapAlignedd;
428 // Generic Quaternion * Quaternion product
433 static EIGEN_STRONG_INLINE Quaternion<Scalar> run(const QuaternionBase<Derived1>& a, const QuaternionBase<Derived2>& b){
434 return Quaternion<Scalar>
445 /** \returns the concatenation of two rotations as a quaternion-quaternion product */
448 EIGEN_STRONG_INLINE Quaternion<typename internal::traits<Derived>::Scalar>
458 /** \sa operator*(Quaternion) */
467 /** Rotation of a vector by a quaternion.
468 * \remarks If the quaternion is used to rotate several points (>1)
515 * - if \a xpr is a 4x1 vector, then \a xpr is assumed to be a quaternion
517 * and \a xpr is converted to a quaternion
530 /** Convert the quaternion to a 3x3 rotation matrix. The quaternion is required to
569 /** Sets \c *this to be a quaternion representing a rotation between
618 /** Returns a quaternion representing a rotation between
623 * \returns resulting quaternion
630 Quaternion<Scalar,Options> Quaternion<Scalar,Options>::FromTwoVectors(const MatrixBase<Derived1>& a, const MatrixBase<Derived2>& b)
632 Quaternion quat;
640 * and/or the quaternion is normalized, then it is enough to use the conjugate.
645 inline Quaternion<typename internal::traits<Derived>::Scalar> QuaternionBase<Derived>::inverse() const
650 return Quaternion<Scalar>(conjugate().coeffs() / n2);
654 return Quaternion<Scalar>(Coefficients::Zero());
659 * if the quaternion is normalized.
660 * The conjugate of a quaternion represents the opposite rotation.
665 inline Quaternion<typename internal::traits<Derived>::Scalar>
668 return Quaternion<Scalar>(this->w(),-this->x(),-this->y(),-this->z());
691 Quaternion<typename internal::traits<Derived>::Scalar>
718 return Quaternion<Scalar>(scale0 * coeffs() + scale1 * other.coeffs());
731 // This algorithm comes from "Quaternion Calculus and Fast Animation",
763 // set from a vector of coefficients assumed to be a quaternion