QuaternionHelpers.hpp File Reference
#include <boost/math/quaternion.hpp>
#include "DataStructures/DataVector.hpp"

Go to the source code of this file.


DataVector quaternion_to_datavector (const boost::math::quaternion< double > &input) noexcept
 Convert a boost::math::quaternion to a DataVector
boost::math::quaternion< double > datavector_to_quaternion (const DataVector &input) noexcept
 Convert a DataVector to a boost::math::quaternion More...
void normalize_quaternion (gsl::not_null< boost::math::quaternion< double > * > input) noexcept
 Normalize a boost::math::quaternion

Detailed Description

Defines helper functions for converting between DataVectors and boost quaternions.

Function Documentation

◆ datavector_to_quaternion()

boost::math::quaternion<double> datavector_to_quaternion ( const DataVector input)

Convert a DataVector to a boost::math::quaternion


To convert to a quaternion, a DataVector must have either 3 or 4 components. If it has 3 components, the quaternion will be constructed with 0 scalar part while the vector part is the DataVector. If the DataVector has 4 components, the quaternion is just the DataVector itself.