27 #ifndef CDPL_MATH_QUATERNIONADAPTER_HPP
28 #define CDPL_MATH_QUATERNIONADAPTER_HPP
31 #include <type_traits>
85 typedef typename std::conditional<std::is_const<Q>::value,
86 typename Q::ConstReference,
92 typedef typename std::conditional<std::is_const<Q>::value,
93 typename Q::ConstClosureType,
242 template <
typename E>
255 template <
typename E>
268 template <
typename E>
281 template <
typename T>
284 vectorAssignScalar<ScalarMultiplicationAssignment>(*
this, t);
294 template <
typename T>
297 vectorAssignScalar<ScalarDivisionAssignment>(*
this, t);
308 template <
typename E>
311 vectorAssignVector<ScalarAssignment>(*
this, e);
321 template <
typename E>
324 vectorAssignVector<ScalarAdditionAssignment>(*
this, e);
334 template <
typename E>
337 vectorAssignVector<ScalarSubtractionAssignment>(*
this, e);
365 template <
typename T, std::
size_t N>
372 template <
typename Q>
386 template <
typename Q>
402 template <
typename E>
415 template <
typename E>
416 QuaternionVectorAdapter<const E>
Definition of exception classes.
Definition of basic expression types.
Definition of various functors.
Definition of type traits.
Implementation of vector assignment routines.
Thrown to indicate that an index is out of range.
Definition: Base/Exceptions.hpp:152
Fixed-size vector of dimension N backed by a C-array (no dynamic allocation).
Definition: Vector.hpp:2047
CRTP base class of all quaternion expression types.
Definition: Expression.hpp:148
Adapter that exposes a quaternion as a 4 element vector expression (indices map to the components C1,...
Definition: QuaternionAdapter.hpp:52
QuaternionVectorAdapter(QuaternionType &q)
Constructs the adapter wrapping the quaternion q.
Definition: QuaternionAdapter.hpp:110
const SelfType ConstClosureType
Constant closure type used when this adapter appears inside another expression.
Definition: QuaternionAdapter.hpp:99
QuaternionVectorAdapter & assign(const VectorExpression< E > &e)
Assigns the vector expression e to this view without intermediate temporary (use only when e does not...
Definition: QuaternionAdapter.hpp:309
QuaternionClosureType & getData()
Returns a reference to the wrapped quaternion (via its stored closure).
Definition: QuaternionAdapter.hpp:211
SizeType getSize() const
Returns the dimensionality of the view (always 4).
Definition: QuaternionAdapter.hpp:193
Q::ConstReference ConstReference
Constant element reference type of the wrapped quaternion.
Definition: QuaternionAdapter.hpp:80
friend void swap(QuaternionVectorAdapter &a1, QuaternionVectorAdapter &a2)
ADL-enabled free-function form of swap().
Definition: QuaternionAdapter.hpp:356
Reference operator()(SizeType i)
Returns a mutable reference to the quaternion component at index i.
Definition: QuaternionAdapter.hpp:119
ConstReference operator[](SizeType i) const
Returns a const reference to the quaternion component at index i.
Definition: QuaternionAdapter.hpp:184
QuaternionVectorAdapter & minusAssign(const VectorExpression< E > &e)
Subtracts the vector expression e from this view without intermediate temporary.
Definition: QuaternionAdapter.hpp:335
std::conditional< std::is_const< Q >::value, typename Q::ConstClosureType, typename Q::ClosureType >::type QuaternionClosureType
Closure type used to store the wrapped quaternion internally (mutable or const flavor).
Definition: QuaternionAdapter.hpp:94
QuaternionVectorAdapter & operator+=(const VectorExpression< E > &e)
Adds the vector expression e componentwise to this view.
Definition: QuaternionAdapter.hpp:256
bool isEmpty() const
Tells whether the view is empty (always false, the view is fixed-size with 4 components).
Definition: QuaternionAdapter.hpp:202
std::enable_if< IsScalar< T >::value, QuaternionVectorAdapter >::type & operator/=(const T &t)
Divides every component of this view by the scalar t.
Definition: QuaternionAdapter.hpp:295
std::conditional< std::is_const< Q >::value, typename Q::ConstReference, typename Q::Reference >::type Reference
Mutable element reference type (degrades to ConstReference when the wrapped quaternion is const).
Definition: QuaternionAdapter.hpp:87
QuaternionVectorAdapter & operator-=(const VectorExpression< E > &e)
Subtracts the vector expression e componentwise from this view.
Definition: QuaternionAdapter.hpp:269
std::size_t SizeType
The size type (std::size_t).
Definition: QuaternionAdapter.hpp:65
void swap(QuaternionVectorAdapter &a)
Swaps the components of this view with those of a.
Definition: QuaternionAdapter.hpp:345
QuaternionVectorAdapter & plusAssign(const VectorExpression< E > &e)
Adds the vector expression e to this view without intermediate temporary.
Definition: QuaternionAdapter.hpp:322
SelfType ClosureType
Closure type used when this adapter appears inside another expression.
Definition: QuaternionAdapter.hpp:104
std::ptrdiff_t DifferenceType
The signed difference type (std::ptrdiff_t).
Definition: QuaternionAdapter.hpp:70
Reference operator[](SizeType i)
Returns a mutable reference to the quaternion component at index i.
Definition: QuaternionAdapter.hpp:173
ConstReference operator()(SizeType i) const
Returns a const reference to the quaternion component at index i.
Definition: QuaternionAdapter.hpp:146
QuaternionVectorAdapter & operator=(const QuaternionVectorAdapter &a)
Copies the components of a into this view (writing through to the wrapped quaternion).
Definition: QuaternionAdapter.hpp:230
Q::ValueType ValueType
The element value type of the wrapped quaternion.
Definition: QuaternionAdapter.hpp:75
const QuaternionClosureType & getData() const
Returns a const reference to the wrapped quaternion (via its stored closure).
Definition: QuaternionAdapter.hpp:220
std::enable_if< IsScalar< T >::value, QuaternionVectorAdapter >::type & operator*=(const T &t)
Multiplies every component of this view by the scalar t.
Definition: QuaternionAdapter.hpp:282
Q QuaternionType
The wrapped quaternion type.
Definition: QuaternionAdapter.hpp:60
QuaternionVectorAdapter & operator=(const VectorExpression< E > &e)
Assigns the vector expression e to this view (writing through to the wrapped quaternion).
Definition: QuaternionAdapter.hpp:243
CRTP base class of all vector expression types.
Definition: Expression.hpp:68
const ExpressionType & operator()() const
Returns a const reference to the derived vector expression class instance.
Definition: Expression.hpp:80
constexpr unsigned int T
Specifies Hydrogen (Tritium).
Definition: AtomType.hpp:67
constexpr unsigned int Q
Generic type that covers any element except hydrogen and carbon.
Definition: AtomType.hpp:647
QuaternionVectorAdapter< E > vec(QuaternionExpression< E > &e)
Creates a mutable Math::QuaternionVectorAdapter view of the quaternion expression e.
Definition: QuaternionAdapter.hpp:404
void vectorSwap(V &v, VectorExpression< E > &e)
Swaps the elements of two equally sized vector expressions element by element.
Definition: VectorAssignment.hpp:97
The namespace of the Chemical Data Processing Library.
CVector< typename Q::ValueType, 4 > Type
The Math::CVector specialization used as the temporary vector type.
Definition: QuaternionAdapter.hpp:379
CVector< typename Q::ValueType, 4 > Type
The Math::CVector specialization used as the temporary vector type.
Definition: QuaternionAdapter.hpp:393
Selects a concrete temporary vector type compatible with the vector expression V.
Definition: TypeTraits.hpp:323
V::VectorTemporaryType Type
The concrete temporary vector type compatible with the vector expression V.
Definition: TypeTraits.hpp:328