Chemical Data Processing Library C++ API - Version 1.4.0
Public Types | Public Member Functions | Friends | List of all members
CDPL::Math::RotationMatrix< T > Class Template Reference

\( N \times N \) rotation matrix backed by a unit quaternion (or an axis-angle representation). More...

#include <AffineTransform.hpp>

+ Inheritance diagram for CDPL::Math::RotationMatrix< T >:

Public Types

typedef T ValueType
 The scalar value type. More...
 
typedef const T Reference
 Reference type (always a const reference — elements are computed). More...
 
typedef const T ConstReference
 Constant reference type to an element. More...
 
typedef std::size_t SizeType
 The unsigned size type. More...
 
typedef std::ptrdiff_t DifferenceType
 The signed difference type. More...
 
typedef MatrixReference< SelfTypeClosureType
 Closure type used when this matrix appears inside another expression. More...
 
typedef const MatrixReference< const SelfTypeConstClosureType
 Constant closure type used when this matrix appears inside another expression. More...
 
typedef Matrix< T, std::vector< T > > MatrixTemporaryType
 Concrete temporary matrix type used by expression-template machinery. More...
 
typedef Vector< T, std::vector< T > > VectorTemporaryType
 Concrete temporary vector type used when assembling vectors from this matrix. More...
 
- Public Types inherited from CDPL::Math::MatrixContainer< RotationMatrix< T > >
typedef RotationMatrix< T > ContainerType
 The derived matrix container type. More...
 
- Public Types inherited from CDPL::Math::MatrixExpression< E >
typedef E ExpressionType
 The derived matrix expression type. More...
 
- Public Types inherited from CDPL::Math::Expression< E >
typedef E ExpressionType
 The derived expression type (made available to expression-template machinery). More...
 

Public Member Functions

template<typename E >
 RotationMatrix (SizeType n, const QuaternionExpression< E > &q)
 Constructs an \( N \times N \) rotation matrix from the unit quaternion q. More...
 
template<typename T1 , typename T2 , typename T3 , typename T4 >
 RotationMatrix (SizeType n, const T1 &w, const T2 &ux, const T3 &uy, const T4 &uz)
 Constructs an \( N \times N \) rotation matrix from an axis-angle representation. More...
 
 RotationMatrix (const RotationMatrix &m)
 Constructs a copy of the rotation matrix m. More...
 
template<typename E >
void set (const QuaternionExpression< E > &q)
 Sets the rotation from the unit quaternion q. More...
 
template<typename T1 , typename T2 , typename T3 , typename T4 >
void set (const T1 &w, const T2 &ux, const T3 &uy, const T4 &uz)
 Sets the rotation from an axis-angle representation. More...
 
ConstReference operator() (SizeType i, SizeType j) const
 Returns the rotation-matrix entry at (i, j). More...
 
bool isEmpty () const
 Tells whether the matrix is empty (size zero). More...
 
SizeType getSize1 () const
 Returns the dimension N (the row count). More...
 
SizeType getSize2 () const
 Returns the dimension N (the column count). More...
 
SizeType getMaxSize1 () const
 Returns the maximum representable row count. More...
 
SizeType getMaxSize2 () const
 Returns the maximum representable column count. More...
 
RotationMatrixoperator= (const RotationMatrix &m)
 Copy-assigns the dimension and the underlying quaternion components from m. More...
 
void swap (RotationMatrix &m)
 Swaps the dimension and the underlying quaternion components with m. More...
 
void resize (SizeType n)
 Resizes the matrix dimension to n (the underlying quaternion is left unchanged). More...
 
- Public Member Functions inherited from CDPL::Math::MatrixContainer< RotationMatrix< T > >
const ContainerTypeoperator() () const
 Returns a const reference to the derived matrix container. More...
 
ContainerTypeoperator() ()
 Returns a reference to the derived matrix container. More...
 
- Public Member Functions inherited from CDPL::Math::MatrixExpression< E >
const ExpressionTypeoperator() () const
 Returns a const reference to the derived matrix expression. More...
 
ExpressionTypeoperator() ()
 Returns a reference to the derived matrix expression. More...
 

Friends

void swap (RotationMatrix &m1, RotationMatrix &m2)
 ADL-enabled free-function form of swap(). More...
 

Additional Inherited Members

- Protected Member Functions inherited from CDPL::Math::MatrixContainer< RotationMatrix< T > >
 MatrixContainer ()
 
 ~MatrixContainer ()
 
- Protected Member Functions inherited from CDPL::Math::MatrixExpression< E >
 MatrixExpression ()
 
 ~MatrixExpression ()
 
- Protected Member Functions inherited from CDPL::Math::Expression< E >
 Expression ()
 
 ~Expression ()
 

Detailed Description

template<typename T>
class CDPL::Math::RotationMatrix< T >

\( N \times N \) rotation matrix backed by a unit quaternion (or an axis-angle representation).

The first \( 3 \times 3 \) block holds the rotation; the remaining diagonal entries are 1 (identity) and all other entries are 0. The size \( N \) is configurable and typically chosen to fit the surrounding coordinate system (e.g. 4 for homogeneous transformations).

Template Parameters
TThe scalar value type.

Member Typedef Documentation

◆ ValueType

template<typename T >
typedef T CDPL::Math::RotationMatrix< T >::ValueType

The scalar value type.

◆ Reference

template<typename T >
typedef const T CDPL::Math::RotationMatrix< T >::Reference

Reference type (always a const reference — elements are computed).

◆ ConstReference

template<typename T >
typedef const T CDPL::Math::RotationMatrix< T >::ConstReference

Constant reference type to an element.

◆ SizeType

template<typename T >
typedef std::size_t CDPL::Math::RotationMatrix< T >::SizeType

The unsigned size type.

◆ DifferenceType

template<typename T >
typedef std::ptrdiff_t CDPL::Math::RotationMatrix< T >::DifferenceType

The signed difference type.

◆ ClosureType

template<typename T >
typedef MatrixReference<SelfType> CDPL::Math::RotationMatrix< T >::ClosureType

Closure type used when this matrix appears inside another expression.

◆ ConstClosureType

template<typename T >
typedef const MatrixReference<const SelfType> CDPL::Math::RotationMatrix< T >::ConstClosureType

Constant closure type used when this matrix appears inside another expression.

◆ MatrixTemporaryType

template<typename T >
typedef Matrix<T, std::vector<T> > CDPL::Math::RotationMatrix< T >::MatrixTemporaryType

Concrete temporary matrix type used by expression-template machinery.

◆ VectorTemporaryType

template<typename T >
typedef Vector<T, std::vector<T> > CDPL::Math::RotationMatrix< T >::VectorTemporaryType

Concrete temporary vector type used when assembling vectors from this matrix.

Constructor & Destructor Documentation

◆ RotationMatrix() [1/3]

template<typename T >
template<typename E >
CDPL::Math::RotationMatrix< T >::RotationMatrix ( SizeType  n,
const QuaternionExpression< E > &  q 
)
inline

Constructs an \( N \times N \) rotation matrix from the unit quaternion q.

Template Parameters
EThe quaternion expression type.
Parameters
nThe matrix dimension N.
qThe unit quaternion expressing the rotation.

◆ RotationMatrix() [2/3]

template<typename T >
template<typename T1 , typename T2 , typename T3 , typename T4 >
CDPL::Math::RotationMatrix< T >::RotationMatrix ( SizeType  n,
const T1 &  w,
const T2 &  ux,
const T3 &  uy,
const T4 &  uz 
)
inline

Constructs an \( N \times N \) rotation matrix from an axis-angle representation.

Template Parameters
T1The rotation-angle scalar type.
T2The x-axis component scalar type.
T3The y-axis component scalar type.
T4The z-axis component scalar type.
Parameters
nThe matrix dimension N.
wThe rotation angle (in radians).
uxThe x-component of the rotation axis (unit vector).
uyThe y-component of the rotation axis (unit vector).
uzThe z-component of the rotation axis (unit vector).

◆ RotationMatrix() [3/3]

template<typename T >
CDPL::Math::RotationMatrix< T >::RotationMatrix ( const RotationMatrix< T > &  m)
inline

Constructs a copy of the rotation matrix m.

Parameters
mThe rotation matrix to copy.

Member Function Documentation

◆ set() [1/2]

template<typename T >
template<typename E >
void CDPL::Math::RotationMatrix< T >::set ( const QuaternionExpression< E > &  q)
inline

Sets the rotation from the unit quaternion q.

Template Parameters
EThe quaternion expression type.
Parameters
qThe unit quaternion expressing the rotation.

◆ set() [2/2]

template<typename T >
template<typename T1 , typename T2 , typename T3 , typename T4 >
void CDPL::Math::RotationMatrix< T >::set ( const T1 &  w,
const T2 &  ux,
const T3 &  uy,
const T4 &  uz 
)
inline

Sets the rotation from an axis-angle representation.

Template Parameters
T1The rotation-angle scalar type.
T2The x-axis component scalar type.
T3The y-axis component scalar type.
T4The z-axis component scalar type.
Parameters
wThe rotation angle (in radians).
uxThe x-component of the rotation axis (unit vector).
uyThe y-component of the rotation axis (unit vector).
uzThe z-component of the rotation axis (unit vector).

◆ operator()()

template<typename T >
ConstReference CDPL::Math::RotationMatrix< T >::operator() ( SizeType  i,
SizeType  j 
) const
inline

Returns the rotation-matrix entry at (i, j).

Parameters
iThe zero-based row index.
jThe zero-based column index.
Returns
The matrix entry (computed from the stored unit quaternion).
Exceptions
Base::IndexErrorif either index is out of range.

◆ isEmpty()

template<typename T >
bool CDPL::Math::RotationMatrix< T >::isEmpty ( ) const
inline

Tells whether the matrix is empty (size zero).

Returns
true if N is zero, and false otherwise.

◆ getSize1()

template<typename T >
SizeType CDPL::Math::RotationMatrix< T >::getSize1 ( ) const
inline

Returns the dimension N (the row count).

Returns
N.

◆ getSize2()

template<typename T >
SizeType CDPL::Math::RotationMatrix< T >::getSize2 ( ) const
inline

Returns the dimension N (the column count).

Returns
N.

◆ getMaxSize1()

template<typename T >
SizeType CDPL::Math::RotationMatrix< T >::getMaxSize1 ( ) const
inline

Returns the maximum representable row count.

Returns
The maximum row count.

◆ getMaxSize2()

template<typename T >
SizeType CDPL::Math::RotationMatrix< T >::getMaxSize2 ( ) const
inline

Returns the maximum representable column count.

Returns
The maximum column count.

◆ operator=()

template<typename T >
RotationMatrix& CDPL::Math::RotationMatrix< T >::operator= ( const RotationMatrix< T > &  m)
inline

Copy-assigns the dimension and the underlying quaternion components from m.

Parameters
mThe source rotation matrix.
Returns
A reference to itself.

◆ swap()

template<typename T >
void CDPL::Math::RotationMatrix< T >::swap ( RotationMatrix< T > &  m)
inline

Swaps the dimension and the underlying quaternion components with m.

Parameters
mThe rotation matrix to swap with.

◆ resize()

template<typename T >
void CDPL::Math::RotationMatrix< T >::resize ( SizeType  n)
inline

Resizes the matrix dimension to n (the underlying quaternion is left unchanged).

Parameters
nThe new dimension.

Friends And Related Function Documentation

◆ swap

template<typename T >
void swap ( RotationMatrix< T > &  m1,
RotationMatrix< T > &  m2 
)
friend

ADL-enabled free-function form of swap().

Parameters
m1The first rotation matrix.
m2The second rotation matrix.

The documentation for this class was generated from the following file: