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

Pure-real quaternion \( q = c_1 + 0i + 0j + 0k \) that stores only the real component. More...

#include <Quaternion.hpp>

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

Public Types

typedef T ValueType
 The scalar component value type. More...
 
typedef const T & Reference
 Reference type (always a const reference — only the real component is mutable, via assignment). More...
 
typedef const T & ConstReference
 Constant reference type to the real component. More...
 
typedef QuaternionReference< SelfTypeClosureType
 Closure type used when this quaternion appears inside another expression. More...
 
typedef const QuaternionReference< const SelfTypeConstClosureType
 Constant closure type used when this quaternion appears inside another expression. More...
 
typedef Quaternion< T > QuaternionTemporaryType
 Concrete temporary quaternion type used by expression-template machinery (a general Math::Quaternion<T>). More...
 
- Public Types inherited from CDPL::Math::QuaternionContainer< RealQuaternion< T > >
typedef RealQuaternion< T > ContainerType
 The derived quaternion container type. More...
 
- Public Types inherited from CDPL::Math::QuaternionExpression< E >
typedef E ExpressionType
 The derived quaternion 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

 RealQuaternion ()
 Constructs a zero-valued real quaternion (C1 = 0). More...
 
 RealQuaternion (const ValueType &r)
 Constructs the real quaternion with the supplied real component. More...
 
template<typename T1 >
 RealQuaternion (const RealQuaternion< T1 > &q)
 Constructs a copy of the real quaternion q (possibly converting the component type). More...
 
ConstReference getC1 () const
 Returns a const reference to the real component C1. More...
 
ConstReference getC2 () const
 Returns a const reference to the imaginary component C2 (always zero for a real quaternion). More...
 
ConstReference getC3 () const
 Returns a const reference to the imaginary component C3 (always zero for a real quaternion). More...
 
ConstReference getC4 () const
 Returns a const reference to the imaginary component C4 (always zero for a real quaternion). More...
 
 operator ValueType () const
 Implicit conversion to the underlying scalar value (the real component). More...
 
RealQuaternionoperator= (const RealQuaternion &q)
 Copy-assigns the real component from q. More...
 
template<typename T1 >
RealQuaternionoperator= (const RealQuaternion< T1 > &q)
 Assigns the real component from q (possibly converting the component type). More...
 
template<typename T1 >
std::enable_if< IsScalar< T1 >::value, RealQuaternion >::type & operator= (const T1 &t)
 Assigns the scalar t to the real component. More...
 
template<typename T1 >
RealQuaternionoperator+= (const RealQuaternion< T1 > &q)
 Adds the real component of q to this quaternion's real component. More...
 
template<typename T1 >
std::enable_if< IsScalar< T1 >::value, RealQuaternion >::type & operator+= (const T1 &t)
 Adds the scalar t to the real component. More...
 
template<typename T1 >
RealQuaternionoperator-= (const RealQuaternion< T1 > &q)
 Subtracts the real component of q from this quaternion's real component. More...
 
template<typename T1 >
std::enable_if< IsScalar< T1 >::value, RealQuaternion >::type & operator-= (const T1 &t)
 Subtracts the scalar t from the real component. More...
 
template<typename T1 >
RealQuaternionoperator*= (const RealQuaternion< T1 > &q)
 Multiplies the real component by the real component of q. More...
 
template<typename T1 >
std::enable_if< IsScalar< T1 >::value, RealQuaternion >::type & operator*= (const T1 &t)
 Multiplies the real component by the scalar t. More...
 
template<typename T1 >
RealQuaternionoperator/= (const RealQuaternion< T1 > &q)
 Divides the real component by the real component of q. More...
 
template<typename T1 >
std::enable_if< IsScalar< T1 >::value, RealQuaternion >::type & operator/= (const T1 &t)
 Divides the real component by the scalar t. More...
 
template<typename T1 >
RealQuaternionassign (const RealQuaternion< T1 > &q)
 Assigns the real component from q without intermediate temporary. More...
 
template<typename T1 >
RealQuaternionplusAssign (const RealQuaternion< T1 > &q)
 Adds the real component of q to this quaternion's real component without intermediate temporary. More...
 
template<typename T1 >
RealQuaternionminusAssign (const RealQuaternion< T1 > &q)
 Subtracts the real component of q from this quaternion's real component without intermediate temporary. More...
 
void swap (RealQuaternion &q)
 Swaps the real component value with q. More...
 
- Public Member Functions inherited from CDPL::Math::QuaternionContainer< RealQuaternion< T > >
const ContainerTypeoperator() () const
 Returns a const reference to the derived quaternion container. More...
 
ContainerTypeoperator() ()
 Returns a reference to the derived quaternion container. More...
 
- Public Member Functions inherited from CDPL::Math::QuaternionExpression< E >
const ExpressionTypeoperator() () const
 Returns a const reference to the derived quaternion expression. More...
 
ExpressionTypeoperator() ()
 Returns a reference to the derived quaternion expression. More...
 

Friends

void swap (RealQuaternion &q1, RealQuaternion &q2)
 ADL-enabled free-function form of swap(). More...
 

Additional Inherited Members

- Protected Member Functions inherited from CDPL::Math::QuaternionContainer< RealQuaternion< T > >
 QuaternionContainer ()
 
 ~QuaternionContainer ()
 
- Protected Member Functions inherited from CDPL::Math::QuaternionExpression< E >
 QuaternionExpression ()
 
 ~QuaternionExpression ()
 
- Protected Member Functions inherited from CDPL::Math::Expression< E >
 Expression ()
 
 ~Expression ()
 

Detailed Description

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

Pure-real quaternion \( q = c_1 + 0i + 0j + 0k \) that stores only the real component.

Template Parameters
TThe scalar component value type.

Member Typedef Documentation

◆ ValueType

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

The scalar component value type.

◆ Reference

template<typename T >
typedef const T& CDPL::Math::RealQuaternion< T >::Reference

Reference type (always a const reference — only the real component is mutable, via assignment).

◆ ConstReference

template<typename T >
typedef const T& CDPL::Math::RealQuaternion< T >::ConstReference

Constant reference type to the real component.

◆ ClosureType

Closure type used when this quaternion appears inside another expression.

◆ ConstClosureType

template<typename T >
typedef const QuaternionReference<const SelfType> CDPL::Math::RealQuaternion< T >::ConstClosureType

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

◆ QuaternionTemporaryType

template<typename T >
typedef Quaternion<T> CDPL::Math::RealQuaternion< T >::QuaternionTemporaryType

Concrete temporary quaternion type used by expression-template machinery (a general Math::Quaternion<T>).

Constructor & Destructor Documentation

◆ RealQuaternion() [1/3]

template<typename T >
CDPL::Math::RealQuaternion< T >::RealQuaternion ( )
inline

Constructs a zero-valued real quaternion (C1 = 0).

◆ RealQuaternion() [2/3]

template<typename T >
CDPL::Math::RealQuaternion< T >::RealQuaternion ( const ValueType r)
inline

Constructs the real quaternion with the supplied real component.

Parameters
rThe real component value.

◆ RealQuaternion() [3/3]

template<typename T >
template<typename T1 >
CDPL::Math::RealQuaternion< T >::RealQuaternion ( const RealQuaternion< T1 > &  q)
inline

Constructs a copy of the real quaternion q (possibly converting the component type).

Template Parameters
T1The source component type.
Parameters
qThe real quaternion to copy.

Member Function Documentation

◆ getC1()

template<typename T >
ConstReference CDPL::Math::RealQuaternion< T >::getC1 ( ) const
inline

Returns a const reference to the real component C1.

Returns
A const reference to C1.

◆ getC2()

template<typename T >
ConstReference CDPL::Math::RealQuaternion< T >::getC2 ( ) const
inline

Returns a const reference to the imaginary component C2 (always zero for a real quaternion).

Returns
A const reference to the zero element.

◆ getC3()

template<typename T >
ConstReference CDPL::Math::RealQuaternion< T >::getC3 ( ) const
inline

Returns a const reference to the imaginary component C3 (always zero for a real quaternion).

Returns
A const reference to the zero element.

◆ getC4()

template<typename T >
ConstReference CDPL::Math::RealQuaternion< T >::getC4 ( ) const
inline

Returns a const reference to the imaginary component C4 (always zero for a real quaternion).

Returns
A const reference to the zero element.

◆ operator ValueType()

template<typename T >
CDPL::Math::RealQuaternion< T >::operator ValueType ( ) const
inline

Implicit conversion to the underlying scalar value (the real component).

Returns
The real component C1 by value.

◆ operator=() [1/3]

template<typename T >
RealQuaternion& CDPL::Math::RealQuaternion< T >::operator= ( const RealQuaternion< T > &  q)
inline

Copy-assigns the real component from q.

Parameters
qThe source real quaternion.
Returns
A reference to itself.

◆ operator=() [2/3]

template<typename T >
template<typename T1 >
RealQuaternion& CDPL::Math::RealQuaternion< T >::operator= ( const RealQuaternion< T1 > &  q)
inline

Assigns the real component from q (possibly converting the component type).

Template Parameters
T1The source component type.
Parameters
qThe source real quaternion.
Returns
A reference to itself.

◆ operator=() [3/3]

template<typename T >
template<typename T1 >
std::enable_if<IsScalar<T1>::value, RealQuaternion>::type& CDPL::Math::RealQuaternion< T >::operator= ( const T1 &  t)
inline

Assigns the scalar t to the real component.

Template Parameters
T1The scalar type.
Parameters
tThe scalar value.
Returns
A reference to itself.

◆ operator+=() [1/2]

template<typename T >
template<typename T1 >
RealQuaternion& CDPL::Math::RealQuaternion< T >::operator+= ( const RealQuaternion< T1 > &  q)
inline

Adds the real component of q to this quaternion's real component.

Template Parameters
T1The source component type.
Parameters
qThe source real quaternion.
Returns
A reference to itself.

◆ operator+=() [2/2]

template<typename T >
template<typename T1 >
std::enable_if<IsScalar<T1>::value, RealQuaternion>::type& CDPL::Math::RealQuaternion< T >::operator+= ( const T1 &  t)
inline

Adds the scalar t to the real component.

Template Parameters
T1The scalar type.
Parameters
tThe scalar addend.
Returns
A reference to itself.

◆ operator-=() [1/2]

template<typename T >
template<typename T1 >
RealQuaternion& CDPL::Math::RealQuaternion< T >::operator-= ( const RealQuaternion< T1 > &  q)
inline

Subtracts the real component of q from this quaternion's real component.

Template Parameters
T1The source component type.
Parameters
qThe source real quaternion.
Returns
A reference to itself.

◆ operator-=() [2/2]

template<typename T >
template<typename T1 >
std::enable_if<IsScalar<T1>::value, RealQuaternion>::type& CDPL::Math::RealQuaternion< T >::operator-= ( const T1 &  t)
inline

Subtracts the scalar t from the real component.

Template Parameters
T1The scalar type.
Parameters
tThe scalar subtrahend.
Returns
A reference to itself.

◆ operator*=() [1/2]

template<typename T >
template<typename T1 >
RealQuaternion& CDPL::Math::RealQuaternion< T >::operator*= ( const RealQuaternion< T1 > &  q)
inline

Multiplies the real component by the real component of q.

Template Parameters
T1The source component type.
Parameters
qThe source real quaternion.
Returns
A reference to itself.

◆ operator*=() [2/2]

template<typename T >
template<typename T1 >
std::enable_if<IsScalar<T1>::value, RealQuaternion>::type& CDPL::Math::RealQuaternion< T >::operator*= ( const T1 &  t)
inline

Multiplies the real component by the scalar t.

Template Parameters
T1The scalar type.
Parameters
tThe scalar multiplier.
Returns
A reference to itself.

◆ operator/=() [1/2]

template<typename T >
template<typename T1 >
RealQuaternion& CDPL::Math::RealQuaternion< T >::operator/= ( const RealQuaternion< T1 > &  q)
inline

Divides the real component by the real component of q.

Template Parameters
T1The source component type.
Parameters
qThe source real quaternion.
Returns
A reference to itself.

◆ operator/=() [2/2]

template<typename T >
template<typename T1 >
std::enable_if<IsScalar<T1>::value, RealQuaternion>::type& CDPL::Math::RealQuaternion< T >::operator/= ( const T1 &  t)
inline

Divides the real component by the scalar t.

Template Parameters
T1The scalar type.
Parameters
tThe scalar divisor.
Returns
A reference to itself.

◆ assign()

template<typename T >
template<typename T1 >
RealQuaternion& CDPL::Math::RealQuaternion< T >::assign ( const RealQuaternion< T1 > &  q)
inline

Assigns the real component from q without intermediate temporary.

Template Parameters
T1The source component type.
Parameters
qThe source real quaternion.
Returns
A reference to itself.

◆ plusAssign()

template<typename T >
template<typename T1 >
RealQuaternion& CDPL::Math::RealQuaternion< T >::plusAssign ( const RealQuaternion< T1 > &  q)
inline

Adds the real component of q to this quaternion's real component without intermediate temporary.

Template Parameters
T1The source component type.
Parameters
qThe source real quaternion.
Returns
A reference to itself.

◆ minusAssign()

template<typename T >
template<typename T1 >
RealQuaternion& CDPL::Math::RealQuaternion< T >::minusAssign ( const RealQuaternion< T1 > &  q)
inline

Subtracts the real component of q from this quaternion's real component without intermediate temporary.

Template Parameters
T1The source component type.
Parameters
qThe source real quaternion.
Returns
A reference to itself.

◆ swap()

template<typename T >
void CDPL::Math::RealQuaternion< T >::swap ( RealQuaternion< T > &  q)
inline

Swaps the real component value with q.

Parameters
qThe real quaternion to swap with.

Friends And Related Function Documentation

◆ swap

template<typename T >
void swap ( RealQuaternion< T > &  q1,
RealQuaternion< T > &  q2 
)
friend

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

Parameters
q1The first real quaternion.
q2The second real quaternion.

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