QuaternionHelpers.hpp
Go to the documentation of this file.
1 // Distributed under the MIT License.
2 // See LICENSE.txt for details.
3 
4 /// \file
5 /// Defines helper functions for converting between `DataVector`s and boost
6 /// quaternions.
7 
8 #pragma once
9 
10 #include <boost/math/quaternion.hpp>
11 
12 #include "DataStructures/DataVector.hpp"
13 
14 /// \cond
15 namespace gsl {
16 template <class T>
17 class not_null;
18 } // namespace gsl
19 /// \endcond
20 
21 /// Convert a `boost::math::quaternion` to a `DataVector`
23  const boost::math::quaternion<double>& input) noexcept;
24 
25 /// \brief Convert a `DataVector` to a `boost::math::quaternion`
26 ///
27 /// \details To convert to a quaternion, a `DataVector` must have either 3 or 4
28 /// components. If it has 3 components, the quaternion will be constructed with
29 /// 0 scalar part while the vector part is the `DataVector`. If the `DataVector`
30 /// has 4 components, the quaternion is just the `DataVector` itself.
31 boost::math::quaternion<double> datavector_to_quaternion(
32  const DataVector& input) noexcept;
33 
34 /// Normalize a `boost::math::quaternion`
36  gsl::not_null<boost::math::quaternion<double>*> input) noexcept;
DataVector
Stores a collection of function values.
Definition: DataVector.hpp:46
quaternion_to_datavector
DataVector quaternion_to_datavector(const boost::math::quaternion< double > &input) noexcept
Convert a boost::math::quaternion to a DataVector
datavector_to_quaternion
boost::math::quaternion< double > datavector_to_quaternion(const DataVector &input) noexcept
Convert a DataVector to a boost::math::quaternion
normalize_quaternion
void normalize_quaternion(gsl::not_null< boost::math::quaternion< double > * > input) noexcept
Normalize a boost::math::quaternion
gsl
Implementations from the Guideline Support Library.
Definition: ReadSpecPiecewisePolynomial.hpp:11
gsl::not_null
Require a pointer to not be a nullptr
Definition: ReadSpecPiecewisePolynomial.hpp:13