avsEigenMRP

namespace Eigen

Typedefs

typedef MRP<float> MRPf

single precision MRP type

typedef MRP<double> MRPd

double precision MRP type

typedef Map<MRP<float>, 0> MRPMapf

Map an unaligned array of single precision scalars as a MRP

typedef Map<MRP<double>, 0> MRPMapd

Map an unaligned array of double precision scalars as a MRP

typedef Map<MRP<float>, Aligned> MRPMapAlignedf

Map a 16-byte aligned array of single precision scalars as a MRP

typedef Map<MRP<double>, Aligned> MRPMapAlignedd

Map a 16-byte aligned array of double precision scalars as a MRP

template<typename _Scalar, int _Options>
class Map<const MRP<_Scalar>, _Options> : public Eigen::MRPBase<Map<const MRP<_Scalar>, _Options>>
#include <avsEigenMRP.h>

MRP expression mapping a constant memory buffer.

This is a specialization of class Map for

MRP. This class allows to view a 3 scalar memory buffer as an Eigen’s MRP object.
Template Parameters
  • _Scalar: the type of the MRP coefficients

  • _Options: see class Map

See

class Map, class MRP, class MRPBase

Public Types

typedef _Scalar Scalar
typedef internal::traits<Map>::Coefficients Coefficients

Public Functions

EIGEN_STRONG_INLINE Map(const Scalar *coeffs)

Constructs a Mapped MRP object from the pointer coeffs

The pointer coeffs must reference the three coefficients of MRP in the following order:

*coeffs == {x, y, z} 

If the template parameter _Options is set to #Aligned, then the pointer coeffs must be aligned.

const Coefficients &coeffs() const

Protected Attributes

const Coefficients m_coeffs

Private Types

typedef MRPBase<Map<const MRP<_Scalar>, _Options>> Base
template<typename _Scalar, int _Options>
class Map<MRP<_Scalar>, _Options> : public Eigen::MRPBase<Map<MRP<_Scalar>, _Options>>
#include <avsEigenMRP.h>

Expression of a MRP from a memory buffer.

This is a specialization of class Map for

MRP. This class allows to view a 3 scalar memory buffer as an Eigen’s MRP object.
Template Parameters
  • _Scalar: the type of the MRP coefficients

  • _Options: see class Map

See

class Map, class MRP, class MRPBase

Public Types

typedef _Scalar Scalar
typedef internal::traits<Map>::Coefficients Coefficients

Public Functions

EIGEN_STRONG_INLINE Map(Scalar *coeffs)

Constructs a Mapped MRP object from the pointer coeffs

The pointer coeffs must reference the three coefficients of MRP in the following order:

*coeffs == {x, y, z} 

If the template parameter _Options is set to #Aligned, then the pointer coeffs must be aligned.

Coefficients &coeffs()
const Coefficients &coeffs() const

Protected Attributes

Coefficients m_coeffs

Private Types

typedef MRPBase<Map<MRP<_Scalar>, _Options>> Base
template<typename _Scalar, int _Options>
class MRP
#include <avsEigenMRP.h>

The MRP class used to represent 3D orientations and rotations.

\geometry_module

This class represents a

MRP \( (x,y,z) \) that is a convenient representation of orientations and rotations of objects in three dimensions. Compared to other representations like Euler angles or 3x3 matrices, MRPs offer the following advantages:
  • compact storage (3 scalars)

  • efficient to compose (28 flops),

The following two typedefs are provided for convenience:

  • MRPf for float

  • MRPd for double

Warning

Operations interpreting the MRP as rotation have undefined behavior if the MRP is not normalized.

See

class AngleAxis, class Transform

Template Parameters
  • _Scalar: the scalar type, i.e., the type of the coefficients

  • _Options: controls the memory alignment of the coefficients. Can be # AutoAlign or # DontAlign. Default is AutoAlign.

Public Types

typedef _Scalar Scalar
typedef internal::traits<MRP>::Coefficients Coefficients
typedef Base::AngleAxisType AngleAxisType

Public Functions

MRP()

Default constructor leaving the MRP uninitialized.

MRP(const Scalar &x, const Scalar &y, const Scalar &z)

Constructs and initializes the MRP \( (x,y,z) \) from its four coefficients x, y and z.

MRP(const Scalar *data)

Constructs and initialize a MRP from the array data

template<class Derived>
EIGEN_STRONG_INLINE MRP(const MRPBase<Derived> &other)

Copy constructor

MRP(const AngleAxisType &aa)

Constructs and initializes a MRP from the angle-axis aa

template<typename Derived>
MRP(const MatrixBase<Derived> &other)

Constructs and initializes a MRP from either:

  • a rotation matrix expression,

  • a 3D vector expression representing MRP coefficients.

Coefficients &coeffs()
const Coefficients &coeffs() const
template<typename Derived1, typename Derived2>
MRP<Scalar, Options> FromTwoVectors(const MatrixBase<Derived1> &a, const MatrixBase<Derived2> &b)

Returns a MRP representing a rotation between the two arbitrary vectors a and b. In other words, the built rotation represent a rotation sending the line of direction a to the line of direction b, both lines passing through the origin.

Note that the two input vectors do

not have to be normalized, and do not need to have the same norm.
Return

resulting MRP

template<class OtherDerived> EIGEN_STRONG_INLINE Derived & operator*= (const MRPBase< OtherDerived > &q)

See

operator*(MRP)

Public Static Functions

template<typename Derived1, typename Derived2>
MRP FromTwoVectors(const MatrixBase<Derived1> &a, const MatrixBase<Derived2> &b)

Explicit copy constructor with scalar conversion

Protected Attributes

Coefficients m_coeffs

Protected Static Functions

EIGEN_STRONG_INLINE void _check_template_params ()

Private Types

enum [anonymous]

Values:

enumerator IsAligned
typedef MRPBase<MRP<_Scalar, _Options>> Base
template<class Derived>
class MRPBase : public RotationBase<Derived, 3>
#include <avsEigenMRP.h>

Base class for MRP expressions.

\geometry_module

See

class MRP

Template Parameters
  • Derived: derived type (CRTP)

Public Types

enum [anonymous]

Values:

enumerator Flags
typedef internal::traits<Derived>::Scalar Scalar
typedef NumTraits<Scalar>::Real RealScalar
typedef internal::traits<Derived>::Coefficients Coefficients
typedef Matrix<Scalar, 3, 1> Vector3

the type of a 3D vector

typedef Matrix<Scalar, 3, 3> Matrix3

the equivalent rotation matrix type

typedef AngleAxis<Scalar> AngleAxisType

the equivalent angle-axis type

Public Functions

Scalar x() const

Return

the x coefficient

Scalar y() const

Return

the y coefficient

Scalar z() const

Return

the z coefficient

Scalar &x()

Return

a reference to the x coefficient

Scalar &y()

Return

a reference to the y coefficient

Scalar &z()

Return

a reference to the z coefficient

const VectorBlock<const Coefficients, 3> vec() const

Return

a read-only vector expression of the imaginary part (x,y,z)

VectorBlock<Coefficients, 3> vec()

Return

a vector expression of the imaginary part (x,y,z)

const internal::traits<Derived>::Coefficients &coeffs() const

Return

a read-only vector expression of the coefficients (x,y,z)

internal::traits<Derived>::Coefficients &coeffs()

Return

a vector expression of the coefficients (x,y,z)

EIGEN_STRONG_INLINE MRPBase< Derived > & operator= (const MRPBase< Derived > &other)
template<class OtherDerived> EIGEN_STRONG_INLINE Derived & operator= (const MRPBase< OtherDerived > &other)
Derived &operator=(const AngleAxisType &aa)

Set *this from an angle-axis aa and returns a reference to *this

template<class OtherDerived>
Derived &operator=(const MatrixBase<OtherDerived> &m)
MRPBase &setIdentity()

See

MRPBase::Identity(), MatrixBase::setIdentity()

Scalar squaredNorm() const

Return

the squared norm of the MRP’s coefficients

See

MRPBase::norm(), MatrixBase::squaredNorm()

Scalar norm() const

Return

the norm of the MRP’s coefficients

See

MRPBase::squaredNorm(), MatrixBase::norm()

void normalize()

Normalizes the MRP *this

See

normalized(), MatrixBase::normalize()

MRP<Scalar> normalized() const

Return

a normalized copy of *this

See

normalize(), MatrixBase::normalized()

template<class OtherDerived>
Scalar dot(const MRPBase<OtherDerived> &other) const

Return

the dot product of *this and other Geometrically speaking, the dot product of two unit MRPs corresponds to the cosine of half the angle between the two rotations.

See

angularDistance()

template<class OtherDerived>
Scalar angularDistance(const MRPBase<OtherDerived> &other) const
Matrix3 toRotationMatrix() const

Convert the

MRP sigma_B/N to a 3x3 rotation matrix [NB].
Return

an equivalent 3x3 rotation matrix

template<typename Derived1, typename Derived2>
Derived &setFromTwoVectors(const MatrixBase<Derived1> &a, const MatrixBase<Derived2> &b)

Sets

*this to be a MRP representing a rotation between the two arbitrary vectors a and b. In other words, the built rotation represent a rotation sending the line of direction a to the line of direction b, both lines passing through the origin.
Return

the MRP which transform a into b through a rotation

Note that the two input vectors do

not have to be normalized, and do not need to have the same norm.
Return

a reference to *this.

template<class OtherDerived> EIGEN_STRONG_INLINE MRP< Scalar > operator* (const MRPBase< OtherDerived > &q) const
template<class OtherDerived> EIGEN_STRONG_INLINE Derived & operator*= (const MRPBase< OtherDerived > &q)

See

operator*(MRP)

template<class OtherDerived> EIGEN_STRONG_INLINE Derived & operator+= (const MRPBase< OtherDerived > &q)

See

operator*(MRP)

template<class OtherDerived> EIGEN_STRONG_INLINE Derived & operator-= (const MRPBase< OtherDerived > &q)

See

operator*(MRP)

MRP<Scalar> shadow() const

Return

the MRP describing the shadow set

Return

the MRP Shadow set of *this

See

MRPBase::shadow()

Matrix3 Bmat() const

d(sigmda_B/N) = 1/4 [B(sigma_B/N)] omega_BN_B

Return

3x3 [B] matrix for the MRP differential kinematic equations

Return

the MRP [B] matrix of *this This is used in

See

MRPBase::shadow()

MRP<Scalar> inverse() const

Return

the MRP describing the inverse rotation

Return

the multiplicative inverse of *this Note that in most cases, i.e., if you simply want the opposite rotation, and/or the MRP is normalized, then it is enough to use the conjugate.

See

MRPBase::conjugate()

MRP<Scalar> conjugate() const

Return

the conjugated MRP

Return

the conjugate of the *this which is equal to the multiplicative inverse if the MRP is normalized. The conjugate of a MRP represents the opposite rotation.

See

MRP2::inverse()

template<class OtherDerived>
bool isApprox(const MRPBase<OtherDerived> &other, const RealScalar &prec = NumTraits<Scalar>::dummy_precision()) const

Return

true if *this is approximately equal to other, within the precision determined by prec.

See

MatrixBase::isApprox()

EIGEN_STRONG_INLINE Vector3 _transformVector (const Vector3 &v) const

return the result vector of v through the rotation

Rotation of a vector by a MRP.

Remark

If the MRP is used to rotate several points (>1) then it is much more efficient to first convert it to a 3x3 Matrix. Comparison of the operation cost for n transformations:

  • MRP2: 30n

  • Via a Matrix3: 24 + 15n

template<typename NewScalarType>
internal::cast_return_type<Derived, MRP<NewScalarType>>::type cast() const

Note that if

NewScalarType is equal to the current scalar type of *this then this function smartly returns a const reference to *this.
Return

*this with scalar type casted to NewScalarType

template<class OtherDerived> EIGEN_STRONG_INLINE MRP< typename internal::traits< Derived >::Scalar > operator* (const MRPBase< OtherDerived > &other) const

Return

the concatenation of two rotations as a MRP-MRP product

template<class MatrixDerived>
Derived &operator=(const MatrixBase<MatrixDerived> &xpr)

Set *this from the expression xpr:

  • if xpr is a 3x1 vector, then xpr is assumed to be a MRP

  • if xpr is a 3x3 matrix, then xpr is assumed to be rotation matrix and xpr is converted to a MRP

template<class OtherDerived>
internal::traits<Derived>::Scalar angularDistance(const MRPBase<OtherDerived> &other) const

Return

the angle (in radian) between two rotations

See

dot()

Public Static Functions

MRP<Scalar> Identity()

Return

a MRP representing an identity rotation

See

MatrixBase::Identity()

Private Types

typedef RotationBase<Derived, 3> Base
namespace internal
template<int Arch, class Derived1, class Derived2, typename Scalar, int _Options>
struct mrp_product

Public Static Functions

EIGEN_STRONG_INLINE MRP< Scalar > run (const MRPBase< Derived1 > &a, const MRPBase< Derived2 > &b)
template<typename Other>
struct MRPbase_assign_impl<Other, 3, 1>

Public Types

typedef Other::Scalar Scalar

Public Static Functions

template<class Derived>
void run(MRPBase<Derived> &q, const Other &vec)
template<typename Other>
struct MRPbase_assign_impl<Other, 3, 3>

Public Types

typedef Other::Scalar Scalar
typedef DenseIndex Index

Public Static Functions

template<class Derived>
void run(MRPBase<Derived> &sig, const Other &mat)
template<typename _Scalar, int _Options> traits< Map< const MRP< _Scalar >, _Options > > : public traits< MRP< _Scalar,(int(_Options)&Aligned)==Aligned ? AutoAlign :DontAlign > >

Public Types

enum [anonymous]

Values:

enumerator Flags
typedef Map<const Matrix<_Scalar, 3, 1>, _Options> Coefficients
traits< MRP< _Scalar,(int(_Options)&Aligned)==Aligned ? AutoAlign :DontAlign > > TraitsBase
template<typename _Scalar, int _Options> traits< Map< MRP< _Scalar >, _Options > > : public traits< MRP< _Scalar,(int(_Options)&Aligned)==Aligned ? AutoAlign :DontAlign > >

Public Types

typedef Map<Matrix<_Scalar, 3, 1>, _Options> Coefficients
template<typename _Scalar, int _Options>
struct traits<MRP<_Scalar, _Options>>

Public Types

enum [anonymous]

Values:

enumerator IsAligned
enumerator Flags
typedef MRP<_Scalar, _Options> PlainObject
typedef _Scalar Scalar
typedef Matrix<_Scalar, 3, 1, _Options> Coefficients