27 #ifndef CDPL_MATH_QUATERNIONADAPTER_HPP
28 #define CDPL_MATH_QUATERNIONADAPTER_HPP
31 #include <type_traits>
68 typedef typename std::conditional<std::is_const<Q>::value,
69 typename Q::ConstReference,
72 typedef typename std::conditional<std::is_const<Q>::value,
73 typename Q::ConstClosureType,
216 template <
typename E>
229 template <
typename E>
242 template <
typename E>
255 template <
typename T>
258 vectorAssignScalar<ScalarMultiplicationAssignment>(*
this, t);
268 template <
typename T>
271 vectorAssignScalar<ScalarDivisionAssignment>(*
this, t);
282 template <
typename E>
285 vectorAssignVector<ScalarAssignment>(*
this, e);
295 template <
typename E>
298 vectorAssignVector<ScalarAdditionAssignment>(*
this, e);
308 template <
typename E>
311 vectorAssignVector<ScalarSubtractionAssignment>(*
this, e);
339 template <
typename T, std::
size_t N>
346 template <
typename Q>
357 template <
typename Q>
370 template <
typename E>
383 template <
typename E>
384 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:1876
CRTP base class for all quaternion expression types.
Definition: Expression.hpp:142
View adapter that exposes a quaternion as a 4-element vector expression (indices map to the component...
Definition: QuaternionAdapter.hpp:52
QuaternionVectorAdapter(QuaternionType &q)
Constructs the adapter wrapping the quaternion q.
Definition: QuaternionAdapter.hpp:84
const SelfType ConstClosureType
Constant closure type used when this adapter appears inside another expression.
Definition: QuaternionAdapter.hpp:76
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:283
QuaternionClosureType & getData()
Returns a reference to the wrapped quaternion (via its stored closure).
Definition: QuaternionAdapter.hpp:185
SizeType getSize() const
Returns the dimensionality of the view (always 4).
Definition: QuaternionAdapter.hpp:167
Q::ConstReference ConstReference
Constant reference type to an element of the wrapped quaternion.
Definition: QuaternionAdapter.hpp:66
friend void swap(QuaternionVectorAdapter &a1, QuaternionVectorAdapter &a2)
ADL-enabled free-function form of swap().
Definition: QuaternionAdapter.hpp:330
Reference operator()(SizeType i)
Returns a mutable reference to the quaternion component at index i.
Definition: QuaternionAdapter.hpp:93
ConstReference operator[](SizeType i) const
Returns a const reference to the quaternion component at index i (alias for operator()).
Definition: QuaternionAdapter.hpp:158
QuaternionVectorAdapter & minusAssign(const VectorExpression< E > &e)
Subtracts the vector expression e from this view without intermediate temporary.
Definition: QuaternionAdapter.hpp:309
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:74
QuaternionVectorAdapter & operator+=(const VectorExpression< E > &e)
Adds the vector expression e componentwise to this view.
Definition: QuaternionAdapter.hpp:230
bool isEmpty() const
Tells whether the view is empty (always false; the view is fixed-size with 4 components).
Definition: QuaternionAdapter.hpp:176
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:269
std::conditional< std::is_const< Q >::value, typename Q::ConstReference, typename Q::Reference >::type Reference
Mutable reference type (degrades to ConstReference when the wrapped quaternion is const).
Definition: QuaternionAdapter.hpp:70
QuaternionVectorAdapter & operator-=(const VectorExpression< E > &e)
Subtracts the vector expression e componentwise from this view.
Definition: QuaternionAdapter.hpp:243
std::size_t SizeType
The size type (std::size_t).
Definition: QuaternionAdapter.hpp:60
void swap(QuaternionVectorAdapter &a)
Swaps the components of this view with those of a.
Definition: QuaternionAdapter.hpp:319
QuaternionVectorAdapter & plusAssign(const VectorExpression< E > &e)
Adds the vector expression e to this view without intermediate temporary.
Definition: QuaternionAdapter.hpp:296
SelfType ClosureType
Closure type used when this adapter appears inside another expression.
Definition: QuaternionAdapter.hpp:78
std::ptrdiff_t DifferenceType
The signed difference type (std::ptrdiff_t).
Definition: QuaternionAdapter.hpp:62
Reference operator[](SizeType i)
Returns a mutable reference to the quaternion component at index i (alias for operator()).
Definition: QuaternionAdapter.hpp:147
ConstReference operator()(SizeType i) const
Returns a const reference to the quaternion component at index i.
Definition: QuaternionAdapter.hpp:120
QuaternionVectorAdapter & operator=(const QuaternionVectorAdapter &a)
Copies the components of a into this view (writing through to the wrapped quaternion).
Definition: QuaternionAdapter.hpp:204
Q::ValueType ValueType
The element value type of the wrapped quaternion.
Definition: QuaternionAdapter.hpp:64
const QuaternionClosureType & getData() const
Returns a const reference to the wrapped quaternion (via its stored closure).
Definition: QuaternionAdapter.hpp:194
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:256
Q QuaternionType
The wrapped quaternion type.
Definition: QuaternionAdapter.hpp:58
QuaternionVectorAdapter & operator=(const VectorExpression< E > &e)
Assigns the vector expression e to this view (writing through to the wrapped quaternion).
Definition: QuaternionAdapter.hpp:217
CRTP base class for all vector expression types.
Definition: Expression.hpp:66
const ExpressionType & operator()() const
Returns a const reference to the derived vector expression.
Definition: Expression.hpp:76
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:372
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
Definition: QuaternionAdapter.hpp:350
CVector< typename Q::ValueType, 4 > Type
Definition: QuaternionAdapter.hpp:361
Selects a concrete temporary vector type compatible with the vector expression V.
Definition: TypeTraits.hpp:301
V::VectorTemporaryType Type
The concrete temporary vector type compatible with the vector expression V.
Definition: TypeTraits.hpp:304